mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +03:00
Compare commits
111 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
6231958ddc | ||
|
359edc7d8a | ||
|
f9998f03ad | ||
|
c479c4f6d8 | ||
|
c51df6bfd2 | ||
|
5e43274280 | ||
|
efe960751c | ||
|
6b9e0dc3f8 | ||
|
2ef94c994e | ||
|
1dd4b902c0 | ||
|
a846d36326 | ||
|
86e352849d | ||
|
6d140acb14 | ||
|
44be123039 | ||
|
47263fa6a3 | ||
|
b0afa94d10 | ||
|
c772c6caa4 | ||
|
53eae1a935 | ||
|
d22b135217 | ||
|
3c7c705d77 | ||
|
fc72568ba9 | ||
|
107b57a955 | ||
|
8b301eb865 | ||
|
1f469e3781 | ||
|
ce4d294074 | ||
|
9f338a00a1 | ||
|
a011359b8a | ||
|
42e4ae96ae | ||
|
686926c0a9 | ||
|
a638dd6224 | ||
|
961a306dc4 | ||
|
195a068c4f | ||
|
669e0dfc17 | ||
|
74cb5673a5 | ||
|
768f3a4a19 | ||
|
2a8c5ad46c | ||
|
7ea3eff4f8 | ||
|
c07f4ee70d | ||
|
6cc679d81c | ||
|
62f554bc3f | ||
|
7eeb5d5fbf | ||
|
9b7f1aea28 | ||
|
1e96cf65fa | ||
|
03275c0be1 | ||
|
2f33e34038 | ||
|
3eb891ec49 | ||
|
057dcfddf7 | ||
|
3837b3bf28 | ||
|
db2bfd1e83 | ||
|
a855215141 | ||
|
195aac3a42 | ||
|
f706dd34b3 | ||
|
c325231de6 | ||
|
91a2f58f8f | ||
|
8175a70c4e | ||
|
f9990707fe | ||
|
aba5c241c6 | ||
|
cc164fd7dc | ||
|
d7d89acb39 | ||
|
d444cc35c6 | ||
|
eeba62cbd3 | ||
|
185d29b92f | ||
|
2923ef0df8 | ||
|
402ad27743 | ||
|
f8d4cfbb80 | ||
|
aaacd83510 | ||
|
3e06b70623 | ||
|
b77de43fb0 | ||
|
59223e118d | ||
|
3b5a94a165 | ||
|
5cbd98a5be | ||
|
25b5e83a4c | ||
|
3c9178dd5c | ||
|
f73592edf0 | ||
|
a24391a133 | ||
|
3a24514d48 | ||
|
3453354ee1 | ||
|
9218d04b9a | ||
|
259b930379 | ||
|
3536158f11 | ||
|
cb77bfc4f0 | ||
|
92f1875fc0 | ||
|
a453f9d128 | ||
|
492b09dcae | ||
|
f55fe3b3f7 | ||
|
51329afcef | ||
|
13f5da81ad | ||
|
f0049a9599 | ||
|
0b4962a7f0 | ||
|
b3284f3ba9 | ||
|
b95eefe1c2 | ||
|
5bde4773f9 | ||
|
b0f92d3d5c | ||
|
b9f787f180 | ||
|
a939fd40eb | ||
|
c4ea4ca3d1 | ||
|
f3573fb54b | ||
|
78aade7569 | ||
|
03b0ca59cb | ||
|
d6baf70a93 | ||
|
526c506cb0 | ||
|
2949b238c1 | ||
|
dfb5aebd35 | ||
|
8da2801496 | ||
|
e92d322d40 | ||
|
b71cb85f67 | ||
|
05cfce4d83 | ||
|
d7eefb11bf | ||
|
80d4753574 | ||
|
ed6a17ef6c | ||
|
2182812a5b |
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/adm/cmake")
|
||||
|
||||
@@ -6,6 +6,26 @@ set (CMAKE_SUPPRESS_REGENERATION TRUE)
|
||||
|
||||
set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
|
||||
|
||||
# set using C++ standard
|
||||
set (BUILD_CPP_STANDARD "C++11" CACHE STRING "Select using c++ standard.")
|
||||
set_property(CACHE BUILD_CPP_STANDARD PROPERTY STRINGS "C++11" "C++14" "C++17" "C++20" "C++23")
|
||||
|
||||
# Set desired C++ standard
|
||||
if ("${BUILD_CPP_STANDARD}" STREQUAL "C++11")
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++14")
|
||||
set (CMAKE_CXX_STANDARD 14)
|
||||
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++17")
|
||||
set (CMAKE_CXX_STANDARD 17)
|
||||
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++20")
|
||||
set (CMAKE_CXX_STANDARD 20)
|
||||
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++23")
|
||||
set (CMAKE_CXX_STANDARD 23)
|
||||
else ()
|
||||
message (FATAL_ERROR, "misprint in c++ standard name")
|
||||
endif()
|
||||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# macro: include patched file if it exists
|
||||
macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
|
||||
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake")
|
||||
@@ -800,6 +820,12 @@ else()
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_DOT_EXECUTABLE")
|
||||
endif()
|
||||
|
||||
# ExpToCasExe
|
||||
if (EMSCRIPTEN)
|
||||
list (REMOVE_ITEM BUILD_TOOLKITS TKExpress)
|
||||
list (REMOVE_ITEM BUILD_TOOLKITS ExpToCasExe)
|
||||
endif()
|
||||
|
||||
# bison
|
||||
if (BUILD_YACCLEX)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/bison")
|
||||
|
@@ -3,5 +3,5 @@ ModelingData TKG2d TKG3d TKGeomBase TKBRep
|
||||
ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
|
||||
Visualization TKService TKV3d TKOpenGl TKOpenGles TKMeshVS TKIVtk TKD3DHost
|
||||
ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF
|
||||
DataExchange TKXDE TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh TKXDECascade
|
||||
DataExchange TKXDE TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh TKXDECascade TKExpress ExpToCasExe
|
||||
Draw TKDraw TKTopTest TKOpenGlTest TKOpenGlesTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
|
||||
|
@@ -480,3 +480,6 @@ n TreeModel
|
||||
n View
|
||||
n ViewControl
|
||||
n VInspector
|
||||
n Express
|
||||
t TKExpress
|
||||
x ExpToCasExe
|
||||
|
@@ -22,6 +22,4 @@ if (3RDPARTY_DIR)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# bison 3.2 is required because it provides options to avoid generation of redundant header
|
||||
# files and embedding of local paths in the generated code
|
||||
find_package (BISON 3.2)
|
||||
find_package (BISON 3.7.4)
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# See the cotire manual for usage hints.
|
||||
#
|
||||
#=============================================================================
|
||||
# Copyright 2012-2016 Sascha Kratky
|
||||
# Copyright 2012-2018 Sascha Kratky
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation
|
||||
@@ -43,7 +43,7 @@ if (NOT CMAKE_SCRIPT_MODE_FILE)
|
||||
endif()
|
||||
|
||||
set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
|
||||
set (COTIRE_CMAKE_MODULE_VERSION "1.7.9")
|
||||
set (COTIRE_CMAKE_MODULE_VERSION "1.8.1")
|
||||
|
||||
# activate select policies
|
||||
if (POLICY CMP0025)
|
||||
@@ -106,6 +106,11 @@ if (POLICY CMP0054)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
endif()
|
||||
|
||||
if (POLICY CMP0055)
|
||||
# strict checking for break() command
|
||||
cmake_policy(SET CMP0055 NEW)
|
||||
endif()
|
||||
|
||||
include(CMakeParseArguments)
|
||||
include(ProcessorCount)
|
||||
|
||||
@@ -234,7 +239,13 @@ function (cotire_filter_language_source_files _language _target _sourceFilesVar
|
||||
# add to excluded sources, if file has custom compile flags
|
||||
list (APPEND _excludedSourceFiles "${_sourceFile}")
|
||||
else()
|
||||
list (APPEND _sourceFiles "${_sourceFile}")
|
||||
get_source_file_property(_sourceCompileOptions "${_sourceFile}" COMPILE_OPTIONS)
|
||||
if (_sourceCompileOptions)
|
||||
# add to excluded sources, if file has list of custom compile options
|
||||
list (APPEND _excludedSourceFiles "${_sourceFile}")
|
||||
else()
|
||||
list (APPEND _sourceFiles "${_sourceFile}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -293,7 +304,7 @@ function (cotire_get_source_file_property_values _valuesVar _property)
|
||||
set (${_valuesVar} ${_values} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function (cotire_resolve_config_properites _configurations _propertiesVar)
|
||||
function (cotire_resolve_config_properties _configurations _propertiesVar)
|
||||
set (_properties "")
|
||||
foreach (_property ${ARGN})
|
||||
if ("${_property}" MATCHES "<CONFIG>")
|
||||
@@ -309,8 +320,8 @@ function (cotire_resolve_config_properites _configurations _propertiesVar)
|
||||
set (${_propertiesVar} ${_properties} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function (cotire_copy_set_properites _configurations _type _source _target)
|
||||
cotire_resolve_config_properites("${_configurations}" _properties ${ARGN})
|
||||
function (cotire_copy_set_properties _configurations _type _source _target)
|
||||
cotire_resolve_config_properties("${_configurations}" _properties ${ARGN})
|
||||
foreach (_property ${_properties})
|
||||
get_property(_isSet ${_type} ${_source} PROPERTY ${_property} SET)
|
||||
if (_isSet)
|
||||
@@ -320,13 +331,18 @@ function (cotire_copy_set_properites _configurations _type _source _target)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function (cotire_get_target_usage_requirements _target _targetRequirementsVar)
|
||||
function (cotire_get_target_usage_requirements _target _config _targetRequirementsVar)
|
||||
set (_targetRequirements "")
|
||||
get_target_property(_librariesToProcess ${_target} LINK_LIBRARIES)
|
||||
while (_librariesToProcess)
|
||||
# remove from head
|
||||
list (GET _librariesToProcess 0 _library)
|
||||
list (REMOVE_AT _librariesToProcess 0)
|
||||
if (_library MATCHES "^\\$<\\$<CONFIG:${_config}>:([A-Za-z0-9_:-]+)>$")
|
||||
set (_library "${CMAKE_MATCH_1}")
|
||||
elseif (_config STREQUAL "None" AND _library MATCHES "^\\$<\\$<CONFIG:>:([A-Za-z0-9_:-]+)>$")
|
||||
set (_library "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
if (TARGET ${_library})
|
||||
list (FIND _targetRequirements ${_library} _index)
|
||||
if (_index LESS 0)
|
||||
@@ -441,7 +457,7 @@ function (cotire_get_target_compile_flags _config _language _target _flagsVar)
|
||||
# interface compile options from linked library targets
|
||||
if (_target)
|
||||
set (_linkedTargets "")
|
||||
cotire_get_target_usage_requirements(${_target} _linkedTargets)
|
||||
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
|
||||
foreach (_linkedTarget ${_linkedTargets})
|
||||
get_target_property(_targetOptions ${_linkedTarget} INTERFACE_COMPILE_OPTIONS)
|
||||
if (_targetOptions)
|
||||
@@ -573,7 +589,7 @@ function (cotire_get_target_include_directories _config _language _target _inclu
|
||||
# interface include directories from linked library targets
|
||||
if (_target)
|
||||
set (_linkedTargets "")
|
||||
cotire_get_target_usage_requirements(${_target} _linkedTargets)
|
||||
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
|
||||
foreach (_linkedTarget ${_linkedTargets})
|
||||
get_target_property(_linkedTargetType ${_linkedTarget} TYPE)
|
||||
if (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE AND NOT CMAKE_VERSION VERSION_LESS "3.4.0" AND
|
||||
@@ -627,7 +643,7 @@ function (cotire_get_target_include_directories _config _language _target _inclu
|
||||
if (CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES)
|
||||
list (REMOVE_ITEM _includeDirs ${CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES})
|
||||
endif()
|
||||
if (WIN32)
|
||||
if (WIN32 AND NOT MINGW)
|
||||
# convert Windows paths in include directories to CMake paths
|
||||
if (_includeDirs)
|
||||
set (_paths "")
|
||||
@@ -703,7 +719,7 @@ function (cotire_get_target_compile_definitions _config _language _target _defin
|
||||
endif()
|
||||
# interface compile definitions from linked library targets
|
||||
set (_linkedTargets "")
|
||||
cotire_get_target_usage_requirements(${_target} _linkedTargets)
|
||||
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
|
||||
foreach (_linkedTarget ${_linkedTargets})
|
||||
get_target_property(_definitions ${_linkedTarget} INTERFACE_COMPILE_DEFINITIONS)
|
||||
if (_definitions)
|
||||
@@ -711,7 +727,7 @@ function (cotire_get_target_compile_definitions _config _language _target _defin
|
||||
endif()
|
||||
endforeach()
|
||||
# parse additional compile definitions from target compile flags
|
||||
# and don't look at directory compile definitions, which we already handled
|
||||
# and do not look at directory compile definitions, which we already handled
|
||||
set (_targetFlags "")
|
||||
cotire_get_target_compile_flags("${_config}" "${_language}" "${_target}" _targetFlags)
|
||||
cotire_filter_compile_flags("${_language}" "D" _definitions _ignore ${_targetFlags})
|
||||
@@ -859,6 +875,9 @@ macro (cotire_set_cmd_to_prologue _cmdVar)
|
||||
list (APPEND ${_cmdVar} "--warn-uninitialized")
|
||||
endif()
|
||||
list (APPEND ${_cmdVar} "-DCOTIRE_BUILD_TYPE:STRING=$<CONFIGURATION>")
|
||||
if (XCODE)
|
||||
list (APPEND ${_cmdVar} "-DXCODE:BOOL=TRUE")
|
||||
endif()
|
||||
if (COTIRE_VERBOSE)
|
||||
list (APPEND ${_cmdVar} "-DCOTIRE_VERBOSE:BOOL=ON")
|
||||
elseif("${CMAKE_GENERATOR}" MATCHES "Makefiles")
|
||||
@@ -876,6 +895,9 @@ function (cotire_init_compile_cmd _cmdVar _language _compilerLauncher _compilerE
|
||||
if (NOT _compilerArg1)
|
||||
set (_compilerArg1 ${CMAKE_${_language}_COMPILER_ARG1})
|
||||
endif()
|
||||
if (WIN32)
|
||||
file (TO_NATIVE_PATH "${_compilerExe}" _compilerExe)
|
||||
endif()
|
||||
string (STRIP "${_compilerArg1}" _compilerArg1)
|
||||
if ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
|
||||
# compiler launcher is only supported for Makefile and Ninja
|
||||
@@ -902,16 +924,16 @@ function (cotire_add_includes_to_cmd _cmdVar _language _includesVar _systemInclu
|
||||
foreach (_include ${_includeDirs})
|
||||
if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
file (TO_NATIVE_PATH "${_include}" _include)
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}")
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
|
||||
else()
|
||||
set (_index -1)
|
||||
if ("${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" MATCHES ".+")
|
||||
list (FIND ${_systemIncludesVar} "${_include}" _index)
|
||||
endif()
|
||||
if (_index GREATER -1)
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${_include}")
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
|
||||
else()
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}")
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -1046,10 +1068,10 @@ macro (cotire_check_ignore_header_file_path _headerFile _headerIsIgnoredVar)
|
||||
set (${_headerIsIgnoredVar} TRUE)
|
||||
elseif (IS_DIRECTORY "${_headerFile}")
|
||||
set (${_headerIsIgnoredVar} TRUE)
|
||||
elseif ("${_headerFile}" MATCHES "\\.\\.|[_-]fixed" AND "${_headerFile}" MATCHES "\\.h$")
|
||||
# heuristic: ignore C headers with embedded parent directory references or "-fixed" or "_fixed" in path
|
||||
elseif ("${_headerFile}" MATCHES "\\.\\.|[_-]fixed")
|
||||
# heuristic: ignore headers with embedded parent directory references or "-fixed" or "_fixed" in path
|
||||
# these often stem from using GCC #include_next tricks, which may break the precompiled header compilation
|
||||
# with the error message "error: no include path in which to search for header.h"
|
||||
# with the error message "error: no include path in which to search for header"
|
||||
set (${_headerIsIgnoredVar} TRUE)
|
||||
else()
|
||||
set (${_headerIsIgnoredVar} FALSE)
|
||||
@@ -1070,12 +1092,11 @@ endmacro()
|
||||
|
||||
macro (cotire_parse_line _line _headerFileVar _headerDepthVar)
|
||||
if (MSVC)
|
||||
# cl.exe /showIncludes output looks different depending on the language pack used, e.g.:
|
||||
# cl.exe /showIncludes produces different output, depending on the language pack used, e.g.:
|
||||
# English: "Note: including file: C:\directory\file"
|
||||
# German: "Hinweis: Einlesen der Datei: C:\directory\file"
|
||||
# We use a very general regular expression, relying on the presence of the : characters
|
||||
if (_line MATCHES "( +)([a-zA-Z]:[^:]+)$")
|
||||
# Visual Studio compiler output
|
||||
string (LENGTH "${CMAKE_MATCH_1}" ${_headerDepthVar})
|
||||
get_filename_component(${_headerFileVar} "${CMAKE_MATCH_2}" ABSOLUTE)
|
||||
else()
|
||||
@@ -1233,11 +1254,19 @@ function (cotire_scan_includes _includesVar)
|
||||
set (${_includesVar} "" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
list (APPEND _cmd ${_existingSourceFiles})
|
||||
# add source files to be scanned
|
||||
if (WIN32)
|
||||
foreach (_sourceFile ${_existingSourceFiles})
|
||||
file (TO_NATIVE_PATH "${_sourceFile}" _sourceFileNative)
|
||||
list (APPEND _cmd "${_sourceFileNative}")
|
||||
endforeach()
|
||||
else()
|
||||
list (APPEND _cmd ${_existingSourceFiles})
|
||||
endif()
|
||||
if (COTIRE_VERBOSE)
|
||||
message (STATUS "execute_process: ${_cmd}")
|
||||
endif()
|
||||
if (_option_COMPILER_ID MATCHES "MSVC")
|
||||
if (MSVC_IDE OR _option_COMPILER_ID MATCHES "MSVC")
|
||||
# cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared
|
||||
unset (ENV{VS_UNICODE_OUTPUT})
|
||||
endif()
|
||||
@@ -1473,11 +1502,16 @@ function (cotire_generate_prefix_header _prefixFile)
|
||||
if (_unparsedLines)
|
||||
if (COTIRE_VERBOSE OR _scanResult OR NOT _selectedHeaders)
|
||||
list (LENGTH _unparsedLines _skippedLineCount)
|
||||
message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesFile}")
|
||||
if (WIN32)
|
||||
file (TO_NATIVE_PATH "${_unparsedLinesFile}" _unparsedLinesLogPath)
|
||||
else()
|
||||
set (_unparsedLinesLogPath "${_unparsedLinesFile}")
|
||||
endif()
|
||||
message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesLogPath}")
|
||||
endif()
|
||||
string (REPLACE ";" "\n" _unparsedLines "${_unparsedLines}")
|
||||
endif()
|
||||
file (WRITE "${_unparsedLinesFile}" "${_unparsedLines}")
|
||||
file (WRITE "${_unparsedLinesFile}" "${_unparsedLines}\n")
|
||||
endfunction()
|
||||
|
||||
function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flagsVar)
|
||||
@@ -1507,7 +1541,7 @@ function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flags
|
||||
# append to list
|
||||
list (APPEND _flags -H -E)
|
||||
if (NOT "${_compilerVersion}" VERSION_LESS "4.3.0")
|
||||
list (APPEND _flags "-fdirectives-only")
|
||||
list (APPEND _flags -fdirectives-only)
|
||||
endif()
|
||||
else()
|
||||
# return as a flag string
|
||||
@@ -1517,16 +1551,36 @@ function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flags
|
||||
endif()
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Clang")
|
||||
# Clang options used
|
||||
# -H print the name of each header file used
|
||||
# -E invoke preprocessor
|
||||
# -fno-color-diagnostics don't prints diagnostics in color
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags -H -E -fno-color-diagnostics)
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-H -E -fno-color-diagnostics")
|
||||
if (UNIX)
|
||||
# Clang options used
|
||||
# -H print the name of each header file used
|
||||
# -E invoke preprocessor
|
||||
# -fno-color-diagnostics do not print diagnostics in color
|
||||
# -Eonly just run preprocessor, no output
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags -H -E -fno-color-diagnostics -Xclang -Eonly)
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-H -E -fno-color-diagnostics -Xclang -Eonly")
|
||||
endif()
|
||||
elseif (WIN32)
|
||||
# Clang-cl.exe options used
|
||||
# /TC treat all files named on the command line as C source files
|
||||
# /TP treat all files named on the command line as C++ source files
|
||||
# /EP preprocess to stdout without #line directives
|
||||
# -H print the name of each header file used
|
||||
# -fno-color-diagnostics do not print diagnostics in color
|
||||
# -Eonly just run preprocessor, no output
|
||||
set (_sourceFileTypeC "/TC")
|
||||
set (_sourceFileTypeCXX "/TP")
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags "${_sourceFileType${_language}}" /EP -fno-color-diagnostics -Xclang -H -Xclang -Eonly)
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "${_sourceFileType${_language}} /EP -fno-color-diagnostics -Xclang -H -Xclang -Eonly")
|
||||
endif()
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Intel")
|
||||
if (WIN32)
|
||||
@@ -1600,8 +1654,8 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
|
||||
set (_flags "${_flags} /Zm${COTIRE_PCH_MEMORY_SCALING_FACTOR}")
|
||||
endif()
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "GNU|Clang")
|
||||
# GCC / Clang options used
|
||||
elseif (_compilerID MATCHES "GNU")
|
||||
# GCC options used
|
||||
# -x specify the source language
|
||||
# -c compile but do not link
|
||||
# -o place output in file
|
||||
@@ -1611,11 +1665,55 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
|
||||
set (_xLanguage_CXX "c++-header")
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags "-x" "${_xLanguage_${_language}}" "-c" "${_prefixFile}" -o "${_pchFile}")
|
||||
list (APPEND _flags -x "${_xLanguage_${_language}}" -c "${_prefixFile}" -o "${_pchFile}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-x ${_xLanguage_${_language}} -c \"${_prefixFile}\" -o \"${_pchFile}\"")
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Clang")
|
||||
if (UNIX)
|
||||
# Clang options used
|
||||
# -x specify the source language
|
||||
# -c compile but do not link
|
||||
# -o place output in file
|
||||
# -fno-pch-timestamp disable inclusion of timestamp in precompiled headers (clang 4.0.0+)
|
||||
set (_xLanguage_C "c-header")
|
||||
set (_xLanguage_CXX "c++-header")
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags -x "${_xLanguage_${_language}}" -c "${_prefixFile}" -o "${_pchFile}")
|
||||
if (NOT "${_compilerVersion}" VERSION_LESS "4.0.0")
|
||||
list (APPEND _flags -Xclang -fno-pch-timestamp)
|
||||
endif()
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-x ${_xLanguage_${_language}} -c \"${_prefixFile}\" -o \"${_pchFile}\"")
|
||||
if (NOT "${_compilerVersion}" VERSION_LESS "4.0.0")
|
||||
set (_flags "${_flags} -Xclang -fno-pch-timestamp")
|
||||
endif()
|
||||
endif()
|
||||
elseif (WIN32)
|
||||
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
|
||||
file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative)
|
||||
file (TO_NATIVE_PATH "${_hostFile}" _hostFileNative)
|
||||
# Clang-cl.exe options used
|
||||
# /Yc creates a precompiled header file
|
||||
# /Fp specifies precompiled header binary file name
|
||||
# /FI forces inclusion of file
|
||||
# /Zs syntax check only
|
||||
# /TC treat all files named on the command line as C source files
|
||||
# /TP treat all files named on the command line as C++ source files
|
||||
set (_sourceFileTypeC "/TC")
|
||||
set (_sourceFileTypeCXX "/TP")
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags "${_sourceFileType${_language}}"
|
||||
"/Yc${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}" /Zs "${_hostFileNative}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "/Yc\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"")
|
||||
endif()
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Intel")
|
||||
if (WIN32)
|
||||
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
|
||||
@@ -1657,20 +1755,28 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
|
||||
get_filename_component(_pchName "${_pchFile}" NAME)
|
||||
set (_xLanguage_C "c-header")
|
||||
set (_xLanguage_CXX "c++-header")
|
||||
set (_pchSuppressMessages FALSE)
|
||||
if ("${CMAKE_${_language}_FLAGS}" MATCHES ".*-Wno-pch-messages.*")
|
||||
set(_pchSuppressMessages TRUE)
|
||||
endif()
|
||||
if (_flags)
|
||||
# append to list
|
||||
if ("${_language}" STREQUAL "CXX")
|
||||
list (APPEND _flags -Kc++)
|
||||
endif()
|
||||
list (APPEND _flags "-include" "${_prefixFile}" "-pch-dir" "${_pchDir}" "-pch-create" "${_pchName}" "-fsyntax-only" "${_hostFile}")
|
||||
list (APPEND _flags -include "${_prefixFile}" -pch-dir "${_pchDir}" -pch-create "${_pchName}" -fsyntax-only "${_hostFile}")
|
||||
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
|
||||
list (APPEND _flags "-Wpch-messages")
|
||||
if (NOT _pchSuppressMessages)
|
||||
list (APPEND _flags -Wpch-messages)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-create \"${_pchName}\"")
|
||||
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
|
||||
set (_flags "${_flags} -Wpch-messages")
|
||||
if (NOT _pchSuppressMessages)
|
||||
set (_flags "${_flags} -Wpch-messages")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -1721,23 +1827,48 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV
|
||||
# note: ccache requires the -include flag to be used in order to process precompiled header correctly
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags "-Winvalid-pch" "-include" "${_prefixFile}")
|
||||
list (APPEND _flags -Winvalid-pch -include "${_prefixFile}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-Winvalid-pch -include \"${_prefixFile}\"")
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Clang")
|
||||
# Clang options used
|
||||
# -include process include file as the first line of the primary source file
|
||||
# -include-pch include precompiled header file
|
||||
# -Qunused-arguments don't emit warning for unused driver arguments
|
||||
# note: ccache requires the -include flag to be used in order to process precompiled header correctly
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags "-Qunused-arguments" "-include" "${_prefixFile}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-Qunused-arguments -include \"${_prefixFile}\"")
|
||||
if (UNIX)
|
||||
# Clang options used
|
||||
# -include process include file as the first line of the primary source file
|
||||
# note: ccache requires the -include flag to be used in order to process precompiled header correctly
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags -include "${_prefixFile}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-include \"${_prefixFile}\"")
|
||||
endif()
|
||||
elseif (WIN32)
|
||||
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
|
||||
# Clang-cl.exe options used
|
||||
# /Yu uses a precompiled header file during build
|
||||
# /Fp specifies precompiled header binary file name
|
||||
# /FI forces inclusion of file
|
||||
if (_pchFile)
|
||||
file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative)
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags "/Yu${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "/Yu\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"")
|
||||
endif()
|
||||
else()
|
||||
# no precompiled header, force inclusion of prefix header
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags "/FI${_prefixFileNative}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "/FI\"${_prefixFileNative}\"")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Intel")
|
||||
if (WIN32)
|
||||
@@ -1781,24 +1912,32 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV
|
||||
if (_pchFile)
|
||||
get_filename_component(_pchDir "${_pchFile}" DIRECTORY)
|
||||
get_filename_component(_pchName "${_pchFile}" NAME)
|
||||
set (_pchSuppressMessages FALSE)
|
||||
if ("${CMAKE_${_language}_FLAGS}" MATCHES ".*-Wno-pch-messages.*")
|
||||
set(_pchSuppressMessages TRUE)
|
||||
endif()
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags "-include" "${_prefixFile}" "-pch-dir" "${_pchDir}" "-pch-use" "${_pchName}")
|
||||
list (APPEND _flags -include "${_prefixFile}" -pch-dir "${_pchDir}" -pch-use "${_pchName}")
|
||||
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
|
||||
list (APPEND _flags "-Wpch-messages")
|
||||
if (NOT _pchSuppressMessages)
|
||||
list (APPEND _flags -Wpch-messages)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-use \"${_pchName}\"")
|
||||
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
|
||||
set (_flags "${_flags} -Wpch-messages")
|
||||
if (NOT _pchSuppressMessages)
|
||||
set (_flags "${_flags} -Wpch-messages")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# no precompiled header, force inclusion of prefix header
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags "-include" "${_prefixFile}")
|
||||
list (APPEND _flags -include "${_prefixFile}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-include \"${_prefixFile}\"")
|
||||
@@ -1836,9 +1975,17 @@ function (cotire_precompile_prefix_header _prefixFile _pchFile _hostFile)
|
||||
if (COTIRE_VERBOSE)
|
||||
message (STATUS "execute_process: ${_cmd}")
|
||||
endif()
|
||||
if (_option_COMPILER_ID MATCHES "MSVC")
|
||||
if (MSVC_IDE OR _option_COMPILER_ID MATCHES "MSVC")
|
||||
# cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared
|
||||
unset (ENV{VS_UNICODE_OUTPUT})
|
||||
elseif (_option_COMPILER_ID MATCHES "Clang" AND _option_COMPILER_VERSION VERSION_LESS "4.0.0")
|
||||
if (_option_COMPILER_LAUNCHER MATCHES "ccache" OR
|
||||
_option_COMPILER_EXECUTABLE MATCHES "ccache")
|
||||
# Newer versions of Clang embed a compilation timestamp into the precompiled header binary,
|
||||
# which results in "file has been modified since the precompiled header was built" errors if ccache is used.
|
||||
# We work around the problem by disabling ccache upon pre-compiling the prefix header.
|
||||
set (ENV{CCACHE_DISABLE} "true")
|
||||
endif()
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${_cmd}
|
||||
@@ -1853,7 +2000,7 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
|
||||
set (_unsupportedCompiler
|
||||
"Precompiled headers not supported for ${_language} compiler ${CMAKE_${_language}_COMPILER_ID}")
|
||||
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC")
|
||||
# supported since Visual Studio C++ 6.0
|
||||
# PCH supported since Visual Studio C++ 6.0
|
||||
# and CMake does not support an earlier version
|
||||
set (${_msgVar} "" PARENT_SCOPE)
|
||||
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "GNU")
|
||||
@@ -1864,8 +2011,16 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
|
||||
set (${_msgVar} "" PARENT_SCOPE)
|
||||
endif()
|
||||
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Clang")
|
||||
# all Clang versions have PCH support
|
||||
set (${_msgVar} "" PARENT_SCOPE)
|
||||
if (UNIX)
|
||||
# all Unix Clang versions have PCH support
|
||||
set (${_msgVar} "" PARENT_SCOPE)
|
||||
elseif (WIN32)
|
||||
# only clang-cl is supported under Windows
|
||||
get_filename_component(_compilerName "${CMAKE_${_language}_COMPILER}" NAME_WE)
|
||||
if (NOT _compilerName MATCHES "cl$")
|
||||
set (${_msgVar} "${_unsupportedCompiler} version ${CMAKE_${_language}_COMPILER_VERSION}. Use clang-cl instead." PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Intel")
|
||||
# Intel PCH support requires version >= 8.0.0
|
||||
if ("${CMAKE_${_language}_COMPILER_VERSION}" VERSION_LESS "8.0.0")
|
||||
@@ -1876,29 +2031,38 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
|
||||
else()
|
||||
set (${_msgVar} "${_unsupportedCompiler}." PARENT_SCOPE)
|
||||
endif()
|
||||
# check if ccache is used as a compiler launcher
|
||||
get_target_property(_launcher ${_target} ${_language}_COMPILER_LAUNCHER)
|
||||
if (CMAKE_${_language}_COMPILER MATCHES "ccache" OR _launcher MATCHES "ccache")
|
||||
get_filename_component(_realCompilerExe "${CMAKE_${_language}_COMPILER}" REALPATH)
|
||||
if (_realCompilerExe MATCHES "ccache" OR _launcher MATCHES "ccache")
|
||||
# verify that ccache configuration is compatible with precompiled headers
|
||||
# always check environment variable CCACHE_SLOPPINESS, because earlier versions of ccache
|
||||
# do not report the "sloppiness" setting correctly upon printing ccache configuration
|
||||
if (DEFINED ENV{CCACHE_SLOPPINESS})
|
||||
if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "pch_defines" OR NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros")
|
||||
if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "pch_defines" OR
|
||||
NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros")
|
||||
set (${_msgVar}
|
||||
"ccache requires the environment variable CCACHE_SLOPPINESS to be set to \"pch_defines,time_macros\"."
|
||||
PARENT_SCOPE)
|
||||
endif()
|
||||
else()
|
||||
if (_launcher MATCHES "ccache")
|
||||
get_filename_component(_ccacheExe "${_launcher}" REALPATH)
|
||||
if (_realCompilerExe MATCHES "ccache")
|
||||
set (_ccacheExe "${_realCompilerExe}")
|
||||
else()
|
||||
get_filename_component(_ccacheExe "${CMAKE_${_language}_COMPILER}" REALPATH)
|
||||
set (_ccacheExe "${_launcher}")
|
||||
endif()
|
||||
# ccache 3.7.0 replaced --print-config with --show-config
|
||||
# use -p instead, which seems to work for all version for now, sigh
|
||||
execute_process(
|
||||
COMMAND "${_ccacheExe}" "--print-config"
|
||||
COMMAND "${_ccacheExe}" "-p"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
RESULT_VARIABLE _result
|
||||
OUTPUT_VARIABLE _ccacheConfig OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET)
|
||||
if (_result OR NOT
|
||||
_ccacheConfig MATCHES "sloppiness.*=.*time_macros" OR NOT
|
||||
_ccacheConfig MATCHES "sloppiness.*=.*pch_defines")
|
||||
if (_result)
|
||||
set (${_msgVar} "ccache configuration cannot be determined." PARENT_SCOPE)
|
||||
elseif (NOT _ccacheConfig MATCHES "sloppiness.*=.*time_macros" OR
|
||||
NOT _ccacheConfig MATCHES "sloppiness.*=.*pch_defines")
|
||||
set (${_msgVar}
|
||||
"ccache requires configuration setting \"sloppiness\" to be set to \"pch_defines,time_macros\"."
|
||||
PARENT_SCOPE)
|
||||
@@ -2191,7 +2355,7 @@ function (cotire_generate_target_script _language _configurations _target _targe
|
||||
XCODE MSVC CMAKE_GENERATOR CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES
|
||||
CMAKE_${_language}_COMPILER_ID CMAKE_${_language}_COMPILER_VERSION
|
||||
CMAKE_${_language}_COMPILER_LAUNCHER CMAKE_${_language}_COMPILER CMAKE_${_language}_COMPILER_ARG1
|
||||
CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_${_language}_SEP
|
||||
CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_SEP_${_language}
|
||||
CMAKE_INCLUDE_SYSTEM_FLAG_${_language}
|
||||
CMAKE_${_language}_FRAMEWORK_SEARCH_FLAG
|
||||
CMAKE_${_language}_SYSTEM_FRAMEWORK_SEARCH_FLAG
|
||||
@@ -2224,8 +2388,9 @@ endfunction()
|
||||
|
||||
function (cotire_setup_pch_file_compilation _language _target _targetScript _prefixFile _pchFile _hostFile)
|
||||
set (_sourceFiles ${ARGN})
|
||||
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
# for Visual Studio and Intel, we attach the precompiled header compilation to the host file
|
||||
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" OR
|
||||
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
|
||||
# for MSVC, Intel and Clang-cl, we attach the precompiled header compilation to the host file
|
||||
# the remaining files include the precompiled header, see cotire_setup_pch_file_inclusion
|
||||
if (_sourceFiles)
|
||||
set (_flags "")
|
||||
@@ -2233,6 +2398,9 @@ function (cotire_setup_pch_file_compilation _language _target _targetScript _pre
|
||||
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
|
||||
"${_prefixFile}" "${_pchFile}" "${_hostFile}" _flags)
|
||||
set_property (SOURCE ${_hostFile} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
|
||||
if (COTIRE_DEBUG)
|
||||
message (STATUS "set_property: SOURCE ${_hostFile} APPEND_STRING COMPILE_FLAGS ${_flags}")
|
||||
endif()
|
||||
set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_OUTPUTS "${_pchFile}")
|
||||
# make object file generated from host file depend on prefix header
|
||||
set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_DEPENDS "${_prefixFile}")
|
||||
@@ -2270,8 +2438,9 @@ function (cotire_setup_pch_file_compilation _language _target _targetScript _pre
|
||||
endfunction()
|
||||
|
||||
function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefixFile _pchFile _hostFile)
|
||||
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
# for Visual Studio and Intel, we include the precompiled header in all but the host file
|
||||
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" OR
|
||||
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
|
||||
# for MSVC, Intel and clang-cl, we include the precompiled header in all but the host file
|
||||
# the host file does the precompiled header compilation, see cotire_setup_pch_file_compilation
|
||||
set (_sourceFiles ${ARGN})
|
||||
list (LENGTH _sourceFiles _numberOfSourceFiles)
|
||||
@@ -2283,6 +2452,9 @@ function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefix
|
||||
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
|
||||
"${_prefixFile}" "${_pchFile}" _flags)
|
||||
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
|
||||
if (COTIRE_DEBUG)
|
||||
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
|
||||
endif()
|
||||
# make object files generated from source files depend on precompiled header
|
||||
set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_pchFile}")
|
||||
endif()
|
||||
@@ -2296,6 +2468,9 @@ function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefix
|
||||
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
|
||||
"${_prefixFile}" "${_pchFile}" _flags)
|
||||
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
|
||||
if (COTIRE_DEBUG)
|
||||
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
|
||||
endif()
|
||||
# mark sources as cotired to prevent them from being used in another cotired target
|
||||
set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}")
|
||||
endif()
|
||||
@@ -2313,6 +2488,9 @@ function (cotire_setup_prefix_file_inclusion _language _target _prefixFile)
|
||||
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
|
||||
"${_prefixFile}" "${_pchFile}" _flags)
|
||||
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
|
||||
if (COTIRE_DEBUG)
|
||||
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
|
||||
endif()
|
||||
# mark sources as cotired to prevent them from being used in another cotired target
|
||||
set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}")
|
||||
# make object files generated from source files depend on prefix header
|
||||
@@ -2402,7 +2580,7 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
|
||||
message (STATUS "add_custom_command: TARGET ${_target} PRE_BUILD ${_cmds}")
|
||||
endif()
|
||||
# because CMake PRE_BUILD command does not support dependencies,
|
||||
# we check dependencies explicitly in cotire script mode when the pre-build action is run
|
||||
# we check dependencies explicity in cotire script mode when the pre-build action is run
|
||||
add_custom_command(
|
||||
TARGET "${_target}"
|
||||
PRE_BUILD ${_cmds}
|
||||
@@ -2417,9 +2595,10 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
|
||||
# if this is a single-language target without any excluded files
|
||||
if (_wholeTarget)
|
||||
set (_language "${_languages}")
|
||||
# for Visual Studio and Intel, precompiled header inclusion is always done on the source file level
|
||||
# for MSVC, Intel and clang-cl, precompiled header inclusion is always done on the source file level
|
||||
# see cotire_setup_pch_file_inclusion
|
||||
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" AND NOT
|
||||
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
|
||||
get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER)
|
||||
if (_prefixFile)
|
||||
get_property(_pchFile TARGET ${_target} PROPERTY COTIRE_${_language}_PRECOMPILED_HEADER)
|
||||
@@ -2428,6 +2607,9 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
|
||||
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
|
||||
"${_prefixFile}" "${_pchFile}" _options)
|
||||
set_property(TARGET ${_target} APPEND PROPERTY ${_options})
|
||||
if (COTIRE_DEBUG)
|
||||
message (STATUS "set_property: TARGET ${_target} APPEND PROPERTY ${_options}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -2454,7 +2636,8 @@ function (cotire_setup_unity_generation_commands _language _target _targetScript
|
||||
set_property (SOURCE "${_unityFile}" PROPERTY OBJECT_DEPENDS ${_objectDependsPaths})
|
||||
endif()
|
||||
if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
# unity file compilation results in potentially huge object file, thus use /bigobj by default unter MSVC and Windows Intel
|
||||
# unity file compilation results in potentially huge object file,
|
||||
# thus use /bigobj by default unter cl.exe and Windows Intel
|
||||
set_property (SOURCE "${_unityFile}" APPEND_STRING PROPERTY COMPILE_FLAGS "/bigobj")
|
||||
endif()
|
||||
cotire_set_cmd_to_prologue(_unityCmd)
|
||||
@@ -2660,6 +2843,9 @@ function (cotire_make_target_message _target _languages _disableMsg _targetMsgVa
|
||||
else()
|
||||
set (_targetMsg "${_languagesStr} target ${_target} cotired without unity build.")
|
||||
endif()
|
||||
if (_disableMsg)
|
||||
set (_targetMsg "${_targetMsg} ${_disableMsg}")
|
||||
endif()
|
||||
else()
|
||||
if (_excludedStr)
|
||||
set (_targetMsg "${_languagesStr} target ${_target} cotired ${_excludedStr}.")
|
||||
@@ -2749,6 +2935,20 @@ function (cotire_choose_target_languages _target _targetLanguagesVar _wholeTarge
|
||||
set (_targetUsePCH FALSE)
|
||||
endif()
|
||||
endif()
|
||||
if (_targetAddSCU)
|
||||
# disable unity builds if automatic Qt processing is used
|
||||
get_target_property(_targetAutoMoc ${_target} AUTOMOC)
|
||||
get_target_property(_targetAutoUic ${_target} AUTOUIC)
|
||||
get_target_property(_targetAutoRcc ${_target} AUTORCC)
|
||||
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
|
||||
if (_disableMsg)
|
||||
set (_disableMsg "${_disableMsg} Target uses automatic CMake Qt processing.")
|
||||
else()
|
||||
set (_disableMsg "Target uses automatic CMake Qt processing.")
|
||||
endif()
|
||||
set (_targetAddSCU FALSE)
|
||||
endif()
|
||||
endif()
|
||||
set_property(TARGET ${_target} PROPERTY COTIRE_ENABLE_PRECOMPILED_HEADER ${_targetUsePCH})
|
||||
set_property(TARGET ${_target} PROPERTY COTIRE_ADD_UNITY_BUILD ${_targetAddSCU})
|
||||
cotire_make_target_message(${_target} "${_targetLanguages}" "${_disableMsg}" _targetMsg ${_allExcludedSourceFiles})
|
||||
@@ -2776,7 +2976,11 @@ function (cotire_compute_unity_max_number_of_includes _target _maxIncludesVar)
|
||||
set (_sourceFiles ${ARGN})
|
||||
get_target_property(_maxIncludes ${_target} COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES)
|
||||
if (_maxIncludes MATCHES "(-j|--parallel|--jobs) ?([0-9]*)")
|
||||
set (_numberOfThreads "${CMAKE_MATCH_2}")
|
||||
if (DEFINED CMAKE_MATCH_2)
|
||||
set (_numberOfThreads "${CMAKE_MATCH_2}")
|
||||
else()
|
||||
set (_numberOfThreads "")
|
||||
endif()
|
||||
if (NOT _numberOfThreads)
|
||||
# use all available cores
|
||||
ProcessorCount(_numberOfThreads)
|
||||
@@ -2889,8 +3093,9 @@ function (cotire_setup_pch_target _languages _configurations _target)
|
||||
set (_dependsFiles "")
|
||||
foreach (_language ${_languages})
|
||||
set (_props COTIRE_${_language}_PREFIX_HEADER COTIRE_${_language}_UNITY_SOURCE)
|
||||
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
# Visual Studio and Intel only create precompiled header as a side effect
|
||||
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" AND NOT
|
||||
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
|
||||
# MSVC, Intel and clang-cl only create precompiled header as a side effect
|
||||
list (INSERT _props 0 COTIRE_${_language}_PRECOMPILED_HEADER)
|
||||
endif()
|
||||
cotire_get_first_set_property_value(_dependsFile TARGET ${_target} ${_props})
|
||||
@@ -2938,6 +3143,7 @@ function (cotire_collect_unity_target_sources _target _languages _unityTargetSou
|
||||
list (APPEND _unityTargetSources ${_unityFiles})
|
||||
endif()
|
||||
endforeach()
|
||||
# handle object libraries which are part of the target's sources
|
||||
get_target_property(_linkLibrariesStrategy ${_target} COTIRE_UNITY_LINK_LIBRARIES_INIT)
|
||||
if ("${_linkLibrariesStrategy}" MATCHES "^COPY_UNITY$")
|
||||
cotire_filter_object_libraries(${_target} _objectLibraries ${_targetSourceFiles})
|
||||
@@ -2982,21 +3188,6 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
# determine unity target sources
|
||||
set (_unityTargetSources "")
|
||||
cotire_collect_unity_target_sources(${_target} "${_languages}" _unityTargetSources)
|
||||
# handle automatic Qt processing
|
||||
get_target_property(_targetAutoMoc ${_target} AUTOMOC)
|
||||
get_target_property(_targetAutoUic ${_target} AUTOUIC)
|
||||
get_target_property(_targetAutoRcc ${_target} AUTORCC)
|
||||
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
|
||||
# if the original target sources are subject to CMake's automatic Qt processing,
|
||||
# also include implicitly generated <targetname>_automoc.cpp file
|
||||
if (CMAKE_VERSION VERSION_LESS "3.8.0")
|
||||
list (APPEND _unityTargetSources "${_target}_automoc.cpp")
|
||||
set_property (SOURCE "${_target}_automoc.cpp" PROPERTY GENERATED TRUE)
|
||||
else()
|
||||
list (APPEND _unityTargetSources "${_target}_autogen/moc_compilation.cpp")
|
||||
set_property (SOURCE "${_target}_autogen/moc_compilation.cpp" PROPERTY GENERATED TRUE)
|
||||
endif()
|
||||
endif()
|
||||
# prevent AUTOMOC, AUTOUIC and AUTORCC properties from being set when the unity target is created
|
||||
set (CMAKE_AUTOMOC OFF)
|
||||
set (CMAKE_AUTOUIC OFF)
|
||||
@@ -3010,21 +3201,6 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
else()
|
||||
add_library(${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources})
|
||||
endif()
|
||||
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
||||
# depend on original target's automoc target, if it exists
|
||||
if (TARGET ${_target}_automoc)
|
||||
add_dependencies(${_unityTargetName} ${_target}_automoc)
|
||||
endif()
|
||||
else()
|
||||
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
|
||||
# depend on the original target's implicitly generated <targetname>_automoc target
|
||||
if (CMAKE_VERSION VERSION_LESS "3.8.0")
|
||||
add_dependencies(${_unityTargetName} ${_target}_automoc)
|
||||
else()
|
||||
add_dependencies(${_unityTargetName} ${_target}_autogen)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
# copy output location properties
|
||||
set (_outputDirProperties
|
||||
ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_DIRECTORY_<CONFIG>
|
||||
@@ -3036,8 +3212,8 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
set (_outputDir "${COTIRE_UNITY_OUTPUT_DIRECTORY}")
|
||||
else()
|
||||
# append relative COTIRE_UNITY_OUTPUT_DIRECTORY to target's actual output directory
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties})
|
||||
cotire_resolve_config_properites("${_configurations}" _properties ${_outputDirProperties})
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties})
|
||||
cotire_resolve_config_properties("${_configurations}" _properties ${_outputDirProperties})
|
||||
foreach (_property ${_properties})
|
||||
get_property(_outputDir TARGET ${_target} PROPERTY ${_property})
|
||||
if (_outputDir)
|
||||
@@ -3057,11 +3233,11 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
RUNTIME_OUTPUT_DIRECTORY "${_outputDir}")
|
||||
endif()
|
||||
else()
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
${_outputDirProperties})
|
||||
endif()
|
||||
# copy output name
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
ARCHIVE_OUTPUT_NAME ARCHIVE_OUTPUT_NAME_<CONFIG>
|
||||
LIBRARY_OUTPUT_NAME LIBRARY_OUTPUT_NAME_<CONFIG>
|
||||
OUTPUT_NAME OUTPUT_NAME_<CONFIG>
|
||||
@@ -3069,7 +3245,7 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
PREFIX <CONFIG>_POSTFIX SUFFIX
|
||||
IMPORT_PREFIX IMPORT_SUFFIX)
|
||||
# copy compile stuff
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
COMPILE_DEFINITIONS COMPILE_DEFINITIONS_<CONFIG>
|
||||
COMPILE_FLAGS COMPILE_OPTIONS
|
||||
Fortran_FORMAT Fortran_MODULE_DIRECTORY
|
||||
@@ -3081,12 +3257,12 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
C_VISIBILITY_PRESET CXX_VISIBILITY_PRESET VISIBILITY_INLINES_HIDDEN
|
||||
C_CLANG_TIDY CXX_CLANG_TIDY)
|
||||
# copy compile features
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED
|
||||
CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED
|
||||
COMPILE_FEATURES)
|
||||
# copy interface stuff
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN
|
||||
COMPATIBLE_INTERFACE_STRING
|
||||
INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS
|
||||
@@ -3094,8 +3270,9 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
|
||||
INTERFACE_AUTOUIC_OPTIONS NO_SYSTEM_FROM_IMPORTED)
|
||||
# copy link stuff
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
BUILD_WITH_INSTALL_RPATH INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
BUILD_WITH_INSTALL_RPATH BUILD_WITH_INSTALL_NAME_DIR
|
||||
INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH
|
||||
LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED
|
||||
LINK_FLAGS LINK_FLAGS_<CONFIG>
|
||||
LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_<CONFIG>
|
||||
@@ -3103,18 +3280,18 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
LINK_SEARCH_START_STATIC LINK_SEARCH_END_STATIC
|
||||
STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS_<CONFIG>
|
||||
NO_SONAME SOVERSION VERSION
|
||||
LINK_WHAT_YOU_USE)
|
||||
LINK_WHAT_YOU_USE BUILD_RPATH)
|
||||
# copy cmake stuff
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
IMPLICIT_DEPENDS_INCLUDE_TRANSFORM RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK)
|
||||
# copy Apple platform specific stuff
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
BUNDLE BUNDLE_EXTENSION FRAMEWORK FRAMEWORK_VERSION INSTALL_NAME_DIR
|
||||
MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_RPATH
|
||||
OSX_ARCHITECTURES OSX_ARCHITECTURES_<CONFIG> PRIVATE_HEADER PUBLIC_HEADER RESOURCE XCTEST
|
||||
IOS_INSTALL_COMBINED)
|
||||
IOS_INSTALL_COMBINED XCODE_EXPLICIT_FILE_TYPE XCODE_PRODUCT_TYPE)
|
||||
# copy Windows platform specific stuff
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
GNUtoMS
|
||||
COMPILE_PDB_NAME COMPILE_PDB_NAME_<CONFIG>
|
||||
COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>
|
||||
@@ -3128,15 +3305,19 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES
|
||||
WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS
|
||||
DEPLOYMENT_REMOTE_DIRECTORY VS_CONFIGURATION_TYPE
|
||||
VS_SDK_REFERENCES)
|
||||
VS_SDK_REFERENCES VS_USER_PROPS VS_DEBUGGER_WORKING_DIRECTORY)
|
||||
# copy Android platform specific stuff
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
ANDROID_API ANDROID_API_MIN ANDROID_GUI
|
||||
ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES
|
||||
ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR
|
||||
ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES
|
||||
ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH
|
||||
ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE)
|
||||
# copy CUDA platform specific stuff
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
CUDA_PTX_COMPILATION CUDA_SEPARABLE_COMPILATION CUDA_RESOLVE_DEVICE_SYMBOLS
|
||||
CUDA_EXTENSIONS CUDA_STANDARD CUDA_STANDARD_REQUIRED)
|
||||
# use output name from original target
|
||||
get_target_property(_targetOutputName ${_unityTargetName} OUTPUT_NAME)
|
||||
if (NOT _targetOutputName)
|
||||
@@ -3150,6 +3331,13 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
set_property(TARGET ${_unityTargetName} PROPERTY ENABLE_EXPORTS TRUE)
|
||||
endif()
|
||||
endif()
|
||||
# enable parallel compilation for MSVC
|
||||
if (MSVC AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
||||
list (LENGTH _unityTargetSources _numberOfUnityTargetSources)
|
||||
if (_numberOfUnityTargetSources GREATER 1)
|
||||
set_property(TARGET ${_unityTargetName} APPEND PROPERTY COMPILE_OPTIONS "/MP")
|
||||
endif()
|
||||
endif()
|
||||
cotire_init_target(${_unityTargetName})
|
||||
cotire_add_to_unity_all_target(${_unityTargetName})
|
||||
set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_TARGET_NAME "${_unityTargetName}")
|
||||
@@ -3308,6 +3496,13 @@ function (cotire_target_link_libraries _target)
|
||||
message (STATUS "unity target ${_unityTargetName} interface link libraries: ${_unityLinkInterfaceLibraries}")
|
||||
endif()
|
||||
endif()
|
||||
get_target_property(_manualDependencies ${_target} MANUALLY_ADDED_DEPENDENCIES)
|
||||
if (_manualDependencies)
|
||||
cotire_map_libraries("${_linkLibrariesStrategy}" _unityManualDependencies ${_manualDependencies})
|
||||
if (_unityManualDependencies)
|
||||
add_dependencies("${_unityTargetName}" ${_unityManualDependencies})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction(cotire_target_link_libraries)
|
||||
@@ -3340,9 +3535,9 @@ function (cotire_init_target _targetName)
|
||||
set_target_properties(${_targetName} PROPERTIES FOLDER "${COTIRE_TARGETS_FOLDER}")
|
||||
endif()
|
||||
set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
if (MSVC_IDE)
|
||||
set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
|
||||
endif()
|
||||
# if (MSVC_IDE)
|
||||
# set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
|
||||
# endif()
|
||||
endfunction()
|
||||
|
||||
function (cotire_add_to_pch_all_target _pchTargetName)
|
||||
@@ -3604,7 +3799,7 @@ else()
|
||||
set (COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS "m;mm" CACHE STRING
|
||||
"Ignore sources with the listed file extensions from the generated unity source.")
|
||||
|
||||
set (COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES "3" CACHE STRING
|
||||
set (COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES "2" CACHE STRING
|
||||
"Minimum number of sources in target required to enable use of precompiled header.")
|
||||
|
||||
if (NOT DEFINED COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES_INIT)
|
||||
@@ -3703,7 +3898,7 @@ else()
|
||||
FULL_DOCS
|
||||
"The variable can be set to an integer > 0."
|
||||
"If a target contains less than that number of source files, cotire will not enable the use of the precompiled header for the target."
|
||||
"If not defined, defaults to 3."
|
||||
"If not defined, defaults to 2."
|
||||
)
|
||||
|
||||
define_property(
|
||||
|
@@ -3,10 +3,6 @@
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
if (NOT DEFINED INSTALL_DRACO)
|
||||
set (INSTALL_DRACO OFF CACHE BOOL "${INSTALL_DRACO_DESCR}")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_DIR)
|
||||
set (3RDPARTY_DRACO_DIR "" CACHE PATH "The directory containing Draco")
|
||||
endif()
|
||||
@@ -15,14 +11,24 @@ if (NOT DEFINED 3RDPARTY_DRACO_INCLUDE_DIR)
|
||||
set (3RDPARTY_DRACO_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the Draco")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY OR NOT 3RDPARTY_DRACO_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
|
||||
set (3RDPARTY_DRACO_LIBRARY "" CACHE FILEPATH "Draco library" FORCE)
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY)
|
||||
set (3RDPARTY_DRACO_LIBRARY "" CACHE FILEPATH "Draco library")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DIR)
|
||||
set (3RDPARTY_DRACO_LIBRARY_DIR "" CACHE PATH "The directory containing Draco library")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DEBUG)
|
||||
set (3RDPARTY_DRACO_LIBRARY_DEBUG "" CACHE FILEPATH "Draco debug library")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DIR_DEBUG)
|
||||
set (3RDPARTY_DRACO_LIBRARY_DIR_DEBUG "" CACHE PATH "The directory containing Draco debug library")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
|
||||
if (NOT 3RDPARTY_DRACO_DIR OR NOT EXISTS "${3RDPARTY_DRACO_DIR}")
|
||||
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" draco DRACO_DIR_NAME)
|
||||
@@ -32,20 +38,19 @@ if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
|
||||
set (DRACO_INCLUDE_PATH "${3RDPARTY_DRACO_DIR}/include")
|
||||
set (DRACO_LIBRARY_PATH "${3RDPARTY_DRACO_DIR}/lib")
|
||||
endif()
|
||||
# header
|
||||
if (NOT 3RDPARTY_DRACO_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_DRACO_INCLUDE_DIR}")
|
||||
set (HEADER_NAMES draco)
|
||||
|
||||
if (NOT 3RDPARTY_DRACO_INCLUDE_DIR)
|
||||
if (DRACO_INCLUDE_PATH AND EXISTS "${DRACO_INCLUDE_PATH}")
|
||||
set (3RDPARTY_DRACO_INCLUDE_DIR "${DRACO_INCLUDE_PATH}" CACHE FILEPATH "The directory containing headers of DRACO" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
# set 3RDPARTY_DRACO_INCLUDE_DIR as notfound, otherwise find_path can't assign a new value to 3RDPARTY_DRACO_INCLUDE_DIR
|
||||
set (3RDPARTY_DRACO_INCLUDE_DIR "3RDPARTY_DRACO_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "The directory containing headers of the Draco" FORCE)
|
||||
|
||||
if (NOT 3RDPARTY_DRACO_LIBRARY_DIR)
|
||||
if (DRACO_LIBRARY_PATH AND EXISTS "${DRACO_LIBRARY_PATH}")
|
||||
set (3RDPARTY_DRACO_LIBRARY_DIR "${DRACO_LIBRARY_PATH}" CACHE FILEPATH "The directory containing DRACO library" FORCE)
|
||||
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
|
||||
find_path (3RDPARTY_DRACO_INCLUDE_DIR NAMES ${HEADER_NAMES}
|
||||
PATHS ${3RDPARTY_DRACO_DIR}
|
||||
PATH_SUFFIXES "include"
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -57,11 +62,11 @@ endif()
|
||||
|
||||
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
|
||||
if (NOT 3RDPARTY_DRACO_LIBRARY OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY}")
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .a)
|
||||
set (3RDPARTY_DRACO_LIBRARY "3RDPARTY_DRACO_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to Draco library" FORCE)
|
||||
|
||||
find_library (3RDPARTY_DRACO_LIBRARY NAMES ${CSF_Draco}
|
||||
PATHS "${3RDPARTY_DRACO_LIBRARY_DIR}"
|
||||
PATHS "${3RDPARTY_DRACO_DIR}"
|
||||
PATH_SUFFIXES lib
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
@@ -70,27 +75,19 @@ if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
|
||||
set (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY_DIR}" CACHE FILEPATH "The directory containing Draco library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_DRACO_LIBRARY_DIR AND EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_DRACO_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_DRACO_LIBRARY_DIR)
|
||||
endif()
|
||||
if (WIN32 AND (NOT 3RDPARTY_DRACO_LIBRARY_DEBUG OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY_DEBUG}"))
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .a)
|
||||
set (3RDPARTY_DRACO_LIBRARY_DEBUG "3RDPARTY_DRACO_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "The path to debug Draco library" FORCE)
|
||||
|
||||
if (INSTALL_DRACO)
|
||||
get_filename_component(3RDPARTY_DRACO_LIBRARY_REALPATH ${3RDPARTY_DRACO_LIBRARY} REALPATH)
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR_LIB}")
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR_LIB}i")
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR_LIB}d")
|
||||
find_library (3RDPARTY_DRACO_LIBRARY_DEBUG NAMES ${CSF_Draco}
|
||||
PATHS "${3RDPARTY_DRACO_DIR}"
|
||||
PATH_SUFFIXES libd
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
if (3RDPARTY_DRACO_LIBRARY_DEBUG AND EXISTS "${3RDPARTY_DRACO_LIBRARY_DEBUG}")
|
||||
get_filename_component (3RDPARTY_DRACO_LIBRARY_DIR_DEBUG "${3RDPARTY_DRACO_LIBRARY_DEBUG}" PATH)
|
||||
set (3RDPARTY_DRACO_LIBRARY_DIR_DEBUG "${3RDPARTY_DRACO_LIBRARY_DIR_DEBUG}" CACHE FILEPATH "The directory containing debug Draco library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -26,9 +26,7 @@ if (3RDPARTY_DIR)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# flex 2.5.37 is required because closest known lower version, 2.5.3 from WOK 6.8.0,
|
||||
# generates code which is unusable on Windows (includes unistd.h without any way to avoid this)
|
||||
find_package (FLEX 2.5.37)
|
||||
find_package (FLEX 2.6.4)
|
||||
|
||||
if (NOT FLEX_FOUND OR NOT FLEX_INCLUDE_DIR OR NOT EXISTS "${FLEX_INCLUDE_DIR}/FlexLexer.h")
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED FLEX_INCLUDE_DIR)
|
||||
|
@@ -110,8 +110,19 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
|
||||
set (ENV{FREETYPE_DIR} "${3RDPARTY_FREETYPE_DIR}")
|
||||
endif()
|
||||
|
||||
unset (FREETYPE_LIBRARY_RELEASE)
|
||||
find_package(Freetype)
|
||||
|
||||
# Only for UNIX (not APPLE)
|
||||
if ((NOT WIN32) AND (NOT APPLE))
|
||||
# To avoid linker error on Ubuntu 18.04 and others linux distributives we should
|
||||
# link with freetype library, compiled as Position Independent Code (PIC),
|
||||
# for example, with shared object.
|
||||
if ((DEFINED FREETYPE_LIBRARY_RELEASE) AND (NOT "${FREETYPE_LIBRARY_RELEASE}" STREQUAL "") AND (EXISTS "${FREETYPE_LIBRARY_RELEASE}"))
|
||||
string (REPLACE "\.a" "\.so" FREETYPE_LIBRARY_RELEASE "${FREETYPE_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# restore ENV{FREETYPE_DIR}
|
||||
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
|
||||
set (ENV{FREETYPE_DIR} ${CACHED_FREETYPE_DIR})
|
||||
@@ -122,7 +133,7 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_ft2build FILEPATH "The directory containing ft2build.h header")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "The directory containing ftheader.h header")
|
||||
if (BUILD_SHARED_LIBS)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY_RELEASE FILEPATH "freetype library")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -141,8 +152,8 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
|
||||
|
||||
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)
|
||||
if (FREETYPE_LIBRARY_RELEASE AND EXISTS "${FREETYPE_LIBRARY_RELEASE}")
|
||||
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY_RELEASE}" CACHE FILEPATH "The path to freetype library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -220,7 +231,7 @@ endif()
|
||||
# freetype library
|
||||
#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 (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
|
||||
|
||||
set (FREETYPE_PATH_SUFFIXES lib)
|
||||
if (ANDROID)
|
||||
@@ -242,6 +253,16 @@ endif()
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
|
||||
# Only for UNIX (not APPLE)
|
||||
if ((NOT WIN32) AND (NOT APPLE))
|
||||
# To avoid linker error on Ubuntu 18.04 and some others linux distributives we should
|
||||
# link with freetype library, compiled as Position Independent Code (PIC),
|
||||
# for example, with shared object.
|
||||
if ((DEFINED 3RDPARTY_FREETYPE_LIBRARY) AND (NOT "${3RDPARTY_FREETYPE_LIBRARY}" STREQUAL "") AND (EXISTS "${3RDPARTY_FREETYPE_LIBRARY}"))
|
||||
string (REPLACE "\.a" "\.so" 3RDPARTY_FREETYPE_LIBRARY "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
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)
|
||||
@@ -350,7 +371,7 @@ endif()
|
||||
# unset all redundant variables
|
||||
OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_ft2build)
|
||||
OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_freetype2)
|
||||
OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY)
|
||||
OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY_RELEASE)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)
|
||||
|
@@ -116,9 +116,9 @@ if (MSVC)
|
||||
else()
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
||||
endif()
|
||||
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]"))
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshorten-64-to-32")
|
||||
endif()
|
||||
if (BUILD_SHARED_LIBS)
|
||||
@@ -130,14 +130,10 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMP
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
if (APPLE)
|
||||
# CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated.
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
|
||||
elseif(NOT WIN32)
|
||||
# CLang for Windows (at least CLang 8.0 distributed with VS 2019)
|
||||
# does not support option "-std=c++0x"
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||
set (CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
# Optimize size of binaries
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,-s ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
@@ -148,14 +144,10 @@ elseif(MINGW)
|
||||
# workaround bugs in mingw with vtable export
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols")
|
||||
|
||||
# Require C++11
|
||||
set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
|
||||
# Optimize size of binaries
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Require C++11
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||
# Optimize size of binaries
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
|
||||
|
@@ -80,9 +80,9 @@ macro (OCCT_MAKE_COMPILER_SHORT_NAME)
|
||||
set (COMPILER gcc)
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (COMPILER gxx)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
set (COMPILER clang)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
|
||||
set (COMPILER icc)
|
||||
else()
|
||||
set (COMPILER ${CMAKE_GENERATOR})
|
||||
@@ -160,6 +160,8 @@ function (FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
|
||||
if ("${lower_PRODUCT_NAME}" STREQUAL "egl")
|
||||
string (SUBSTRING "${lower_PRODUCT_NAME}" 1 -1 lower_PRODUCT_NAME)
|
||||
list (APPEND SEARCH_TEMPLATES "[^gl]+${lower_PRODUCT_NAME}.*")
|
||||
elseif ("${lower_PRODUCT_NAME}" STREQUAL "tbb")
|
||||
list (APPEND SEARCH_TEMPLATES "^.*${lower_PRODUCT_NAME}.*")
|
||||
else()
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*${COMPILER}.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
|
||||
@@ -589,9 +591,7 @@ macro (OCCT_UPDATE_TARGET_FILE)
|
||||
endif()
|
||||
|
||||
install (CODE
|
||||
"cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0007 NEW)
|
||||
string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWERCASE)
|
||||
"string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWERCASE)
|
||||
file (GLOB ALL_OCCT_TARGET_FILES \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADE*Targets-\${CMAKE_INSTALL_CONFIG_NAME_LOWERCASE}.cmake\")
|
||||
foreach(TARGET_FILENAME \${ALL_OCCT_TARGET_FILES})
|
||||
file (STRINGS \"\${TARGET_FILENAME}\" TARGET_FILE_CONTENT)
|
||||
@@ -600,8 +600,7 @@ macro (OCCT_UPDATE_TARGET_FILE)
|
||||
string (REGEX REPLACE \"[\\\\]?[\\\$]{OCCT_INSTALL_BIN_LETTER}\" \"\${OCCT_INSTALL_BIN_LETTER}\" line \"\${line}\")
|
||||
file (APPEND \"\${TARGET_FILENAME}\" \"\${line}\\n\")
|
||||
endforeach()
|
||||
endforeach()
|
||||
cmake_policy(POP)")
|
||||
endforeach()")
|
||||
endmacro()
|
||||
|
||||
macro (OCCT_INSERT_CODE_FOR_TARGET)
|
||||
@@ -615,17 +614,14 @@ macro (OCCT_INSERT_CODE_FOR_TARGET)
|
||||
endmacro()
|
||||
|
||||
macro (OCCT_UPDATE_DRAW_DEFAULT_FILE)
|
||||
install(CODE "cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0007 NEW)
|
||||
set (DRAW_DEFAULT_FILE_NAME \"${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/DrawResources/DrawPlugin\")
|
||||
install(CODE "set (DRAW_DEFAULT_FILE_NAME \"${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/DrawResources/DrawPlugin\")
|
||||
file (STRINGS \"\${DRAW_DEFAULT_FILE_NAME}\" DRAW_DEFAULT_CONTENT)
|
||||
file (REMOVE \"\${DRAW_DEFAULT_FILE_NAME}\")
|
||||
foreach (line IN LISTS DRAW_DEFAULT_CONTENT)
|
||||
string (REGEX MATCH \": TK\([a-zA-Z]+\)$\" IS_TK_LINE \"\${line}\")
|
||||
string (REGEX REPLACE \": TK\([a-zA-Z]+\)$\" \": TK\${CMAKE_MATCH_1}${BUILD_SHARED_LIBRARY_NAME_POSTFIX}\" line \"\${line}\")
|
||||
file (APPEND \"\${DRAW_DEFAULT_FILE_NAME}\" \"\${line}\\n\")
|
||||
endforeach()
|
||||
cmake_policy(POP)")
|
||||
endforeach()")
|
||||
endmacro()
|
||||
|
||||
macro (OCCT_CREATE_SYMLINK_TO_FILE LIBRARY_NAME LINK_NAME)
|
||||
|
@@ -106,6 +106,12 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
|
||||
set (BISON_OUTPUT_FILE_EXT "cxx")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (EXISTS ${FLEX_BISON_TARGET_DIR}/FlexLexer.h)
|
||||
message (STATUS "Info: remove old FLEX header file: ${FLEX_BISON_TARGET_DIR}/FlexLexer.h")
|
||||
file(REMOVE ${FLEX_BISON_TARGET_DIR}/FlexLexer.h)
|
||||
endif()
|
||||
|
||||
file (STRINGS "${CURRENT_FLEX_FILE}" FILE_FLEX_CONTENT)
|
||||
foreach (FILE_FLEX_CONTENT_LINE ${FILE_FLEX_CONTENT})
|
||||
string (REGEX MATCH "%option c\\+\\+" CXX_FLEX_LANGUAGE_FOUND ${FILE_FLEX_CONTENT_LINE})
|
||||
@@ -121,6 +127,19 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
|
||||
set (BISON_OUTPUT_FILE ${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
|
||||
set (FLEX_OUTPUT_FILE lex.${CURRENT_FLEX_FILE_NAME}.${FLEX_OUTPUT_FILE_EXT})
|
||||
|
||||
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
|
||||
message (STATUS "Info: remove old output BISON file: ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT}")
|
||||
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
|
||||
endif()
|
||||
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx)
|
||||
message (STATUS "Info: remove old output BISON file: ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx")
|
||||
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx)
|
||||
endif()
|
||||
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE})
|
||||
message (STATUS "Info: remove old output FLEX file: ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE}")
|
||||
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE})
|
||||
endif()
|
||||
|
||||
BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} "${FLEX_BISON_TARGET_DIR}/${BISON_OUTPUT_FILE}"
|
||||
COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME} -l -M ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/=")
|
||||
FLEX_TARGET (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} "${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE}"
|
||||
@@ -226,6 +245,18 @@ endif (USE_QT)
|
||||
if (EXECUTABLE_PROJECT)
|
||||
add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
|
||||
|
||||
if (DEFINED ${PROJECT_NAME}_DISABLE_COTIRE AND ${PROJECT_NAME}_DISABLE_COTIRE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
|
||||
else()
|
||||
# To avoid excluding of PROJECT_NAME from cotire tool, we may use cotire
|
||||
# COTIRE_PREFIX_HEADER_IGNORE_PATH instead. But, practically it causes many 'undefined symbols' error.
|
||||
# So, we just exclude PROJECT_NAME from cotire list.
|
||||
# if (DEFINED ${PROJECT_NAME}_COTIRE_IGNORE_PATH)
|
||||
# set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_PREFIX_HEADER_IGNORE_PATH "${${PROJECT_NAME}_COTIRE_IGNORE_PATH}")
|
||||
# endif()
|
||||
endif()
|
||||
|
||||
install (TARGETS ${PROJECT_NAME}
|
||||
DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
|
||||
|
||||
@@ -235,6 +266,18 @@ if (EXECUTABLE_PROJECT)
|
||||
else()
|
||||
add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
|
||||
|
||||
if (DEFINED ${PROJECT_NAME}_DISABLE_COTIRE AND ${PROJECT_NAME}_DISABLE_COTIRE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
|
||||
else()
|
||||
# To avoid excluding of PROJECT_NAME from cotire tool, we may use cotire
|
||||
# COTIRE_PREFIX_HEADER_IGNORE_PATH instead. But, practically it causes many 'undefined symbols' error.
|
||||
# So, we just exclude PROJECT_NAME from cotire list.
|
||||
# if (DEFINED ${PROJECT_NAME}_COTIRE_IGNORE_PATH)
|
||||
# set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_PREFIX_HEADER_IGNORE_PATH "${${PROJECT_NAME}_COTIRE_IGNORE_PATH}")
|
||||
# endif()
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (BUILD_FORCE_RelWithDebInfo)
|
||||
set (aReleasePdbConf "Release")
|
||||
@@ -320,13 +363,17 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
|
||||
else() # get CSF_ value
|
||||
set (CURRENT_CSF ${${USED_ITEM}})
|
||||
if (NOT "x${CURRENT_CSF}" STREQUAL "x")
|
||||
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlLibs")
|
||||
if ("${CURRENT_CSF}" STREQUAL "${CSF_OpenGlLibs}")
|
||||
add_definitions (-DHAVE_OPENGL)
|
||||
endif()
|
||||
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlesLibs")
|
||||
if ("${CURRENT_CSF}" STREQUAL "${CSF_OpenGlesLibs}")
|
||||
add_definitions (-DHAVE_GLES2)
|
||||
endif()
|
||||
|
||||
if ("${CURRENT_CSF}" STREQUAL "${CSF_Draco}")
|
||||
set (CURRENT_CSF "")
|
||||
set (USED_DRACO 1)
|
||||
endif()
|
||||
set (LIBRARY_FROM_CACHE 0)
|
||||
separate_arguments (CURRENT_CSF)
|
||||
foreach (CSF_LIBRARY ${CURRENT_CSF})
|
||||
@@ -354,7 +401,7 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
if (NOT ${LIBRARY_FROM_CACHE})
|
||||
if (NOT ${LIBRARY_FROM_CACHE} AND NOT "${CURRENT_CSF}" STREQUAL "")
|
||||
# prepare a list from a string with whitespaces
|
||||
separate_arguments (CURRENT_CSF)
|
||||
list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${CURRENT_CSF})
|
||||
@@ -365,6 +412,28 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (USE_DRACO)
|
||||
if (USED_DRACO)
|
||||
set (USED_LIB_RELEASE ${3RDPARTY_DRACO_LIBRARY})
|
||||
if (WIN32)
|
||||
set (USED_LIB_DEBUG ${3RDPARTY_DRACO_LIBRARY_DEBUG})
|
||||
else()
|
||||
set (USED_LIB_DEBUG ${3RDPARTY_DRACO_LIBRARY})
|
||||
endif()
|
||||
set (USED_LIB_CONF)
|
||||
if (EXISTS ${USED_LIB_DEBUG})
|
||||
set (USED_LIB_CONF "$<$<CONFIG:DEBUG>:${USED_LIB_DEBUG}>;${USED_LIB_CONF}")
|
||||
endif()
|
||||
if (EXISTS ${USED_LIB_RELEASE})
|
||||
set (USED_LIB_CONF "$<$<CONFIG:RELEASE>:${USED_LIB_RELEASE}>;${USED_LIB_CONF}")
|
||||
set (USED_LIB_CONF "$<$<CONFIG:RELWITHDEBINFO>:${USED_LIB_RELEASE}>;${USED_LIB_CONF}")
|
||||
endif()
|
||||
if (DEFINED USED_LIB_CONF)
|
||||
set_property (TARGET ${PROJECT_NAME} APPEND PROPERTY LINK_LIBRARIES "${USED_LIB_CONF}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT X11 IS_X11_FOUND)
|
||||
if (NOT ${IS_X11_FOUND} EQUAL -1)
|
||||
|
@@ -1,294 +1,240 @@
|
||||
# tbb
|
||||
|
||||
if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
|
||||
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
|
||||
endif()
|
||||
|
||||
# tbb directory
|
||||
if (NOT DEFINED 3RDPARTY_TBB_DIR)
|
||||
set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
|
||||
endif()
|
||||
|
||||
if (MSVC AND BUILD_SHARED_LIBS)
|
||||
add_definitions (-D__TBB_NO_IMPLICIT_LINKAGE)
|
||||
add_definitions (-D__TBBMALLOC_NO_IMPLICIT_LINKAGE)
|
||||
endif()
|
||||
|
||||
# include occt macros. compiler_bitness, os_wiht_bit, compiler
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
|
||||
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
|
||||
endif()
|
||||
|
||||
# specify TBB folder in connectin with 3RDPARTY_DIR
|
||||
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
|
||||
#CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_DIR 3RDPARTY_TBB_DIR PATH "The directory containing tbb")
|
||||
# Initialize tbb directory.
|
||||
if (NOT DEFINED 3RDPARTY_TBB_DIR)
|
||||
set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_TBB_DIR OR NOT EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_DIR)
|
||||
message (FATAL_ERROR "3RDPARTY_DIR is not defined.")
|
||||
endif()
|
||||
if ("${3RDPARTY_DIR}" STREQUAL "")
|
||||
message (FATAL_ERROR "3RDPARTY_DIR is empty string.")
|
||||
endif()
|
||||
if (NOT EXISTS "${3RDPARTY_DIR}")
|
||||
message (FATAL_ERROR "3RDPARTY_DIR is not exist.")
|
||||
endif()
|
||||
|
||||
# Below, we have correct 3RDPARTY_DIR.
|
||||
|
||||
# Initialize TBB folder in connectin with 3RDPARTY_DIR.
|
||||
if (("${3RDPARTY_TBB_DIR}" STREQUAL "") OR (NOT EXISTS "${3RDPARTY_TBB_DIR}"))
|
||||
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" TBB TBB_DIR_NAME)
|
||||
if (TBB_DIR_NAME)
|
||||
set (3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${TBB_DIR_NAME}" CACHE PATH "The directory containing tbb" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
#set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing TBB" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
|
||||
endif()
|
||||
# Here we have full path name to installation directory of TBB.
|
||||
# Employ it.
|
||||
if (EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
find_package (
|
||||
TBB 2021.5
|
||||
PATHS "${3RDPARTY_TBB_DIR}" NO_DEFAULT_PATH
|
||||
REQUIRED
|
||||
CONFIG)
|
||||
|
||||
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
# check 3RDPARTY_TBB_INCLUDE_DIR for consictency with specified 3RDPARTY_TBB_DIR
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_TBB_INCLUDE_DIR PATH "The directory containing headers of the TBB")
|
||||
endif()
|
||||
|
||||
# tbb.h
|
||||
if (NOT 3RDPARTY_TBB_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
|
||||
|
||||
set (HEADER_NAMES tbb.h tbb/tbb.h)
|
||||
|
||||
# set 3RDPARTY_TBB_INCLUDE_DIR as notfound, otherwise find_library can't assign a new value to 3RDPARTY_TBB_INCLUDE_DIR
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "3RDPARTY_TBB_INCLUDE_DIR-NOTFOUND" CACHE PATH "the path to tbb.h" FORCE)
|
||||
|
||||
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
find_path (3RDPARTY_TBB_INCLUDE_DIR NAMES ${HEADER_NAMES}
|
||||
PATHS ${3RDPARTY_TBB_DIR}
|
||||
PATH_SUFFIXES include
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_path (3RDPARTY_TBB_INCLUDE_DIR NAMES ${HEADER_NAMES}
|
||||
PATH_SUFFIXES include
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_TBB_INCLUDE_DIR AND EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
|
||||
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "the path to tbb.h" FORCE)
|
||||
endif()
|
||||
|
||||
# common steps for tbb and tbbmalloc
|
||||
macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
|
||||
|
||||
string (TOUPPER ${PRODUCT_LIBRARY_NAME} upper_PRODUCT_LIBRARY_NAME)
|
||||
|
||||
# define required tbb/tbbmalloc variables
|
||||
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY OR NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR)
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL OR NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
|
||||
# Achive include directory
|
||||
get_target_property (TBB_INCLUDE_DIR TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32 AND NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR)
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library")
|
||||
endif()
|
||||
|
||||
# check 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_ paths for consistency with specified 3RDPARTY_TBB_DIR
|
||||
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY FILEPATH "the path to ${upper_PRODUCT_LIBRARY_NAME} library")
|
||||
|
||||
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}" PATH)
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
if (EXISTS "${TBB_INCLUDE_DIR}")
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "${TBB_INCLUDE_DIR}" CACHE PATH "The directory containing headers of the TBB" FORCE)
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
|
||||
else()
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library")
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL FILEPATH "the path to ${upper_PRODUCT_LIBRARY_NAME} shared library")
|
||||
separate_arguments (CSF_TBB)
|
||||
foreach (LIB IN LISTS CSF_TBB)
|
||||
string(TOLOWER "${LIB}" LIB_LOWER)
|
||||
string(TOUPPER "${LIB}" LIB_UPPER)
|
||||
|
||||
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
|
||||
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}" PATH)
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
|
||||
else()
|
||||
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library")
|
||||
# Achive *.lib files and directory containing it.
|
||||
get_target_property (TBB_LIB_FILE "TBB::${LIB_LOWER}" IMPORTED_IMPLIB_RELEASE)
|
||||
# Reserve cache variable for *.lib.
|
||||
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY)
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY "" CACHE FILEPATH "${LIB_UPPER} library (*.lib)")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
OCCT_MAKE_COMPILER_BITNESS()
|
||||
|
||||
if (${COMPILER_BITNESS} EQUAL 32)
|
||||
set (${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME ia32)
|
||||
else()
|
||||
set (${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME intel64)
|
||||
endif()
|
||||
|
||||
# tbb/tbbmalloc library
|
||||
if (NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
|
||||
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
|
||||
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME})
|
||||
|
||||
# set 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
|
||||
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
if (NOT EXISTS "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER}")
|
||||
if (EXISTS "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}")
|
||||
file (GLOB ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/*")
|
||||
if (${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST)
|
||||
list (GET ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
|
||||
if (THE_MOST_FRESH_COMPILER_VERSION)
|
||||
get_filename_component (THE_MOST_FRESH_COMPILER_VERSION_NAME "${THE_MOST_FRESH_COMPILER_VERSION}" NAME)
|
||||
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME} lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
# Reserve cache variable for directory containing *.lib file.
|
||||
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.lib)")
|
||||
endif()
|
||||
if (EXISTS "${TBB_LIB_FILE}")
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY
|
||||
"${TBB_LIB_FILE}"
|
||||
CACHE FILEPATH
|
||||
"${LIB_UPPER} library (*.lib)"
|
||||
FORCE)
|
||||
get_filename_component (TBB_LIB_FILE_DIRECTORY "${TBB_LIB_FILE}" DIRECTORY)
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR
|
||||
"${TBB_LIB_FILE_DIRECTORY}"
|
||||
CACHE PATH
|
||||
"The directory containing ${LIB_UPPER} library (*.lib)"
|
||||
FORCE)
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIB_UPPER}_LIBRARY_DIR}")
|
||||
else()
|
||||
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME} lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER})
|
||||
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
|
||||
endif()
|
||||
|
||||
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY ${PRODUCT_LIBRARY_NAME}
|
||||
PATHS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" "${3RDPARTY_TBB_DIR}"
|
||||
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY ${PRODUCT_LIBRARY_NAME}
|
||||
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
# Achive *.dll files and directory containing it.
|
||||
get_target_property (TBB_DLL_FILE "TBB::${LIB_LOWER}" IMPORTED_LOCATION_RELEASE)
|
||||
# Reserve cache variable for *.dll.
|
||||
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_DLL)
|
||||
set (3RDPARTY_${LIB_UPPER}_DLL "" CACHE FILEPATH "${LIB_UPPER} library (*.dll)")
|
||||
endif()
|
||||
# Reserve cache variable for directory containing *.dll file.
|
||||
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_DLL_DIR)
|
||||
set (3RDPARTY_${LIB_UPPER}_DLL_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.dll)")
|
||||
endif()
|
||||
if (EXISTS "${TBB_DLL_FILE}")
|
||||
set (3RDPARTY_${LIB_UPPER}_DLL
|
||||
"${TBB_DLL_FILE}"
|
||||
CACHE FILEPATH
|
||||
"${LIB_UPPER} library (*.dll)"
|
||||
FORCE)
|
||||
get_filename_component (TBB_DLL_FILE_DIRECTORY "${TBB_DLL_FILE}" DIRECTORY)
|
||||
set (3RDPARTY_${LIB_UPPER}_DLL_DIR
|
||||
"${TBB_DLL_FILE_DIRECTORY}"
|
||||
CACHE PATH
|
||||
"The directory containing ${LIB_UPPER} library (*.dll)"
|
||||
FORCE)
|
||||
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${LIB_UPPER}_DLL_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${LIB_UPPER}_DLL_DIR)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}" PATH)
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
else()
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
# install *.dll (tbb & tbbmalloc)
|
||||
if (INSTALL_TBB)
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR)
|
||||
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
endif()
|
||||
|
||||
# tbb/tbbmalloc shared library
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
|
||||
set (PRODUCT_PATH_SUFFIXES bin)
|
||||
|
||||
# set 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL-NOTFOUND" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
|
||||
|
||||
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
if (NOT EXISTS "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER}")
|
||||
if (EXISTS "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}")
|
||||
file (GLOB ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/*")
|
||||
if (${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST)
|
||||
list (GET ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
|
||||
if (THE_MOST_FRESH_COMPILER_VERSION)
|
||||
get_filename_component (THE_MOST_FRESH_COMPILER_VERSION_NAME "${THE_MOST_FRESH_COMPILER_VERSION}" NAME)
|
||||
set (PRODUCT_PATH_SUFFIXES bin bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
|
||||
else()
|
||||
set (PRODUCT_PATH_SUFFIXES bin bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER})
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL ${PRODUCT_LIBRARY_NAME}
|
||||
PATHS "${3RDPARTY_TBB_DIR}"
|
||||
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL ${PRODUCT_LIBRARY_NAME} PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES})
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
|
||||
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}" PATH)
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
else()
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
|
||||
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS Release DESTINATION "${INSTALL_DIR_BIN}")
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS RelWithDebInfo DESTINATION "${INSTALL_DIR_BIN}i")
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS Debug DESTINATION "${INSTALL_DIR_BIN}d")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR OR EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
|
||||
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
|
||||
mark_as_advanced (3RDPARTY_${LIB_UPPER}_LIBRARY 3RDPARTY_${LIB_UPPER}_DLL)
|
||||
endforeach()
|
||||
if (INSTALL_TBB)
|
||||
set (USED_3RDPARTY_TBB_DIR "")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR)
|
||||
# the *.dll/*.so* directory for using by the executable
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
|
||||
endif()
|
||||
else()
|
||||
message (FATAL_ERROR "Installation directory with TBB is not exist.")
|
||||
endif()
|
||||
else ()
|
||||
# NOT WIN32 branch
|
||||
if ((DEFINED 3RDPARTY_DIR) AND (NOT "${3RDPARTY_DIR}" STREQUAL "") AND (EXISTS "${3RDPARTY_DIR}"))
|
||||
# Here, we have correct 3RDPARTY_DIR.
|
||||
# Trying to specify TBB folder in connection with 3RDPARTY_DIR
|
||||
if (("${3RDPARTY_TBB_DIR}" STREQUAL "") OR (NOT EXISTS "${3RDPARTY_TBB_DIR}"))
|
||||
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" TBB TBB_DIR_NAME)
|
||||
if (TBB_DIR_NAME)
|
||||
set (3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${TBB_DIR_NAME}" CACHE PATH "The directory containing tbb" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
if ((NOT "${3RDPARTY_TBB_DIR}" STREQUAL "") AND (EXISTS "${3RDPARTY_TBB_DIR}"))
|
||||
# Find TBB 2021.5 in existing directory.
|
||||
find_package (
|
||||
TBB 2021.5
|
||||
PATHS "${3RDPARTY_TBB_DIR}" NO_DEFAULT_PATH
|
||||
REQUIRED
|
||||
CONFIG)
|
||||
else()
|
||||
# Find TBB 2021.5 in system directory.
|
||||
find_package (
|
||||
TBB 2021.5
|
||||
REQUIRED
|
||||
CONFIG)
|
||||
endif()
|
||||
else()
|
||||
# Find TBB 2021.5 in system directory.
|
||||
find_package (
|
||||
TBB 2021.5
|
||||
REQUIRED
|
||||
CONFIG)
|
||||
endif()
|
||||
# TBB has been configured (in other case FATAL_ERROR occures).
|
||||
|
||||
# Achive include directory.
|
||||
get_target_property (TBB_INCLUDE_DIR TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
|
||||
endif()
|
||||
if (EXISTS "${TBB_INCLUDE_DIR}")
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "${TBB_INCLUDE_DIR}" CACHE PATH "The directory containing headers of the TBB" FORCE)
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
# install tbb/tbbmalloc
|
||||
if (INSTALL_TBB)
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
if (WIN32)
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
|
||||
else()
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR_BIN}")
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR_BIN}i")
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR_BIN}d")
|
||||
endif()
|
||||
else()
|
||||
get_filename_component (PRODUCT_LIBRARY_NAME ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY} NAME)
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
|
||||
DESTINATION "${INSTALL_DIR_LIB}"
|
||||
RENAME ${PRODUCT_LIBRARY_NAME}.2)
|
||||
else()
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR_LIB}"
|
||||
RENAME ${PRODUCT_LIBRARY_NAME}.2)
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR_LIB}i"
|
||||
RENAME ${PRODUCT_LIBRARY_NAME}.2)
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR_LIB}d"
|
||||
RENAME ${PRODUCT_LIBRARY_NAME}.2)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
mark_as_advanced (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL)
|
||||
endmacro()
|
||||
|
||||
#if (BUILD_SHARED_LIBS)
|
||||
separate_arguments (CSF_TBB)
|
||||
foreach (LIB IN LISTS CSF_TBB)
|
||||
TBB_PRODUCT_SEARCH (${LIB})
|
||||
endforeach()
|
||||
string(TOLOWER "${LIB}" LIB_LOWER)
|
||||
string(TOUPPER "${LIB}" LIB_UPPER)
|
||||
|
||||
# Achive *.so files and directory containing it.
|
||||
get_target_property (TBB_SO_FILE "TBB::${LIB_LOWER}" IMPORTED_LOCATION_RELEASE)
|
||||
# Reserve cache variable for *.so.
|
||||
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY)
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY "" CACHE FILEPATH "${LIB_UPPER} library (*.so)")
|
||||
endif()
|
||||
# Reserve cache variable for directory containing *.so file.
|
||||
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.so)")
|
||||
endif()
|
||||
if (EXISTS "${TBB_SO_FILE}")
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY
|
||||
"${TBB_SO_FILE}"
|
||||
CACHE FILEPATH
|
||||
"${LIB_UPPER} library (*.so)"
|
||||
FORCE)
|
||||
get_filename_component (TBB_SO_FILE_DIRECTORY "${TBB_SO_FILE}" DIRECTORY)
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR
|
||||
"${TBB_SO_FILE_DIRECTORY}"
|
||||
CACHE PATH
|
||||
"The directory containing ${LIB_UPPER} library (*.so)"
|
||||
FORCE)
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIB_UPPER}_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
|
||||
endif()
|
||||
|
||||
# install *.so* (tbb & tbbmalloc)
|
||||
if (INSTALL_TBB)
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} DESTINATION "${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS Release DESTINATION "${INSTALL_DIR_LIB}")
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS RelWithDebInfo DESTINATION "${INSTALL_DIR_LIB}i")
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS Debug DESTINATION "${INSTALL_DIR_LIB}d")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
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})
|
||||
else()
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
|
||||
endif()
|
||||
# the *.so* directory for using by the executable
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
|
||||
endif()
|
||||
#endif()
|
||||
endif()
|
||||
|
@@ -780,14 +780,14 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
|
||||
}
|
||||
}
|
||||
if { "$::tcl_platform(platform)" == "windows" } {
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter"]
|
||||
if { "$aTbbDllPath" == "" } {
|
||||
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ]
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
|
||||
if { "$aTbbDllPath" != "" } {
|
||||
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/$aVcLib"
|
||||
} else {
|
||||
lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)"
|
||||
lappend anErrBin$anArchIter "Error: 'tbb12.dll' not found (Intel TBB)"
|
||||
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
|
||||
}
|
||||
}
|
||||
|
179
adm/genproj.tcl
179
adm/genproj.tcl
@@ -1233,28 +1233,11 @@ proc osutils:convertModules { theModules theSrcDir theSourceDirOther theProjects
|
||||
lappend aProjectsInModule($aModule) $aToolKit
|
||||
lappend aDependencies [LibToLink $aToolKit $theSrcDir $theSourceDirOther]
|
||||
}
|
||||
# executables, assume one project per cxx file...
|
||||
# executables
|
||||
foreach aUnit [OS:executable ${aModule}] {
|
||||
set aUnitLoc $aUnit
|
||||
set src_files [_get_used_files $aUnit $theSrcDir false]
|
||||
set aSrcFiles {}
|
||||
foreach s $src_files {
|
||||
regexp {source ([^\s]+)} $s dummy name
|
||||
lappend aSrcFiles $name
|
||||
}
|
||||
foreach aSrcFile $aSrcFiles {
|
||||
set aFileExtension [file extension $aSrcFile]
|
||||
if { $aFileExtension == ".cxx" } {
|
||||
set aPrjName [file rootname $aSrcFile]
|
||||
lappend aProjects $aPrjName
|
||||
lappend aProjectsInModule($aModule) $aPrjName
|
||||
if {[file isdirectory $path/$theSrcDir/$aUnitLoc]} {
|
||||
lappend aDependencies [LibToLinkX $aUnitLoc [file rootname $aSrcFile] $theSrcDir $theSourceDirOther]
|
||||
} else {
|
||||
lappend aDependencies {}
|
||||
}
|
||||
}
|
||||
}
|
||||
lappend aProjects $aUnit
|
||||
lappend aProjectsInModule($aModule) $aUnit
|
||||
lappend aDependencies [LibToLink $aUnit $theSrcDir $theSourceDirOther]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2110,98 +2093,106 @@ proc osutils:tk:execfiles { theFiles theOutDir theCommand thePrefix theExtension
|
||||
# Generate Visual Studio project file for executable
|
||||
proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir theSourceDirOther } {
|
||||
set aVcFiles {}
|
||||
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
|
||||
set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
|
||||
set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
|
||||
|
||||
set aProjName [file rootname [file tail $f]]
|
||||
set l_compilable [osutils:compilable wnt]
|
||||
regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl
|
||||
set aProjName $theToolKit
|
||||
set l_compilable [osutils:compilable wnt]
|
||||
regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl
|
||||
|
||||
upvar $theGuidsMap aGuidsMap
|
||||
if { ! [info exists aGuidsMap($aProjName)] } {
|
||||
set aGuidsMap($aProjName) [OS:genGUID]
|
||||
}
|
||||
regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl
|
||||
upvar $theGuidsMap aGuidsMap
|
||||
if { ! [info exists aGuidsMap($aProjName)] } {
|
||||
set aGuidsMap($aProjName) [OS:genGUID]
|
||||
}
|
||||
regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl
|
||||
|
||||
set aUsedLibs [list]
|
||||
foreach tkx [osutils:commonUsedTK $theToolKit $theSrcDir $theSourceDirOther] {
|
||||
lappend aUsedLibs "${tkx}.lib"
|
||||
}
|
||||
set aUsedLibs [list]
|
||||
foreach tkx [osutils:commonUsedTK $theToolKit $theSrcDir $theSourceDirOther] {
|
||||
lappend aUsedLibs "${tkx}.lib"
|
||||
}
|
||||
|
||||
set anOsReleaseLibs {}
|
||||
set anOsDebugLibs {}
|
||||
osutils:usedOsLibs $theToolKit "wnt" anOsReleaseLibs aFrameworks $theSrcDir true
|
||||
osutils:usedOsLibs $theToolKit "wnt" anOsDebugLibs aFrameworks $theSrcDir false
|
||||
set anOsReleaseLibs {}
|
||||
set anOsDebugLibs {}
|
||||
osutils:usedOsLibs $theToolKit "wnt" anOsReleaseLibs aFrameworks $theSrcDir true
|
||||
osutils:usedOsLibs $theToolKit "wnt" anOsDebugLibs aFrameworks $theSrcDir false
|
||||
|
||||
set aVCRTVer [string range $theVcVer 0 3]
|
||||
regsub -all -- {__TKDEP__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] aProjTmpl
|
||||
regsub -all -- {__TKDEP_DEBUG__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] aProjTmpl
|
||||
regsub -all -- {__TKDEFINES__} $aProjTmpl "" aProjTmpl
|
||||
set aVCRTVer [string range $theVcVer 0 3]
|
||||
regsub -all -- {__TKDEP__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] aProjTmpl
|
||||
regsub -all -- {__TKDEP_DEBUG__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] aProjTmpl
|
||||
regsub -all -- {__TKDEFINES__} $aProjTmpl "" aProjTmpl
|
||||
|
||||
set aFilesSection ""
|
||||
set aVcFilesCxx(units) ""
|
||||
set aVcFilesHxx(units) ""
|
||||
set aFilesSection ""
|
||||
set aVcFilesCxx(units) ""
|
||||
set aVcFilesHxx(units) ""
|
||||
|
||||
if { ![info exists written([file tail $f])] } {
|
||||
set written([file tail $f]) 1
|
||||
|
||||
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
|
||||
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
|
||||
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
|
||||
if { ![info exists written([file tail $f])] } {
|
||||
set written([file tail $f]) 1
|
||||
append aFilesSection [osutils:vcxproj:cxxfile $f "" 3]
|
||||
if { ! [info exists aVcFilesCxx($theToolKit)] } { lappend aVcFilesCxx(units) $theToolKit }
|
||||
lappend aVcFilesCxx($theToolKit) $f
|
||||
} else {
|
||||
append aFilesSection "\t\t\t<Filter\n"
|
||||
append aFilesSection "\t\t\t\tName=\"$theToolKit\"\n"
|
||||
append aFilesSection "\t\t\t\t>\n"
|
||||
append aFilesSection [osutils:vcproj:file $theVcVer $f ""]
|
||||
append aFilesSection "\t\t\t</Filter>"
|
||||
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
|
||||
}
|
||||
} else {
|
||||
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
|
||||
}
|
||||
#puts "$aProjTmpl $aFilesSection"
|
||||
set anIncPaths "..\\..\\..\\inc"
|
||||
regsub -all -- {__TKINC__} $aProjTmpl $anIncPaths aProjTmpl
|
||||
regsub -all -- {__FILES__} $aProjTmpl $aFilesSection aProjTmpl
|
||||
regsub -all -- {__CONF__} $aProjTmpl Application aProjTmpl
|
||||
} else {
|
||||
append aFilesSection "\t\t\t<Filter\n"
|
||||
append aFilesSection "\t\t\t\tName=\"$theToolKit\"\n"
|
||||
append aFilesSection "\t\t\t\t>\n"
|
||||
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
|
||||
if { ![info exists written([file tail $f])] } {
|
||||
set written([file tail $f]) 1
|
||||
append aFilesSection [osutils:vcproj:file $theVcVer $f ""]
|
||||
} else {
|
||||
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
|
||||
}
|
||||
}
|
||||
append aFilesSection "\t\t\t</Filter>"
|
||||
}
|
||||
|
||||
regsub -all -- {__XQTEXT__} $aProjTmpl "exe" aProjTmpl
|
||||
#puts "$aProjTmpl $aFilesSection"
|
||||
set anIncPaths "..\\..\\..\\inc"
|
||||
regsub -all -- {__TKINC__} $aProjTmpl $anIncPaths aProjTmpl
|
||||
regsub -all -- {__FILES__} $aProjTmpl $aFilesSection aProjTmpl
|
||||
regsub -all -- {__CONF__} $aProjTmpl Application aProjTmpl
|
||||
|
||||
set aFile [open [set aVcFilePath [file join $theOutDir ${aProjName}.[osutils:vcproj:ext $theVcVer]]] w]
|
||||
regsub -all -- {__XQTEXT__} $aProjTmpl "exe" aProjTmpl
|
||||
|
||||
set aFile [open [set aVcFilePath [file join $theOutDir ${aProjName}.[osutils:vcproj:ext $theVcVer]]] w]
|
||||
fconfigure $aFile -translation crlf
|
||||
puts $aFile $aProjTmpl
|
||||
close $aFile
|
||||
|
||||
set aCommonSettingsFile "$aVcFilePath.user"
|
||||
lappend aVcFiles $aVcFilePath
|
||||
|
||||
# write filters file for vc10
|
||||
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
|
||||
lappend aVcFiles [osutils:vcxproj:filters $theOutDir $aProjName aVcFilesCxx aVcFilesHxx]
|
||||
}
|
||||
|
||||
# write resource file
|
||||
lappend aVcFiles [osutils:readtemplate:rc $theOutDir $aProjName]
|
||||
|
||||
set aCommonSettingsFileTmpl ""
|
||||
if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" } {
|
||||
# nothing
|
||||
} elseif { "$theVcVer" == "vc9" } {
|
||||
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcproj.user.vc9x"]
|
||||
} else {
|
||||
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcxproj.user.vc10x"]
|
||||
}
|
||||
if { "$aCommonSettingsFileTmpl" != "" } {
|
||||
regsub -all -- {__VCVER__} $aCommonSettingsFileTmpl $aVCRTVer aCommonSettingsFileTmpl
|
||||
|
||||
set aFile [open [set aVcFilePath "$aCommonSettingsFile"] w]
|
||||
fconfigure $aFile -translation crlf
|
||||
puts $aFile $aProjTmpl
|
||||
puts $aFile $aCommonSettingsFileTmpl
|
||||
close $aFile
|
||||
|
||||
set aCommonSettingsFile "$aVcFilePath.user"
|
||||
lappend aVcFiles $aVcFilePath
|
||||
|
||||
# write filters file for vc10
|
||||
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
|
||||
lappend aVcFiles [osutils:vcxproj:filters $theOutDir $aProjName aVcFilesCxx aVcFilesHxx]
|
||||
}
|
||||
|
||||
# write resource file
|
||||
lappend aVcFiles [osutils:readtemplate:rc $theOutDir $aProjName]
|
||||
|
||||
set aCommonSettingsFileTmpl ""
|
||||
if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" } {
|
||||
# nothing
|
||||
} elseif { "$theVcVer" == "vc9" } {
|
||||
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcproj.user.vc9x"]
|
||||
} else {
|
||||
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcxproj.user.vc10x"]
|
||||
}
|
||||
if { "$aCommonSettingsFileTmpl" != "" } {
|
||||
regsub -all -- {__VCVER__} $aCommonSettingsFileTmpl $aVCRTVer aCommonSettingsFileTmpl
|
||||
|
||||
set aFile [open [set aVcFilePath "$aCommonSettingsFile"] w]
|
||||
fconfigure $aFile -translation crlf
|
||||
puts $aFile $aCommonSettingsFileTmpl
|
||||
close $aFile
|
||||
|
||||
lappend aVcFiles "$aCommonSettingsFile"
|
||||
}
|
||||
lappend aVcFiles "$aCommonSettingsFile"
|
||||
}
|
||||
|
||||
return $aVcFiles
|
||||
}
|
||||
|
||||
|
@@ -45,6 +45,7 @@ user_guides/visualization/visualization.md
|
||||
user_guides/iges/iges.md
|
||||
user_guides/step/step.md
|
||||
user_guides/xde/xde.md
|
||||
user_guides/de_wrapper/de_wrapper.md
|
||||
user_guides/ocaf/ocaf.md
|
||||
user_guides/draw_test_harness/draw_test_harness.md
|
||||
user_guides/inspector/inspector.md
|
||||
|
@@ -20,6 +20,7 @@ user_guides/vis/vis.md
|
||||
user_guides/iges/iges.md
|
||||
user_guides/step/step.md
|
||||
user_guides/xde/xde.md
|
||||
user_guides/de_wrapper/de_wrapper.md
|
||||
user_guides/inspector/inspector.md
|
||||
user_guides/draw_test_harness/draw_test_harness.md
|
||||
|
||||
|
17
dox/build/build_3rdparty/building_3rdparty.md
vendored
17
dox/build/build_3rdparty/building_3rdparty.md
vendored
@@ -128,8 +128,9 @@ You can download its sources from https://freetype.org/
|
||||
|
||||
@subsection dev_guides__building_3rdparty_win_3_1 TBB
|
||||
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need (e.g. `tbb30_018oss`) and pick the archive for Windows platform.
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
|
||||
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Windows platform.
|
||||
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-win.zip`)
|
||||
|
||||
Unpack the downloaded archive of TBB product into the `3rdparty` folder.
|
||||
|
||||
@@ -304,9 +305,9 @@ Download the necessary archive from https://freetype.org/ and unpack it.
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_3_1 TBB
|
||||
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
|
||||
To install, unpack the downloaded archive of TBB product.
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
|
||||
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Linux platform.
|
||||
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-lin.tgz`).
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_3_3 FreeImage
|
||||
|
||||
@@ -477,9 +478,9 @@ Download the necessary archive from https://freetype.org/ and unpack it.
|
||||
|
||||
@subsection dev_guides__building_3rdparty_osx_3_1 TBB
|
||||
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need (e.g. `tbb30_018oss`) and pick the archive for Mac OS X platform.
|
||||
To install, unpack the downloaded archive of TBB product (`tbb30_018oss_osx.tgz`).
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
|
||||
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Mac OS X platform.
|
||||
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-mac.tgz`).
|
||||
|
||||
@subsection dev_guides__building_3rdparty_osx_3_3 FreeImage
|
||||
|
||||
|
@@ -17,7 +17,7 @@ On Linux and macOS we recommend to use libraries maintained by distributive deve
|
||||
@section build_occt_win_cmake Building with CMake tool
|
||||
|
||||
This chapter describes the [CMake](https://cmake.org/download/)-based build process, which is now suggested as a standard way to produce the binaries of Open CASCADE Technology from sources.
|
||||
OCCT requires CMake version 2.8.12 or later.
|
||||
OCCT requires CMake version 3.1 or later.
|
||||
|
||||
CMake is a tool that generates the actual project files for the selected target build system (e.g. Unix makefiles) or IDE (e.g. Visual Studio 2010).
|
||||
Here we describe the build procedure on the example of Windows platform with Visual Studio 2010.
|
||||
@@ -113,6 +113,7 @@ The following table gives the full list of environment variables used at the con
|
||||
| BUILD_PATCH | Path | Points to the directory recognized as a "patch" for OCCT. If specified, the files from this directory take precedence over the corresponding native OCCT sources. This way you are able to introduce patches to Open CASCADE Technology not affecting the original source distribution |
|
||||
| BUILD_WITH_DEBUG | Boolean | Enables extended messages of many OCCT algorithms, usually printed to cout. These include messages on internal errors and special cases encountered, timing, etc. |
|
||||
| BUILD_ENABLE_FPE_SIGNAL_HANDLER | Boolean | Enable/Disable the floating point exceptions (FPE) during DRAW execution only. Corresponding environment variable (CSF_FPE) can be changed manually in custom.bat/sh scripts without regeneration by CMake. |
|
||||
| BUILD_CPP_STANDARD | String | Employ corresponding c++ standard (C++11, C++14, ..C++23) for building OCCT |
|
||||
| CMAKE_CONFIGURATION_TYPES | String | Semicolon-separated CMake configurations |
|
||||
| INSTALL_DIR | Path | Points to the installation directory. *INSTALL_DIR* is a synonym of *CMAKE_INSTALL_PREFIX*. The user can specify both *INSTALL_DIR* or *CMAKE_INSTALL_PREFIX* |
|
||||
| INSTALL_DIR_BIN | Path | Relative path to the binaries installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_BIN}) |
|
||||
|
@@ -341,7 +341,7 @@ The tables below describe the recommended software configurations for which OCCT
|
||||
|
||||
| OS | Compiler |
|
||||
| --------- | ----------- |
|
||||
| Windows | Microsoft Visual Studio: 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019, 2022 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
|
||||
| Windows | Microsoft Visual Studio: 2015 Update 3, 2017 <sup>1</sup>, 2019, 2022 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
|
||||
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
|
||||
| OS X / macOS | XCode 6 or newer |
|
||||
| Android | NDK r12, GNU gcc 4.9 or newer |
|
||||
@@ -359,8 +359,8 @@ https://dev.opencascade.org/resources/download/3rd-party-components
|
||||
|
||||
| Component | Where to find | Used for | Purpose |
|
||||
| --------- | ------------- | -------- | -------------------- |
|
||||
| CMake 2.8+ | https://cmake.org/ | Configuration | Build from sources |
|
||||
| Intel TBB 4.x or later | https://oneapi-src.github.io/oneTBB/ | All | Parallelization of algorithms (alternative to built-in thread pool) |
|
||||
| CMake 3.1+ | https://cmake.org/ | Configuration | Build from sources |
|
||||
| Intel oneTBB 2021.5.0 | https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0 | All | Parallelization of algorithms (alternative to built-in thread pool) |
|
||||
| OpenGL 3.3+, OpenGL ES 2.0+ | System | Visualization | Required for using 3D Viewer |
|
||||
| OpenVR 1.10+ | https://github.com/ValveSoftware/openvr | Visualization | VR (Virtual Reality) support in 3D Viewer |
|
||||
| FreeType 2.4+ | https://www.freetype.org/download.html | Visualization | Text rendering in 3D Viewer |
|
||||
@@ -572,8 +572,7 @@ FreeType 2 is released under two open-source licenses: BSD-like FreeType License
|
||||
It is a library that helps you to take advantage of multi-core processor performance without having to be a threading expert.
|
||||
Threading Building Blocks is not just a threads-replacement library. It represents a higher-level, task-based parallelism that
|
||||
abstracts platform details and threading mechanisms for scalability and performance.
|
||||
TBB version 2017 is available under Apache 2.0 license, while older versions
|
||||
until 4.4 are available under GPLv2 license with the runtime exception (https://www.threadingbuildingblocks.org).
|
||||
Intel oneTBB 2021.5.0 is available under Apache 2.0 license (https://www.threadingbuildingblocks.org).
|
||||
|
||||
**OpenGL** is an industry standard API for 3D graphics used by OCCT for
|
||||
implementation of 3D viewer. OpenGL specification is developed by the
|
||||
|
@@ -2338,3 +2338,8 @@ or to include system OpenGL headers in advance (with help of `OpenGl_GlNative.hx
|
||||
|
||||
Method `StdPrs_ToolTriangulatedShape::Normal()` has been removed.
|
||||
Please use `BRepLib_ToolTriangulatedShape::ComputeNormals()` to fill in normal attributes in triangulation and fetch them directly using `Poly_Triangulation::Normal()`.
|
||||
|
||||
@subsection upgrade_occt770_shapeproximity BRepExtrema_ShapeProximity
|
||||
|
||||
A new way of using the `BRepExtrema_ShapeProximity` class was provided for computing a proximity value between two shapes.
|
||||
If at initialization of the `BRepExtrema_ShapeProximity` class the *theTolerance* parameter is not defined (Precision::Infinite() by default), the proximity value will be computed.
|
||||
|
413
dox/user_guides/de_wrapper/de_wrapper.md
Normal file
413
dox/user_guides/de_wrapper/de_wrapper.md
Normal file
@@ -0,0 +1,413 @@
|
||||
Data Exchange Wrapper (DE_Wrapper) {#occt_user_guides__de_wrapper}
|
||||
============================
|
||||
|
||||
@tableofcontents
|
||||
|
||||
@section occt_de_wrapper_1 Introduction
|
||||
|
||||
This guide explains how to use the **Data Exchange Wrapper** (DE Wrapper).
|
||||
It provides basic directions on setup, usage and file creation via DE_Wrapper.
|
||||
|
||||
The Data Exchange Wrapper (DE Wrapper) module allows reading and writing supported CAD formats to shape objects or special XDE documents, setting up the transfer process for all CAD files.
|
||||
|
||||
It is also possible to add support for new CAD formats by prototyping existing tools.
|
||||
|
||||
The DE Wrapper component requires @ref occt_user_guides__xde "XDE" toolkit for operation.
|
||||
|
||||
This guide mainly explains how to convert CAD files to Open CASCADE Technology (OCCT) shapes and vice versa.
|
||||
This guide principally deals with the following OCCT classes:
|
||||
* The Provider class, which loads CAD files and translates their contents to OCCT shapes or XDE documents, or translates OCCT shapes or XDE documents to CAD entities and then writes those entities to a CAD file.
|
||||
* The Configuration class, which contains all information for the transfer process, such as the units, tolerance, and all internal information for the OCC readers or writers.
|
||||
* The wrapper class, which contains all loaded configuration objects with own CAD format, reads or writes CAD files in the format derived from file extension or contents and saves or loads configuration settings for loaded configuration objects.
|
||||
|
||||
@section occt_de_wrapper_2 Supported CAD formats
|
||||
|
||||
| CAD format | Extensions | RW support | Thread Safety | Presentation | Package |
|
||||
| :--------- | :--------- | :--------- | :----------- | :----------- | :------ |
|
||||
| STEP | .stp, .step .stepz | RW | No | BRep, Mesh | STEPCAFControl |
|
||||
| XCAF | .xbf | RW | Yes | BRep, Mesh | DEXCAFCascade |
|
||||
| BREP | .brep | RW | Yes | BRep, Mesh | DEBRepCascade |
|
||||
| IGES | .igs, .iges | RW | No | BRep | IGESCAFControl |
|
||||
| OBJ | .obj | RW | Yes | Mesh | RWObj |
|
||||
| STL | .stl | RW | Yes | Mesh | RWStl |
|
||||
| PLY | .ply | W | Yes | Mesh | RWPly |
|
||||
| GLTF | .glTF .glb | RW | Yes | Mesh | RWGltf |
|
||||
| VRML | .wrl .vrml | RW | Yes | Mesh | Vrml |
|
||||
|
||||
**Note** :
|
||||
* The format names in the first column match the FormatName values used for configuration nodes.
|
||||
* The VendorName for all listed CAD formats is "OCC".
|
||||
|
||||
@section occt_de_wrapper_3 DE Session Configuration
|
||||
|
||||
Any providers can have their own read/write parameters. The transfer process is set up using DE configuration nodes, which hold all relevant parameters. There are two ways to change the parameter values: directly from code or by an external resource file/string.
|
||||
The session is a global or static DE_Wrapper object that stores registered DE configuration nodes and wraps DE commands to work with them. It has some configuration parameters of its own and also keeps track of loaded nodes and specilal global parameters.
|
||||
|
||||
@subsection occt_de_wrapper_3_1 Getting a DE session. Code sample
|
||||
|
||||
Working with a DE session requires a DE_Wrapper object to be loaded or created first.
|
||||
|
||||
Getting the global DE_Wrapping object:
|
||||
~~~~{.cpp}
|
||||
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
|
||||
~~~~
|
||||
Creating a local DE_Wrapper:
|
||||
~~~~{.cpp}
|
||||
Handle(DE_Wrapper) aSession = new DE_Wrapper();
|
||||
~~~~
|
||||
It is recommended to create a local one-time copy to work with the session, if no global changes are intended.
|
||||
~~~~{.cpp}
|
||||
Handle(DE_Wrapper) aOneTimeSession = aSession->Copy();
|
||||
~~~~
|
||||
@subsection occt_de_wrapper_3_2 Configuration resource
|
||||
|
||||
Configuration resource is an external file or string of the following format:
|
||||
~~~~{.cpp}
|
||||
global.priority.STEP : OCC DTK
|
||||
global.general.length.unit : 1
|
||||
provider.STEP.OCC.read.precision.val : 0.0001
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_de_wrapper_3_2_1 Configuration resource: graph of scopes
|
||||
* **global.** is a scope of global parameters
|
||||
* **priority.** is a scope of priority to use vendors with their providers.
|
||||
* **general.** is a scope of global configuration parameter values
|
||||
* <strong>"..."</strong> is an internal configuration with any internal scopes
|
||||
* <strong>". : "</strong> is a separator of key-value
|
||||
* __...__ parameter value, can't contain new line symbols.
|
||||
* **provider.** is a scope of configuration providers
|
||||
* **STEP.** is a scope of CAD format to configure
|
||||
* **OCC.** is a scope of a vendor or provider
|
||||
* <strong>"..."</strong> is an internal configuration with any internal scopes
|
||||
* <strong>". : "</strong> is a separator of key-value
|
||||
* <strong>"..."</strong> parameter value, can't contain new line symbols.
|
||||
|
||||
@subsubsection occt_de_wrapper_3_2_2 Loading configuration resources. Configuring DE Session
|
||||
|
||||
The resource should be loaded after the registration of all providers that should be configured. The resource only impacts registered parameters. To configure a new registered provider it is necessary to load the resource again. Parameters not present in the resource will remain unchanged.
|
||||
|
||||
There are two ways to check what parameters are available:
|
||||
* C++: Open ConfigureNode file and check the InternalParameter field. Each parameter will be described with a comment. To check the global parameters, use the DE_Wrapper class public methods.
|
||||
* Resource: Register all available Nodes to the session, then save the configuration and view all existing parameters.
|
||||
|
||||
There are two options for loading a resource: recursive and global parameters only. Recursive is the default option to configure all global parameters (units, priority, enable status) and all registered providers. Non-recursive configures only global parameters and ignores all provider settings. This option is the best for updating provider priority.
|
||||
|
||||
@subsubsection occt_de_wrapper_3_2_3 Loading configuration resources. Code sample
|
||||
|
||||
Configuring using a resource string:
|
||||
~~~~{.cpp}
|
||||
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
|
||||
TCollection_AsciiString aString =
|
||||
"global.priority.STEP : OCC DTK\n"
|
||||
"global.general.length.unit : 1\n"
|
||||
"provider.STEP.OCC.read.precision.val : 0.\n";
|
||||
Standard_Boolean aIsRecursive = Standard_True;
|
||||
if (!aSession->Load(aString, aIsRecursive))
|
||||
{
|
||||
Message::SendFail() << "Error: configuration is incorrect";
|
||||
}
|
||||
~~~~
|
||||
Configuring using a resource file:
|
||||
~~~~{.cpp}
|
||||
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
|
||||
TCollection_AsciiString aPathToFile = "";
|
||||
Standard_Boolean aIsRecursive = Standard_True;
|
||||
if (!aSession->Load(aPathToFile, aIsRecursive))
|
||||
{
|
||||
Message::SendFail() << "Error: configuration is incorrect";
|
||||
}
|
||||
~~~~
|
||||
@subsubsection occt_de_wrapper_3_2_4 Loading configuration resources. DRAW sample
|
||||
|
||||
Configuring using a resource string:
|
||||
~~~~{.cpp}
|
||||
set conf "
|
||||
global.priority.STEP : OCC
|
||||
global.general.length.unit : 1
|
||||
provider.STEP.OCC.read.iges.bspline.continuity : 1
|
||||
provider.STEP.OCC.read.precision.mode : 0
|
||||
provider.STEP.OCC.read.precision.val : 0.0001
|
||||
"
|
||||
LoadConfiguration ${conf} -recursive on
|
||||
~~~~
|
||||
|
||||
Configuring using a resource file:
|
||||
~~~~{.cpp}
|
||||
set pathToFile ""
|
||||
LoadConfiguration ${pathToFile} -recursive on
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_de_wrapper_3_2_5 Saving configuration resources. Dump of configuration DE Session
|
||||
|
||||
Saving the configuration of a DE Session involves dumping all parameters of registered providers.
|
||||
If a parameter did not change during the session, its value remains as default.
|
||||
|
||||
There are two ways to save a resource: recursive and global parameters only. Recursive is the way to dump all registered provider information. Non-recursive dumps only global parameters, for example, save priority of vendors or the length unit.
|
||||
|
||||
It is possible to filter what vendors or providers to save by providing the correct name of the vendor or provider.
|
||||
|
||||
@subsubsection occt_de_wrapper_3_2_6 Saving configuration resources. Code sample
|
||||
|
||||
Dump to resource string. If the vendors list is empty, saves all vendors. If the providers list is empty, saves all providers of valid vendors.
|
||||
~~~~{.cpp}
|
||||
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
|
||||
TColStd_ListOfAsciiString aFormats;
|
||||
TColStd_ListOfAsciiString aVendors;
|
||||
aFormats.Appends("STEP");
|
||||
aVendors.Appends("OCC");
|
||||
Standard_Boolean aIsRecursive = Standard_True;
|
||||
TCollection_AsciiString aConf = aSession->aConf->Save(aIsRecursive, aFormats, aVendors);
|
||||
~~~~
|
||||
Configure using a resource file. If the vendors list is empty, saves all vendors. If the providers list is empty, saves all providers of valid vendors.
|
||||
~~~~{.cpp}
|
||||
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
|
||||
TCollection_AsciiString aPathToFile = "";
|
||||
TColStd_ListOfAsciiString aFormats;
|
||||
TColStd_ListOfAsciiString aVendors;
|
||||
aFormats.Appends("STEP");
|
||||
aVendors.Appends("OCC");
|
||||
Standard_Boolean aIsRecursive = Standard_True;
|
||||
if (!aSession->Save(aPathToFile, aIsRecursive, aFormats,aVendors))
|
||||
{
|
||||
Message::SendFail() << "Error: configuration is not saved";
|
||||
}
|
||||
~~~~
|
||||
@subsubsection occt_de_wrapper_3_2_7 Saving configuration resources. DRAW sample
|
||||
|
||||
Dump configuration to string. If no list of vendors is passed or it is empty, all vendors are saved. If no providers list is passed or it is empty, all providers of valid vendors are saved.
|
||||
~~~~{.cpp}
|
||||
set vendors "OCC"
|
||||
set format "STEP"
|
||||
set dump_conf [DumpConfiguration -recursive on -format ${format} -vendor ${vendors}]
|
||||
~~~~
|
||||
|
||||
Dump configuration to file. If no vendors list are set as an argument or it is empty, saves all vendors. If no providers list as argument or it is empty, saves all providers of valid vendors:
|
||||
~~~~{.cpp}
|
||||
set vendors "OCC"
|
||||
set format "STEP"
|
||||
set pathToFile ""
|
||||
DumpConfiguration -path ${pathToFile} -recursive on -format ${format} -vendor ${vendors}
|
||||
~~~~
|
||||
|
||||
@subsection occt_de_wrapper_3_3 Registering providers
|
||||
|
||||
To transfer a CAD file using DE Wrapper, it is necessary to register a CAD provider.
|
||||
The provider contains internal and global parameters that have default values in the creation stage.
|
||||
All registered providers are set to the map with information about its vendor and kept as smart handles. Therefore, it is possible to change the values via handle from external code.
|
||||
|
||||
@subsubsection occt_de_wrapper_3_3_1 Registering providers. Code sample
|
||||
|
||||
It is nesessary to register only one ConfigurationNode for all needed formats.
|
||||
~~~~{.cpp}
|
||||
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
|
||||
Handle(DE_ConfigurationNode) aNode = new STEPCAFControl_ConfigurationNode();
|
||||
aSession->Bind(aNode);
|
||||
~~~~
|
||||
@subsubsection occt_de_wrapper_3_3_2 Registering providers. DRAW Sample
|
||||
|
||||
Use DRAW with all providers registered by the following command:
|
||||
~~~~{.cpp}
|
||||
pload XDE
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_de_wrapper_3_3_3 Realtime initialization. Code sample
|
||||
|
||||
It is possible to change a paramater from code using a smart pointer.
|
||||
|
||||
~~~~{.cpp}
|
||||
// global variable
|
||||
static Handle(STEPCAFControl_ConfigurationNode) THE_STEP_NODE;
|
||||
|
||||
static Handle(DE_ConfigurationNode) RegisterStepNode()
|
||||
{
|
||||
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
|
||||
if (!THE_STEP_NODE.IsNull())
|
||||
{
|
||||
return THE_STEP_NODE;
|
||||
}
|
||||
|
||||
THE_STEP_NODE = new STEPCAFControl_ConfigurationNode();
|
||||
aSession->Bind(THE_STEP_NODE);
|
||||
return THE_STEP_NODE;
|
||||
}
|
||||
|
||||
// Change parameter value
|
||||
THE_STEP_NODE->InternalParameters.ReadRelationship = false;
|
||||
THE_STEP_NODE->InternalParameters.ReadName = false;
|
||||
THE_STEP_NODE->InternalParameters.ReadProps = false;
|
||||
~~~~
|
||||
|
||||
@subsection occt_de_wrapper_3_4 Priority of Vendors
|
||||
|
||||
DE session is able to work with several vendors with the same supported CAD format. To choose the preffered vendor for each format, use a special priority list.
|
||||
|
||||
If the high priority vendor's provider is not supported, a transfer operation is needed (write/read), then the next vendor will be chosen.
|
||||
|
||||
@subsubsection occt_de_wrapper_3_4_1 Priority of Vendors. Code sample
|
||||
|
||||
~~~~{.cpp}
|
||||
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
|
||||
TCollection_AsciiString aFormat = "STEP";
|
||||
TColStd_ListOfAsciiString aVendors;
|
||||
aVendors.Appends("OCC"); // high priority
|
||||
aVendors.Appends("DTK");
|
||||
// Flag to disable not choosen vendors, in this case configuration is possible
|
||||
// otherwise, lower their priority and continue to check ability to transfer
|
||||
Standard_Boolean aToDisable = Standard_True;
|
||||
aSession->ChangePriority(aFormat, aVendors, aToDisable);
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_de_wrapper_3_4_2 Priority of Vendors. DRAW Sample
|
||||
|
||||
It is recommended to disable recursion and update only global parameters.
|
||||
~~~~{.cpp}
|
||||
set conf "
|
||||
global.priority.STEP : OCC DTK
|
||||
"
|
||||
LoadConfiguration ${conf} -recursive off
|
||||
~~~~
|
||||
|
||||
@section occt_de_wrapper_4 Transfer of CAD files
|
||||
|
||||
To transfer from a CAD file to OCC or from OCC to a CAD file, it is necessary to use a configured DE_Wrapper object. It can be local, one-time or global. Global configuration of DE_Wrapper propagates to all nodes via transfer. There are two options for transferring: using OCC shape or XCAF document. It is possible to work only with real path to/from the file. Streaming is not supported (yet).
|
||||
|
||||
The format of input/output file is automatically determined by its extension or contents.
|
||||
|
||||
@subsection occt_de_wrapper_4_1 Transfer of CAD files. Code samples
|
||||
|
||||
Reading STEP file to Shape.
|
||||
~~~~{.cpp}
|
||||
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
|
||||
TCollection_AsciiString aPathToFile = "example.stp";
|
||||
TopoDS_Shape aShRes;
|
||||
if (!aSession->Read(aPathToFile, aShRes))
|
||||
{
|
||||
Message::SendFail() << "Error: Can't read file";
|
||||
}
|
||||
~~~~
|
||||
|
||||
Writing Shape to STEP file.
|
||||
~~~~{.cpp}
|
||||
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
|
||||
TCollection_AsciiString aPathToFile = "example.stp";
|
||||
TopoDS_Shape aShFrom = ...;
|
||||
if (!aSession->Write(aPathToFile, aShRes))
|
||||
{
|
||||
Message::SendFail() << "Error: Can't write file";
|
||||
}
|
||||
~~~~
|
||||
|
||||
Reading STEP file into XCAF document.
|
||||
~~~~{.cpp}
|
||||
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
|
||||
TCollection_AsciiString aPathToFile = "example.stp";
|
||||
Handle(TDocStd_Document) aDoc = ...;
|
||||
if (!aSession->Read(aPathToFile, aDoc))
|
||||
{
|
||||
Message::SendFail() << "Error: Can't read file";
|
||||
}
|
||||
~~~~
|
||||
|
||||
Writing XCAF document into STEP.
|
||||
~~~~{.cpp}
|
||||
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
|
||||
TCollection_AsciiString aPathToFile = "example.stp";
|
||||
Handle(TDocStd_Document) aDoc = ...;
|
||||
if (!aSession->Write(aPathToFile, aDoc))
|
||||
{
|
||||
Message::SendFail() << "Error: Can't write file";
|
||||
}
|
||||
~~~~
|
||||
|
||||
@subsection occt_de_wrapper_4_2 Transfer of CAD files. DRAW samples
|
||||
|
||||
Reading a STEP file into a Shape.
|
||||
~~~~{.cpp}
|
||||
set fileName "sample.stp"
|
||||
readfile shape ${fileName}
|
||||
~~~~
|
||||
|
||||
Writing a Shape into STEP.
|
||||
~~~~{.cpp}
|
||||
set fileName "sample.stp"
|
||||
writefile shape ${fileName}
|
||||
~~~~
|
||||
|
||||
Reading STEP into XCAF document.
|
||||
~~~~{.cpp}
|
||||
set fileName "sample.stp"
|
||||
ReadFile D ${fileName}
|
||||
~~~~
|
||||
|
||||
Writing XCAF document into STEP.
|
||||
~~~~{.cpp}
|
||||
set fileName "sample.stp"
|
||||
WriteFile D ${fileName}
|
||||
~~~~
|
||||
|
||||
@subsection occt_de_wrapper_4_3 Transfer using DE Provider. Code sample
|
||||
|
||||
It is possible to read and write CAD files directly from a special provider.
|
||||
|
||||
~~~~{.cpp}
|
||||
// Creating or getting node
|
||||
Handle(STEPCAFControl_ConfigurationNode) aNode = new STEPCAFControl_ConfigurationNode();
|
||||
// Creationg an one-time provider
|
||||
Handle(DE_Provider) aProvider = aNode->BuildProvider();
|
||||
// Setting configuration with all parameters
|
||||
aProvider->SetNode(aNode);
|
||||
if (!aProvider->Read(...))
|
||||
{
|
||||
Message::SendFail() << "Error: Can't read STEP file";
|
||||
}
|
||||
if (!aProvider->Write(...))
|
||||
{
|
||||
Message::SendFail() << "Error: Can't write STEP file";
|
||||
}
|
||||
~~~~
|
||||
|
||||
@subsection occt_de_wrapper_4_4 Temporary configuration via transfer
|
||||
|
||||
It is possible to change the configuration of only one transfer operation. To avoid changing parameters in a session, one-time clone of the session can be created and used for transfer. This way is recommended for use in multithreaded mode.
|
||||
|
||||
@subsubsection occt_de_wrapper_4_4_1 Temporary configuration via transfer. Code sample
|
||||
|
||||
Code sample to configure via transfer.
|
||||
~~~~{.cpp}
|
||||
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper()->Copy();
|
||||
TCollection_AsciiString aString =
|
||||
"global.priority.STEP : OCC DTK\n"
|
||||
"global.general.length.unit : 1\n"
|
||||
"provider.STEP.OCC.read.precision.val : 0.\n";
|
||||
if (!aSession->Load(aString, aIsRecursive))
|
||||
{
|
||||
Message::SendFail() << "Error: configuration is incorrect";
|
||||
}
|
||||
TCollection_AsciiString aPathToFile = "example.stp";
|
||||
TopoDS_Shape aShRes;
|
||||
if (!aSession->Read(aPathToFile, aShRes))
|
||||
{
|
||||
Message::SendFail() << "Error: Can't read file";
|
||||
}
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_de_wrapper_4_4_2 Temporary configuration via transfer. DRAW sample
|
||||
|
||||
Code sample to configure via transfer within DRAW command.
|
||||
~~~~{.cpp}
|
||||
set fileName "sample.stp"
|
||||
readfile S5 $filename -conf "global.general.length.unit : 1000 "
|
||||
~~~~
|
||||
|
||||
Code sample to configure via transfer as variable.
|
||||
~~~~{.cpp}
|
||||
set fileName "sample.stp"
|
||||
set conf "
|
||||
global.priority.STEP : OCC
|
||||
global.general.length.unit : 1
|
||||
provider.STEP.OCC.read.iges.bspline.continuity : 1
|
||||
provider.STEP.OCC.read.precision.mode : 0
|
||||
provider.STEP.OCC.read.precision.val : 0.0001
|
||||
"
|
||||
readfile S5 $filename -conf ${conf}
|
||||
~~~~
|
@@ -1331,7 +1331,7 @@ Therefore if the user of *NCollection* does not specify any allocator as a param
|
||||
Nevertheless, it is possible to define a custom *Allocator* type to manage the memory in the most optimal or convenient way for this algorithm.
|
||||
|
||||
As one possible choice, the class *NCollection_IncAllocator* is included.
|
||||
Unlike *NCollection_BaseAllocator*, the memory is allocated in big blocks (about 20kB) and the allocator keeps track of the amount of occupied memory.
|
||||
Unlike *NCollection_BaseAllocator*, the memory is allocated in big blocks (about 12kB) and the allocator keeps track of the amount of occupied memory.
|
||||
The method *Allocate* just increments the pointer to non-occupied memory and returns its previous value.
|
||||
Memory is only released in the destructor of *NCollection_IncAllocator*, the method *Free* is empty.
|
||||
If used properly, this Allocator can greatly improve the performance of specific algorithms.
|
||||
|
@@ -326,7 +326,8 @@ The <i>Geom2dConvert</i> package provides the following:
|
||||
* a global function which is used to construct a BSpline curve from a bounded curve based on a 2D curve from the Geom2d package,
|
||||
* a splitting algorithm which computes the points at which a 2D BSpline curve should be cut in order to obtain arcs with the same degree of continuity,
|
||||
* global functions used to construct the BSpline curves created by this splitting algorithm, or by other types of segmentation of the BSpline curve,
|
||||
* an algorithm which converts a 2D BSpline curve into a series of adjacent Bezier curves.
|
||||
* an algorithm which converts a 2D BSpline curve into a series of adjacent Bezier curves,
|
||||
* an algorithm which converts an arbitrary 2D curve into a series of adjacent 2D circular arcs and 2D linear segments.
|
||||
|
||||
The <i>GeomConvert</i> package also provides the following:
|
||||
|
||||
|
@@ -13,6 +13,7 @@ OCCT User Guides are organized by OCCT modules:
|
||||
* @subpage occt_user_guides__iges "IGES Translator"
|
||||
* @subpage occt_user_guides__step "STEP Translator"
|
||||
* @subpage occt_user_guides__xde "Extended Data Exchange (XDE)"
|
||||
* @subpage occt_user_guides__de_wrapper "Data Exchange Wrapper (DE Wrapper)"
|
||||
* @subpage occt_user_guides__ocaf "Open CASCADE Application Framework (OCAF)"
|
||||
* @subpage occt_user_guides__test_harness "DRAW Test Harness"
|
||||
* @subpage occt_user_guides__inspector "Inspector"
|
||||
|
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IE_WPF_D3D</RootNamespace>
|
||||
<AssemblyName>IE_WPF_D3D</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
|
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IE_WPF_WinForms</RootNamespace>
|
||||
<AssemblyName>IE_WPF_WinForms</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
|
@@ -27,7 +27,7 @@
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
|
@@ -35,4 +35,4 @@
|
||||
</providers>
|
||||
</roleManager>
|
||||
</system.web>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
|
@@ -55,7 +55,7 @@ void AdaptorCurve2d_AIS::Compute (const Handle(PrsMgr_PresentationManager)&,
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(Geom2dAdaptor_Curve) anAdaptor = new Geom2dAdaptor_Curve(myGeom2dCurve);
|
||||
Geom2dAdaptor_Curve anAdaptor(myGeom2dCurve);
|
||||
GCPnts_QuasiUniformDeflection anEdgeDistrib(anAdaptor, 1.e-2);
|
||||
if (anEdgeDistrib.IsDone())
|
||||
{
|
||||
@@ -72,9 +72,9 @@ void AdaptorCurve2d_AIS::Compute (const Handle(PrsMgr_PresentationManager)&,
|
||||
|
||||
if (myDisplayPole)
|
||||
{
|
||||
if (anAdaptor->GetType() == GeomAbs_BezierCurve)
|
||||
if (anAdaptor.GetType() == GeomAbs_BezierCurve)
|
||||
{
|
||||
Handle(Geom2d_BezierCurve) aBezier = anAdaptor->Bezier();
|
||||
Handle(Geom2d_BezierCurve) aBezier = anAdaptor.Bezier();
|
||||
Handle(Graphic3d_ArrayOfPolylines) anArrayOfVertex = new Graphic3d_ArrayOfPolylines(aBezier->NbPoles());
|
||||
for (int i = 1; i <= aBezier->NbPoles(); i++)
|
||||
{
|
||||
@@ -87,9 +87,9 @@ void AdaptorCurve2d_AIS::Compute (const Handle(PrsMgr_PresentationManager)&,
|
||||
aPrsGroup->AddPrimitiveArray(anArrayOfVertex);
|
||||
}
|
||||
|
||||
if (anAdaptor->GetType() == GeomAbs_BSplineCurve)
|
||||
if (anAdaptor.GetType() == GeomAbs_BSplineCurve)
|
||||
{
|
||||
Handle(Geom2d_BSplineCurve) aBSpline = anAdaptor->BSpline();
|
||||
Handle(Geom2d_BSplineCurve) aBSpline = anAdaptor.BSpline();
|
||||
Handle(Graphic3d_ArrayOfPolylines) anArrayOfVertex = new Graphic3d_ArrayOfPolylines(aBSpline->NbPoles());
|
||||
for (int i = 1; i <= aBSpline->NbPoles(); i++)
|
||||
{
|
||||
@@ -103,11 +103,11 @@ void AdaptorCurve2d_AIS::Compute (const Handle(PrsMgr_PresentationManager)&,
|
||||
}
|
||||
}
|
||||
|
||||
if (myDisplayCurbure && (anAdaptor->GetType() != GeomAbs_Line))
|
||||
if (myDisplayCurbure && (anAdaptor.GetType() != GeomAbs_Line))
|
||||
{
|
||||
const Standard_Integer nbintv = anAdaptor->NbIntervals(GeomAbs_CN);
|
||||
const Standard_Integer nbintv = anAdaptor.NbIntervals(GeomAbs_CN);
|
||||
TColStd_Array1OfReal TI(1, nbintv + 1);
|
||||
anAdaptor->Intervals(TI, GeomAbs_CN);
|
||||
anAdaptor.Intervals(TI, GeomAbs_CN);
|
||||
Standard_Real Resolution = 1.0e-9, Curvature;
|
||||
Geom2dLProp_CLProps2d LProp(myGeom2dCurve, 2, Resolution);
|
||||
gp_Pnt2d P1, P2;
|
||||
|
@@ -30,7 +30,7 @@ void AdaptorCurve_AIS::Compute (const Handle(PrsMgr_PresentationManager)&,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
Handle(GeomAdaptor_Curve) anAdaptorCurve = new GeomAdaptor_Curve(myCurve);
|
||||
GeomAdaptor_Curve anAdaptorCurve(myCurve);
|
||||
switch (theMode)
|
||||
{
|
||||
case 1:
|
||||
|
@@ -1840,7 +1840,7 @@ void GeometrySamples::BoundingBoxOfSurface3dSample()
|
||||
|
||||
// Compute BSpline surface bounding box.
|
||||
Bnd_Box aBndBox;
|
||||
BndLib_AddSurface::AddOptimal(new GeomAdaptor_Surface(aBSplineSurf), Precision::Confusion(), aBndBox);
|
||||
BndLib_AddSurface::AddOptimal(GeomAdaptor_Surface(aBSplineSurf), Precision::Confusion(), aBndBox);
|
||||
myResult << "Bounding box:" << std::endl;
|
||||
myResult << " Min corner = [ "
|
||||
<< aBndBox.CornerMin().X() << ", "
|
||||
@@ -1881,7 +1881,7 @@ void GeometrySamples::BoundingBoxOfCurves3dSample()
|
||||
|
||||
// Compute BSpline curve bounding box.
|
||||
Bnd_Box aBndBox;
|
||||
BndLib_Add3dCurve::AddOptimal(new GeomAdaptor_Curve(aBSplineCurve), Precision::Confusion(), aBndBox);
|
||||
BndLib_Add3dCurve::AddOptimal(GeomAdaptor_Curve(aBSplineCurve), Precision::Confusion(), aBndBox);
|
||||
myResult << "Bounding box:" << std::endl;
|
||||
myResult << " Min corner = [ "
|
||||
<< aBndBox.CornerMin().X() << ", "
|
||||
|
@@ -102,7 +102,7 @@ void Sample2D_Face::FillData(Standard_Boolean isSizesRecompute)
|
||||
for (TopExp_Explorer anEdgeIter (myshape, TopAbs_EDGE); anEdgeIter.More(); anEdgeIter.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgeIter.Current());
|
||||
Handle(BRepAdaptor_Curve2d) aCurveOnEdge = new BRepAdaptor_Curve2d(anEdge, aFace);
|
||||
BRepAdaptor_Curve2d aCurveOnEdge (anEdge, aFace);
|
||||
GCPnts_QuasiUniformDeflection anEdgeDistrib(aCurveOnEdge, 1.e-2);
|
||||
if (!anEdgeDistrib.IsDone())
|
||||
{
|
||||
@@ -153,7 +153,7 @@ void Sample2D_Face::FillData(Standard_Boolean isSizesRecompute)
|
||||
if (!aTrimmedCurve.IsNull())
|
||||
{
|
||||
Handle(Geom_Curve) aCurve3d = GeomLib::To3d(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), aTrimmedCurve);
|
||||
Handle(BRepAdaptor_Curve2d) aCurveOnEdge = new BRepAdaptor_Curve2d(anEdge, aFace);
|
||||
BRepAdaptor_Curve2d aCurveOnEdge (anEdge, aFace);
|
||||
GCPnts_QuasiUniformDeflection anEdgeDistrib (aCurveOnEdge, 1.e-2);
|
||||
if (!anEdgeDistrib.IsDone())
|
||||
{
|
||||
@@ -253,7 +253,7 @@ void Sample2D_Face::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
// make a 3D curve from 2D trimmed curve to display it
|
||||
Handle(Geom_Curve) aCurve3d = GeomLib::To3d(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), aTrimmedCurve);
|
||||
// make distribution of points
|
||||
Handle(BRepAdaptor_Curve2d) aCurveOnEdge = new BRepAdaptor_Curve2d(anEdge, aFace);
|
||||
BRepAdaptor_Curve2d aCurveOnEdge (anEdge, aFace);
|
||||
GCPnts_QuasiUniformDeflection anEdgeDistrib(aCurveOnEdge, 1.e-2);
|
||||
if (anEdgeDistrib.IsDone())
|
||||
{
|
||||
|
@@ -4,7 +4,6 @@ project(glfw-occt-demo)
|
||||
|
||||
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/adm/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(APP_VERSION_MAJOR 1)
|
||||
set(APP_VERSION_MINOR 0)
|
||||
set(APP_TARGET glfwocct)
|
||||
|
@@ -39,9 +39,9 @@ elseif (DEFINED CMAKE_COMPILER_IS_GNUCC)
|
||||
set (MY_COMPILER gcc)
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (MY_COMPILER gcc)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
set (MY_COMPILER clang)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
|
||||
set (MY_COMPILER icc)
|
||||
else()
|
||||
set (MY_COMPILER ${CMAKE_GENERATOR})
|
||||
|
@@ -37,7 +37,7 @@ list(APPEND aLibDeps lib_FreeType)
|
||||
# system libraries
|
||||
list(APPEND aLibDeps EGL GLESv2 log android)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -frtti -fexceptions -fpermissive")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -frtti -fexceptions -fpermissive")
|
||||
|
||||
add_library(TKJniSample SHARED ${SOURCE_FILES})
|
||||
target_link_libraries(TKJniSample ${aLibDeps})
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (Geometry)
|
||||
|
||||
|
@@ -655,7 +655,7 @@ void GeomSources::gpTest9(CGeometryDoc* aDoc)
|
||||
Standard_Real radius = 5;
|
||||
Handle(Geom2d_Circle) C =
|
||||
new Geom2d_Circle(gp::OX2d(),radius);
|
||||
Handle(Geom2dAdaptor_Curve) GAC = new Geom2dAdaptor_Curve(C);
|
||||
Geom2dAdaptor_Curve GAC (C);
|
||||
Standard_Real startparam = 10*M_PI/180;
|
||||
Standard_Real abscissa = 45*M_PI/180;
|
||||
gp_Pnt2d P1;
|
||||
@@ -668,23 +668,23 @@ void GeomSources::gpTest9(CGeometryDoc* aDoc)
|
||||
|
||||
//==============================================================
|
||||
TCollection_AsciiString Message (" \n\
|
||||
\n\
|
||||
\n\
|
||||
Standard_Real radius = 5; \n\
|
||||
Handle(Geom2d_Circle) C = \n\
|
||||
new Geom2d_Circle(gp::OX2d(),radius); \n\
|
||||
Handle(Geom2dAdaptor_Curve) GAC = new Geom2dAdaptor_Curve(C); \n\
|
||||
Standard_Real startparam = 10*PI180; \n\
|
||||
Standard_Real abscissa = 45*PI180; \n\
|
||||
gp_Pnt2d P1; \n\
|
||||
C->D0(startparam,P1); \n\
|
||||
// abscissa is the distance along the curve from startparam \n\
|
||||
GCPnts_AbscissaPoint AP (GAC, abscissa, startparam); \n\
|
||||
gp_Pnt2d P2; \n\
|
||||
if (AP.IsDone()){C->D0(AP.Parameter(),P2);} \n\
|
||||
// P is now correctly set \n\
|
||||
\n\
|
||||
\n");
|
||||
\n\
|
||||
\n\
|
||||
Standard_Real radius = 5; \n\
|
||||
Handle(Geom2d_Circle) C = \n\
|
||||
new Geom2d_Circle(gp::OX2d(),radius); \n\
|
||||
Geom2dAdaptor_Curve GAC (C); \n\
|
||||
Standard_Real startparam = 10*PI180; \n\
|
||||
Standard_Real abscissa = 45*PI180; \n\
|
||||
gp_Pnt2d P1; \n\
|
||||
C->D0(startparam,P1); \n\
|
||||
// abscissa is the distance along the curve from startparam \n\
|
||||
GCPnts_AbscissaPoint AP (GAC, abscissa, startparam); \n\
|
||||
gp_Pnt2d P2; \n\
|
||||
if (AP.IsDone()){C->D0(AP.Parameter(),P2);} \n\
|
||||
// P is now correctly set \n\
|
||||
\n\
|
||||
\n");
|
||||
AddSeparator(aDoc,Message);
|
||||
//--------------------------------------------------------------
|
||||
Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(C);
|
||||
@@ -723,7 +723,7 @@ void GeomSources::gpTest10(CGeometryDoc* aDoc)
|
||||
Standard_Real radius = 5;
|
||||
Handle(Geom2d_Circle) C =
|
||||
new Geom2d_Circle(gp::OX2d(),radius);
|
||||
Handle(Geom2dAdaptor_Curve) GAC = new Geom2dAdaptor_Curve(C);
|
||||
Geom2dAdaptor_Curve GAC (C);
|
||||
Standard_Real abscissa = 3;
|
||||
GCPnts_UniformAbscissa UA (GAC,abscissa);
|
||||
TColgp_SequenceOfPnt2d aSequence;
|
||||
@@ -743,29 +743,29 @@ void GeomSources::gpTest10(CGeometryDoc* aDoc)
|
||||
|
||||
//==============================================================
|
||||
TCollection_AsciiString Message (" \
|
||||
\n\
|
||||
gp_Pnt2d P; \n\
|
||||
Standard_Real radius = 5; \n\
|
||||
Handle(Geom2d_Circle) C = \n\
|
||||
new Geom2d_Circle(gp::OX2d(),radius); \n\
|
||||
Handle(Geom2dAdaptor_Curve) GAC = new Geom2dAdaptor_Curve(C); \n\
|
||||
Standard_Real abscissa = 3; \n\
|
||||
GCPnts_UniformAbscissa UA (GAC,abscissa); \n\
|
||||
TColgp_SequenceOfPnt2d aSequence; \n\
|
||||
if (UA.IsDone()) \n\
|
||||
{ \n\
|
||||
Standard_Real N = UA.NbPoints(); \n\
|
||||
Standard_Integer count = 1; \n\
|
||||
for(;count<=N;count++) \n\
|
||||
{ \n\
|
||||
C->D0(UA.Parameter(count),P); \n\
|
||||
Standard_Real Parameter = UA.Parameter(count); \n\
|
||||
// append P in a Sequence \n\
|
||||
aSequence.Append(P); \n\
|
||||
} \n\
|
||||
} \n\
|
||||
Standard_Real Abscissa = UA.Abscissa(); \n\
|
||||
\n");
|
||||
\n\
|
||||
gp_Pnt2d P; \n\
|
||||
Standard_Real radius = 5; \n\
|
||||
Handle(Geom2d_Circle) C = \n\
|
||||
new Geom2d_Circle(gp::OX2d(),radius); \n\
|
||||
Geom2dAdaptor_Curve GAC (C); \n\
|
||||
Standard_Real abscissa = 3; \n\
|
||||
GCPnts_UniformAbscissa UA (GAC,abscissa); \n\
|
||||
TColgp_SequenceOfPnt2d aSequence; \n\
|
||||
if (UA.IsDone()) \n\
|
||||
{ \n\
|
||||
Standard_Real N = UA.NbPoints(); \n\
|
||||
Standard_Integer count = 1; \n\
|
||||
for(;count<=N;count++) \n\
|
||||
{ \n\
|
||||
C->D0(UA.Parameter(count),P); \n\
|
||||
Standard_Real Parameter = UA.Parameter(count); \n\
|
||||
// append P in a Sequence \n\
|
||||
aSequence.Append(P); \n\
|
||||
} \n\
|
||||
} \n\
|
||||
Standard_Real Abscissa = UA.Abscissa(); \n\
|
||||
\n");
|
||||
AddSeparator(aDoc,Message);
|
||||
//--------------------------------------------------------------
|
||||
Handle(ISession2D_Curve) aCurve = new ISession2D_Curve(C);
|
||||
@@ -3895,21 +3895,21 @@ void GeomSources::gpTest48(CGeometryDoc* aDoc)
|
||||
Handle(Geom2d_BSplineCurve) SPL2 = anInterpolation.Curve();
|
||||
|
||||
Bnd_Box2d aCBox;
|
||||
Handle(Geom2dAdaptor_Curve) GACC = new Geom2dAdaptor_Curve(C);
|
||||
Geom2dAdaptor_Curve GACC (C);
|
||||
BndLib_Add2dCurve::Add (GACC,Precision::Approximation(),aCBox);
|
||||
|
||||
Standard_Real aCXmin, aCYmin, aCXmax, aCYmax;
|
||||
aCBox.Get( aCXmin, aCYmin, aCXmax,aCYmax);
|
||||
|
||||
Bnd_Box2d aSPL1Box;
|
||||
Handle(Geom2dAdaptor_Curve) GAC1 = new Geom2dAdaptor_Curve(SPL1);
|
||||
Geom2dAdaptor_Curve GAC1 (SPL1);
|
||||
BndLib_Add2dCurve::Add (GAC1,Precision::Approximation(),aSPL1Box);
|
||||
|
||||
Standard_Real aSPL1Xmin,aSPL1Ymin,aSPL1Xmax,aSPL1Ymax;
|
||||
aSPL1Box.Get( aSPL1Xmin, aSPL1Ymin, aSPL1Xmax,aSPL1Ymax);
|
||||
|
||||
Bnd_Box2d aSPL2Box;
|
||||
Handle(Geom2dAdaptor_Curve) GAC2 = new Geom2dAdaptor_Curve(SPL2);
|
||||
Geom2dAdaptor_Curve GAC2 (SPL2);
|
||||
BndLib_Add2dCurve::Add (GAC2,Precision::Approximation(),aSPL2Box);
|
||||
|
||||
Standard_Real aSPL2Xmin,aSPL2Ymin,aSPL2Xmax,aSPL2Ymax;
|
||||
@@ -3930,14 +3930,14 @@ Handle(Geom2d_BSplineCurve) SPL1 ; // SPL1 = ... \n\
|
||||
Handle(Geom2d_BSplineCurve) SPL2 ; // SPL2 = ... \n\
|
||||
\n\
|
||||
Bnd_Box2d aCBox; \n\
|
||||
Handle(Geom2dAdaptor_Curve) GACC = new Geom2dAdaptor_Curve(C); \n\
|
||||
Geom2dAdaptor_Curve GACC (C); \n\
|
||||
BndLib_Add2dCurve::Add (GACC,Precision::Approximation(),aCBox); \n\
|
||||
\n\
|
||||
Standard_Real aCXmin, aCYmin, aCXmax, aCYmax; \n\
|
||||
aCBox.Get( aCXmin, aCYmin, aCXmax,aCYmax); \n\
|
||||
\n\
|
||||
Bnd_Box2d aSPL1Box; \n\
|
||||
Handle(Geom2dAdaptor_Curve) GAC1 = new Geom2dAdaptor_Curve(SPL1); \n\
|
||||
Geom2dAdaptor_Curve GAC1 (SPL1); \n\
|
||||
BndLib_Add2dCurve::Add (GAC1,Precision::Approximation(),aSPL1Box); \n\
|
||||
\n\
|
||||
Standard_Real aSPL1Xmin,aSPL1Ymin,aSPL1Xmax,aSPL1Ymax; \n\
|
||||
@@ -3945,7 +3945,7 @@ aSPL1Box.Get( aSPL1Xmin, aSPL1Ymin, aSPL1Xmax,aSPL1Ymax); \n");
|
||||
Message += "\
|
||||
\n\
|
||||
Bnd_Box2d aSPL2Box; \n\
|
||||
Handle(Geom2dAdaptor_Curve) GAC2 = new Geom2dAdaptor_Curve(SPL2); \n\
|
||||
Geom2dAdaptor_Curve GAC2 (SPL2); \n\
|
||||
BndLib_Add2dCurve::Add (GAC2,Precision::Approximation(),aSPL2Box); \n\
|
||||
\n\
|
||||
Standard_Real aSPL2Xmin,aSPL2Ymin,aSPL2Xmax,aSPL2Ymax; \n\
|
||||
@@ -4005,7 +4005,7 @@ void GeomSources::gpTest49(CGeometryDoc* aDoc)
|
||||
|
||||
Handle(Geom_Circle) C =
|
||||
new Geom_Circle(anAxis,radius);
|
||||
Handle(GeomAdaptor_Curve) GAC = new GeomAdaptor_Curve(C);
|
||||
GeomAdaptor_Curve GAC (C);
|
||||
BndLib_Add3dCurve::Add (GAC,Precision::Approximation(),aBox);
|
||||
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax ;
|
||||
@@ -4021,7 +4021,7 @@ gp_Ax2 anAxis(gp_Pnt(0,0,0),gp_Dir(1,2,-5)); \n\
|
||||
\n\
|
||||
Handle(Geom_Circle) C = \n\
|
||||
new Geom_Circle(anAxis,radius); \n\
|
||||
Handle(GeomAdaptor_Curve) GAC = new GeomAdaptor_Curve(C); \n\
|
||||
GeomAdaptor_Curve GAC (C); \n\
|
||||
BndLib_Add3dCurve::Add (GAC,Precision::Approximation(),aBox); \n\
|
||||
\n\
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax ; \n\
|
||||
@@ -4097,7 +4097,7 @@ void GeomSources::gpTest50(CGeometryDoc* aDoc)
|
||||
GeomFill_FillingStyle Type = GeomFill_StretchStyle;
|
||||
GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type);
|
||||
Handle(Geom_BSplineSurface) aSurf = aGeomFill1.Surface();
|
||||
Handle(GeomAdaptor_Surface) GAS = new GeomAdaptor_Surface(aSurf);
|
||||
GeomAdaptor_Surface GAS (aSurf);
|
||||
Bnd_Box aBox;
|
||||
BndLib_AddSurface::Add (GAS,Precision::Approximation(),aBox);
|
||||
|
||||
@@ -4122,19 +4122,19 @@ array2.SetValue(2,gp_Pnt (-20, 20, 0)); \n\
|
||||
array2.SetValue(3,gp_Pnt ( 20, 30,-10)); \n\
|
||||
array2.SetValue(4,gp_Pnt ( 30, 70,-20)); \n\
|
||||
array2.SetValue(5,gp_Pnt ( 40, 90,-10)); \n\
|
||||
Handle(Geom_BSplineCurve) SPL2 = \n\
|
||||
Handle(Geom_BSplineCurve) SPL2 = \n\
|
||||
GeomAPI_PointsToBSpline(array2).Curve(); \n\
|
||||
\n\
|
||||
GeomFill_FillingStyle Type = GeomFill_StretchStyle; \n\
|
||||
GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type); \n\
|
||||
Handle(Geom_BSplineSurface) aSurf = aGeomFill1.Surface(); \n\
|
||||
Handle(GeomAdaptor_Surface) GAS = new GeomAdaptor_Surface(aSurf); \n\
|
||||
Bnd_Box aBox; \n\
|
||||
BndLib_AddSurface::Add (GAS,Precision::Approximation(),aBox); \n\
|
||||
\n\
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax ; \n\
|
||||
aBox.Get( aXmin, aYmin,aZmin, aXmax,aYmax,aZmax); \n\
|
||||
\n");
|
||||
\n\
|
||||
GeomFill_FillingStyle Type = GeomFill_StretchStyle; \n\
|
||||
GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type); \n\
|
||||
Handle(Geom_BSplineSurface) aSurf = aGeomFill1.Surface(); \n\
|
||||
GeomAdaptor_Surface GAS (aSurf); \n\
|
||||
Bnd_Box aBox; \n\
|
||||
BndLib_AddSurface::Add (GAS,Precision::Approximation(),aBox); \n\
|
||||
\n\
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax ; \n\
|
||||
aBox.Get( aXmin, aYmin,aZmin, aXmax,aYmax,aZmax); \n\
|
||||
\n");
|
||||
AddSeparator(aDoc,Message);
|
||||
//--------------------------------------------------------------
|
||||
|
||||
|
@@ -34,7 +34,7 @@ void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager)& ,
|
||||
aPrsGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
|
||||
aPrsGroup->SetGroupPrimitivesAspect (myDrawer->PointAspect()->Aspect());
|
||||
|
||||
Handle(Geom2dAdaptor_Curve) anAdaptor = new Geom2dAdaptor_Curve(myGeom2dCurve);
|
||||
Geom2dAdaptor_Curve anAdaptor(myGeom2dCurve);
|
||||
GCPnts_QuasiUniformDeflection anEdgeDistrib(anAdaptor,1.e-2);
|
||||
if(anEdgeDistrib.IsDone())
|
||||
{
|
||||
@@ -48,9 +48,9 @@ void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager)& ,
|
||||
|
||||
if (myDisplayPole)
|
||||
{
|
||||
if (anAdaptor->GetType() == GeomAbs_BezierCurve )
|
||||
if (anAdaptor.GetType() == GeomAbs_BezierCurve )
|
||||
{
|
||||
Handle(Geom2d_BezierCurve) aBezier = anAdaptor->Bezier();
|
||||
Handle(Geom2d_BezierCurve) aBezier = anAdaptor.Bezier();
|
||||
Handle(Graphic3d_ArrayOfPolylines) anArrayOfVertex = new Graphic3d_ArrayOfPolylines(aBezier->NbPoles());
|
||||
for(int i=1;i<=aBezier->NbPoles();i++)
|
||||
{
|
||||
@@ -60,9 +60,9 @@ void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager)& ,
|
||||
aPrsGroup->AddPrimitiveArray (anArrayOfVertex);
|
||||
}
|
||||
|
||||
if (anAdaptor->GetType() == GeomAbs_BSplineCurve )
|
||||
if (anAdaptor.GetType() == GeomAbs_BSplineCurve )
|
||||
{
|
||||
Handle(Geom2d_BSplineCurve) aBSpline = anAdaptor->BSpline();
|
||||
Handle(Geom2d_BSplineCurve) aBSpline = anAdaptor.BSpline();
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) anArrayOfVertex =
|
||||
new Graphic3d_ArrayOfPolylines(aBSpline->NbPoles());
|
||||
@@ -76,12 +76,12 @@ void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager)& ,
|
||||
}
|
||||
}
|
||||
|
||||
if (myDisplayCurbure && (anAdaptor->GetType() != GeomAbs_Line))
|
||||
if (myDisplayCurbure && (anAdaptor.GetType() != GeomAbs_Line))
|
||||
{
|
||||
Standard_Integer ii;
|
||||
Standard_Integer intrv, nbintv = anAdaptor->NbIntervals(GeomAbs_CN);
|
||||
Standard_Integer intrv, nbintv = anAdaptor.NbIntervals(GeomAbs_CN);
|
||||
TColStd_Array1OfReal TI(1,nbintv+1);
|
||||
anAdaptor->Intervals(TI,GeomAbs_CN);
|
||||
anAdaptor.Intervals(TI,GeomAbs_CN);
|
||||
Standard_Real Resolution = 1.0e-9, Curvature;
|
||||
Geom2dLProp_CLProps2d LProp(myGeom2dCurve, 2, Resolution);
|
||||
gp_Pnt2d P1, P2;
|
||||
|
@@ -18,7 +18,7 @@ void ISession_Curve::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
Handle(GeomAdaptor_Curve) anAdaptorCurve = new GeomAdaptor_Curve(myCurve);
|
||||
GeomAdaptor_Curve anAdaptorCurve (myCurve);
|
||||
switch (theMode)
|
||||
{
|
||||
case 1:
|
||||
|
@@ -22,7 +22,8 @@ void ISession_Surface::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
Handle(GeomAdaptor_Surface) anAdaptorSurface = new GeomAdaptor_Surface (mySurface);
|
||||
GeomAdaptor_Surface anAdaptorSurface (mySurface);
|
||||
Handle(GeomAdaptor_Surface) anAdaptorHSurface = new GeomAdaptor_Surface (mySurface);
|
||||
|
||||
Handle(Prs3d_Drawer) aPoleDrawer = new Prs3d_Drawer();
|
||||
aPoleDrawer->SetOwnLineAspects();
|
||||
@@ -40,7 +41,7 @@ void ISession_Surface::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
StdPrs_WFSurface::Add (thePrs, anAdaptorSurface, myDrawer);
|
||||
StdPrs_WFSurface::Add (thePrs, anAdaptorHSurface, myDrawer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (Modeling)
|
||||
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (ImportExport)
|
||||
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (HLR)
|
||||
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (mfcsample)
|
||||
|
||||
|
@@ -221,7 +221,7 @@ Handle(TopTools_HSequenceOfShape) Translate::importModel( const int format, cons
|
||||
shapes = importSTEP( file );
|
||||
break;
|
||||
}
|
||||
} catch ( Standard_Failure ) {
|
||||
} catch ( const Standard_Failure& ) {
|
||||
shapes.Nullify();
|
||||
}
|
||||
return shapes;
|
||||
@@ -256,7 +256,7 @@ bool Translate::exportModel( const int format, const QString& file, const Handle
|
||||
case FormatSTL: return exportSTL ( file, shapes );
|
||||
case FormatVRML: return exportVRML( file, shapes );
|
||||
}
|
||||
} catch ( Standard_Failure ) {
|
||||
} catch ( const Standard_Failure& ) {
|
||||
//
|
||||
}
|
||||
return false;
|
||||
@@ -528,26 +528,26 @@ bool Translate::exportSTL( const QString& file, const Handle(TopTools_HSequenceO
|
||||
if ( shapes.IsNull() || shapes->IsEmpty() )
|
||||
return false;
|
||||
|
||||
TopoDS_Compound res;
|
||||
BRep_Builder builder;
|
||||
builder.MakeCompound( res );
|
||||
TopoDS_Compound res;
|
||||
BRep_Builder builder;
|
||||
builder.MakeCompound( res );
|
||||
|
||||
for ( int i = 1; i <= shapes->Length(); i++ )
|
||||
{
|
||||
TopoDS_Shape shape = shapes->Value( i );
|
||||
if ( shape.IsNull() )
|
||||
{
|
||||
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
|
||||
return false;
|
||||
for ( int i = 1; i <= shapes->Length(); i++ )
|
||||
{
|
||||
TopoDS_Shape shape = shapes->Value( i );
|
||||
if ( shape.IsNull() )
|
||||
{
|
||||
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
|
||||
return false;
|
||||
}
|
||||
builder.Add( res, shape );
|
||||
}
|
||||
builder.Add( res, shape );
|
||||
}
|
||||
|
||||
StlAPI_Writer writer;
|
||||
|
||||
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
|
||||
|
||||
writer.Write( res, anUtf8Path.ToCString() );
|
||||
StlAPI_Writer writer;
|
||||
|
||||
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
|
||||
|
||||
writer.Write( res, anUtf8Path.ToCString() );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -557,26 +557,26 @@ bool Translate::exportVRML( const QString& file, const Handle(TopTools_HSequence
|
||||
if ( shapes.IsNull() || shapes->IsEmpty() )
|
||||
return false;
|
||||
|
||||
TopoDS_Compound res;
|
||||
BRep_Builder builder;
|
||||
builder.MakeCompound( res );
|
||||
TopoDS_Compound res;
|
||||
BRep_Builder builder;
|
||||
builder.MakeCompound( res );
|
||||
|
||||
for ( int i = 1; i <= shapes->Length(); i++ )
|
||||
{
|
||||
TopoDS_Shape shape = shapes->Value( i );
|
||||
if ( shape.IsNull() )
|
||||
{
|
||||
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
|
||||
return false;
|
||||
for ( int i = 1; i <= shapes->Length(); i++ )
|
||||
{
|
||||
TopoDS_Shape shape = shapes->Value( i );
|
||||
if ( shape.IsNull() )
|
||||
{
|
||||
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
|
||||
return false;
|
||||
}
|
||||
builder.Add( res, shape );
|
||||
}
|
||||
builder.Add( res, shape );
|
||||
}
|
||||
|
||||
VrmlAPI_Writer writer;
|
||||
|
||||
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
|
||||
|
||||
writer.Write( res, anUtf8Path.ToCString() );
|
||||
VrmlAPI_Writer writer;
|
||||
|
||||
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
|
||||
|
||||
writer.Write( res, anUtf8Path.ToCString() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
project(occt-webgl-sample)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(APP_VERSION_MAJOR 1)
|
||||
set(APP_VERSION_MINOR 0)
|
||||
set(APP_TARGET occt-webgl-sample)
|
||||
|
@@ -251,7 +251,9 @@ void AIS_Animation::Stop()
|
||||
myState = AnimationState_Stopped;
|
||||
if (!myTimer.IsNull())
|
||||
{
|
||||
const Standard_Real anElapsedTime = ElapsedTime();
|
||||
myTimer->Stop();
|
||||
myTimer->Seek (Min (Duration(), anElapsedTime));
|
||||
}
|
||||
|
||||
for (NCollection_Sequence<Handle(AIS_Animation)>::Iterator anIter (myAnimations); anIter.More(); anIter.Next())
|
||||
|
51
src/AIS/AIS_AnimationAxisRotation.cxx
Normal file
51
src/AIS/AIS_AnimationAxisRotation.cxx
Normal file
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) 2023 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_AnimationAxisRotation.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_AnimationAxisRotation, AIS_BaseAnimationObject)
|
||||
|
||||
//=============================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
AIS_AnimationAxisRotation::AIS_AnimationAxisRotation (const TCollection_AsciiString& theAnimationName,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const Handle(AIS_InteractiveObject)& theObject,
|
||||
const gp_Ax1& theAxis,
|
||||
const Standard_Real theAngleStart,
|
||||
const Standard_Real theAngleEnd)
|
||||
: AIS_BaseAnimationObject (theAnimationName, theContext, theObject),
|
||||
myRotAxis (theAxis),
|
||||
myAngleStart (theAngleStart),
|
||||
myAngleEnd (theAngleEnd)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : update
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void AIS_AnimationAxisRotation::update (const AIS_AnimationProgress& theProgress)
|
||||
{
|
||||
if (myObject.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Trsf aTrsf;
|
||||
Standard_Real aCurrentAngle = (1.0 - theProgress.LocalNormalized) * myAngleStart + theProgress.LocalNormalized * myAngleEnd;
|
||||
aTrsf.SetRotation (myRotAxis, aCurrentAngle);
|
||||
updateTrsf (aTrsf);
|
||||
}
|
53
src/AIS/AIS_AnimationAxisRotation.hxx
Normal file
53
src/AIS/AIS_AnimationAxisRotation.hxx
Normal file
@@ -0,0 +1,53 @@
|
||||
// Copyright (c) 2023 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_AnimationAxisRotation_HeaderFile
|
||||
#define _AIS_AnimationAxisRotation_HeaderFile
|
||||
|
||||
#include <AIS_BaseAnimationObject.hxx>
|
||||
#include <gp_TrsfNLerp.hxx>
|
||||
|
||||
//! Animation defining object transformation.
|
||||
class AIS_AnimationAxisRotation : public AIS_BaseAnimationObject
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_AnimationAxisRotation, AIS_BaseAnimationObject)
|
||||
public:
|
||||
|
||||
//! Constructor with initialization.
|
||||
//! @param[in] theAnimationName animation identifier
|
||||
//! @param[in] theContext interactive context where object have been displayed
|
||||
//! @param[in] theObject object to apply rotation
|
||||
//! @param[in] theAxis rotation axis
|
||||
//! @param[in] theAngleStart rotation angle at the start of animation
|
||||
//! @param[in] theAngleEnd rotation angle at the end of animation
|
||||
Standard_EXPORT AIS_AnimationAxisRotation (const TCollection_AsciiString& theAnimationName,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const Handle(AIS_InteractiveObject)& theObject,
|
||||
const gp_Ax1& theAxis,
|
||||
const Standard_Real theAngleStart,
|
||||
const Standard_Real theAngleEnd);
|
||||
|
||||
protected:
|
||||
|
||||
//! Update the progress.
|
||||
Standard_EXPORT virtual void update (const AIS_AnimationProgress& theProgress) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
gp_Ax1 myRotAxis; //!< rotation axis
|
||||
Standard_Real myAngleStart; //!< start angle for rotation
|
||||
Standard_Real myAngleEnd; //!< end angle for rotation
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_AnimationAxisRotation_HeaderFile
|
@@ -14,10 +14,7 @@
|
||||
|
||||
#include <AIS_AnimationObject.hxx>
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_AnimationObject, AIS_Animation)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_AnimationObject, AIS_BaseAnimationObject)
|
||||
|
||||
//=============================================================================
|
||||
//function : Constructor
|
||||
@@ -28,9 +25,7 @@ AIS_AnimationObject::AIS_AnimationObject (const TCollection_AsciiString& theAnim
|
||||
const Handle(AIS_InteractiveObject)& theObject,
|
||||
const gp_Trsf& theTrsfStart,
|
||||
const gp_Trsf& theTrsfEnd)
|
||||
: AIS_Animation (theAnimationName),
|
||||
myContext (theContext),
|
||||
myObject (theObject),
|
||||
: AIS_BaseAnimationObject (theAnimationName, theContext, theObject),
|
||||
myTrsfLerp (theTrsfStart, theTrsfEnd)
|
||||
{
|
||||
//
|
||||
@@ -49,52 +44,5 @@ void AIS_AnimationObject::update (const AIS_AnimationProgress& theProgress)
|
||||
|
||||
gp_Trsf aTrsf;
|
||||
myTrsfLerp.Interpolate (theProgress.LocalNormalized, aTrsf);
|
||||
if (!myContext.IsNull())
|
||||
{
|
||||
myContext->SetLocation (myObject, aTrsf);
|
||||
invalidateViewer();
|
||||
}
|
||||
else
|
||||
{
|
||||
myObject->SetLocalTransformation (aTrsf);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : invalidateViewer
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void AIS_AnimationObject::invalidateViewer()
|
||||
{
|
||||
if (myContext.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Boolean isImmediate = myContext->CurrentViewer()->ZLayerSettings (myObject->ZLayer()).IsImmediate();
|
||||
if (!isImmediate)
|
||||
{
|
||||
myContext->CurrentViewer()->Invalidate();
|
||||
return;
|
||||
}
|
||||
|
||||
// Invalidate immediate view only if it is going out of z-fit range.
|
||||
// This might be sub-optimal performing this for each animated objects in case of many animated objects.
|
||||
for (V3d_ListOfView::Iterator aDefViewIter = myContext->CurrentViewer()->DefinedViewIterator();
|
||||
aDefViewIter.More(); aDefViewIter.Next())
|
||||
{
|
||||
const Handle(V3d_View)& aView = aDefViewIter.Value();
|
||||
const Bnd_Box aMinMaxBox = aView->View()->MinMaxValues (Standard_False);
|
||||
const Bnd_Box aGraphicBox = aView->View()->MinMaxValues (Standard_True);
|
||||
Standard_Real aZNear = 0.0;
|
||||
Standard_Real aZFar = 0.0;
|
||||
if (aView->Camera()->ZFitAll (aDefViewIter.Value()->AutoZFitScaleFactor(), aMinMaxBox, aGraphicBox, aZNear, aZFar))
|
||||
{
|
||||
if (aZNear < aView->Camera()->ZNear()
|
||||
|| aZFar > aView->Camera()->ZFar())
|
||||
{
|
||||
aDefViewIter.Value()->Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
updateTrsf (aTrsf);
|
||||
}
|
||||
|
@@ -15,24 +15,23 @@
|
||||
#ifndef _AIS_AnimationObject_HeaderFile
|
||||
#define _AIS_AnimationObject_HeaderFile
|
||||
|
||||
#include <AIS_Animation.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_BaseAnimationObject.hxx>
|
||||
#include <gp_TrsfNLerp.hxx>
|
||||
|
||||
//! Animation defining object transformation.
|
||||
class AIS_AnimationObject : public AIS_Animation
|
||||
class AIS_AnimationObject : public AIS_BaseAnimationObject
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_AnimationObject, AIS_Animation)
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_AnimationObject, AIS_BaseAnimationObject)
|
||||
public:
|
||||
|
||||
//! Constructor with initialization.
|
||||
//! Note that start/end transformations specify exactly local transformation of the object,
|
||||
//! not the transformation to be applied to existing local transformation.
|
||||
//! @param theAnimationName animation identifier
|
||||
//! @param theContext interactive context where object have been displayed
|
||||
//! @param theObject object to apply local transformation
|
||||
//! @param theTrsfStart local transformation at the start of animation (e.g. theObject->LocalTransformation())
|
||||
//! @param theTrsfEnd local transformation at the end of animation
|
||||
//! @param[in] theAnimationName animation identifier
|
||||
//! @param[in] theContext interactive context where object have been displayed
|
||||
//! @param[in] theObject object to apply local transformation
|
||||
//! @param[in] theTrsfStart local transformation at the start of animation (e.g. theObject->LocalTransformation())
|
||||
//! @param[in] theTrsfEnd local transformation at the end of animation
|
||||
Standard_EXPORT AIS_AnimationObject (const TCollection_AsciiString& theAnimationName,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const Handle(AIS_InteractiveObject)& theObject,
|
||||
@@ -44,17 +43,10 @@ protected:
|
||||
//! Update the progress.
|
||||
Standard_EXPORT virtual void update (const AIS_AnimationProgress& theProgress) Standard_OVERRIDE;
|
||||
|
||||
//! Invalidate the viewer for proper update.
|
||||
Standard_EXPORT void invalidateViewer();
|
||||
private:
|
||||
|
||||
protected:
|
||||
|
||||
Handle(AIS_InteractiveContext) myContext; //!< context where object is displayed
|
||||
Handle(AIS_InteractiveObject) myObject; //!< presentation object to set location
|
||||
gp_TrsfNLerp myTrsfLerp; //!< interpolation tool
|
||||
gp_TrsfNLerp myTrsfLerp; //!< interpolation tool
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_AnimationObject, AIS_Animation)
|
||||
|
||||
#endif // _AIS_AnimationObject_HeaderFile
|
||||
|
@@ -188,7 +188,7 @@ void AIS_Axis::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
thePrs->SetInfiniteState (myInfiniteState);
|
||||
if (!myIsXYZAxis)
|
||||
{
|
||||
Handle(GeomAdaptor_Curve) curv = new GeomAdaptor_Curve(myComponent);
|
||||
GeomAdaptor_Curve curv (myComponent);
|
||||
StdPrs_Curve::Add (thePrs, curv, myDrawer);
|
||||
}
|
||||
else
|
||||
|
88
src/AIS/AIS_BaseAnimationObject.cxx
Normal file
88
src/AIS/AIS_BaseAnimationObject.cxx
Normal file
@@ -0,0 +1,88 @@
|
||||
// Copyright (c) 2023 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_BaseAnimationObject.hxx>
|
||||
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_BaseAnimationObject, AIS_Animation)
|
||||
|
||||
//=============================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
AIS_BaseAnimationObject::AIS_BaseAnimationObject (const TCollection_AsciiString& theAnimationName,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const Handle(AIS_InteractiveObject)& theObject)
|
||||
: AIS_Animation (theAnimationName),
|
||||
myContext (theContext),
|
||||
myObject (theObject)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : updateTrsf
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void AIS_BaseAnimationObject::updateTrsf (const gp_Trsf& theTrsf)
|
||||
{
|
||||
if (!myContext.IsNull())
|
||||
{
|
||||
myContext->SetLocation (myObject, theTrsf);
|
||||
invalidateViewer();
|
||||
}
|
||||
else
|
||||
{
|
||||
myObject->SetLocalTransformation (theTrsf);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : invalidateViewer
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void AIS_BaseAnimationObject::invalidateViewer()
|
||||
{
|
||||
if (myContext.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Boolean isImmediate = myContext->CurrentViewer()->ZLayerSettings (myObject->ZLayer()).IsImmediate();
|
||||
if (!isImmediate)
|
||||
{
|
||||
myContext->CurrentViewer()->Invalidate();
|
||||
return;
|
||||
}
|
||||
|
||||
// Invalidate immediate view only if it is going out of z-fit range.
|
||||
// This might be sub-optimal performing this for each animated objects in case of many animated objects.
|
||||
for (V3d_ListOfView::Iterator aDefViewIter = myContext->CurrentViewer()->DefinedViewIterator();
|
||||
aDefViewIter.More(); aDefViewIter.Next())
|
||||
{
|
||||
const Handle(V3d_View)& aView = aDefViewIter.Value();
|
||||
const Bnd_Box aMinMaxBox = aView->View()->MinMaxValues (Standard_False);
|
||||
const Bnd_Box aGraphicBox = aView->View()->MinMaxValues (Standard_True);
|
||||
Standard_Real aZNear = 0.0;
|
||||
Standard_Real aZFar = 0.0;
|
||||
if (aView->Camera()->ZFitAll (aDefViewIter.Value()->AutoZFitScaleFactor(), aMinMaxBox, aGraphicBox, aZNear, aZFar))
|
||||
{
|
||||
if (aZNear < aView->Camera()->ZNear()
|
||||
|| aZFar > aView->Camera()->ZFar())
|
||||
{
|
||||
aDefViewIter.Value()->Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
49
src/AIS/AIS_BaseAnimationObject.hxx
Normal file
49
src/AIS/AIS_BaseAnimationObject.hxx
Normal file
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) 2023 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_BaseAnimationObject_HeaderFile
|
||||
#define _AIS_BaseAnimationObject_HeaderFile
|
||||
|
||||
#include <AIS_Animation.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
|
||||
//! Animation defining object transformation.
|
||||
class AIS_BaseAnimationObject : public AIS_Animation
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_BaseAnimationObject, AIS_Animation)
|
||||
protected:
|
||||
|
||||
//! Constructor with initialization.
|
||||
//! @param[in] theAnimationName animation identifier
|
||||
//! @param[in] theContext interactive context where object have been displayed
|
||||
//! @param[in] theObject object to apply local transformation
|
||||
Standard_EXPORT AIS_BaseAnimationObject (const TCollection_AsciiString& theAnimationName,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const Handle(AIS_InteractiveObject)& theObject);
|
||||
|
||||
//! Update the transformation.
|
||||
Standard_EXPORT void updateTrsf (const gp_Trsf& theTrsf);
|
||||
|
||||
private:
|
||||
|
||||
//! Invalidate the viewer for proper update.
|
||||
Standard_EXPORT void invalidateViewer();
|
||||
|
||||
protected:
|
||||
|
||||
Handle(AIS_InteractiveContext) myContext; //!< context where object is displayed
|
||||
Handle(AIS_InteractiveObject) myObject; //!< presentation object to set location
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_BaseAnimationObject_HeaderFile
|
@@ -211,7 +211,7 @@ void AIS_Circle::UnsetWidth()
|
||||
void AIS_Circle::ComputeCircle (const Handle(Prs3d_Presentation)& thePresentation)
|
||||
{
|
||||
|
||||
Handle(GeomAdaptor_Curve) curv = new GeomAdaptor_Curve(myComponent);
|
||||
GeomAdaptor_Curve curv(myComponent);
|
||||
Standard_Real prevdev = myDrawer->DeviationCoefficient();
|
||||
myDrawer->SetDeviationCoefficient (1.e-5);
|
||||
StdPrs_DeflectionCurve::Add (thePresentation, curv, myDrawer);
|
||||
@@ -226,7 +226,7 @@ void AIS_Circle::ComputeCircle (const Handle(Prs3d_Presentation)& thePresentatio
|
||||
//=======================================================================
|
||||
void AIS_Circle::ComputeArc (const Handle(Prs3d_Presentation)& thePresentation)
|
||||
{
|
||||
Handle(GeomAdaptor_Curve) curv = new GeomAdaptor_Curve(myComponent, myUStart, myUEnd);
|
||||
GeomAdaptor_Curve curv(myComponent, myUStart, myUEnd);
|
||||
Standard_Real prevdev = myDrawer->DeviationCoefficient();
|
||||
myDrawer->SetDeviationCoefficient (1.e-5);
|
||||
StdPrs_DeflectionCurve::Add (thePresentation, curv, myDrawer);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Created on: 1997-01-17
|
||||
// Created on: 1997-01-17
|
||||
// Created by: Robert COUBLANC
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
@@ -1001,6 +1001,14 @@ void AIS_InteractiveContext::RecomputeSelectionOnly (const Handle(AIS_Interactiv
|
||||
return;
|
||||
}
|
||||
|
||||
TColStd_ListOfInteger aModes;
|
||||
ActivatedModes (theIO, aModes);
|
||||
|
||||
for (TColStd_ListIteratorOfListOfInteger aModesIter (aModes); aModesIter.More(); aModesIter.Next())
|
||||
{
|
||||
mgrSelector->Deactivate (theIO, aModesIter.Value());
|
||||
}
|
||||
|
||||
mgrSelector->RecomputeSelection (theIO);
|
||||
|
||||
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIO);
|
||||
@@ -1010,10 +1018,7 @@ void AIS_InteractiveContext::RecomputeSelectionOnly (const Handle(AIS_Interactiv
|
||||
return;
|
||||
}
|
||||
|
||||
TColStd_ListOfInteger aModes;
|
||||
ActivatedModes (theIO, aModes);
|
||||
TColStd_ListIteratorOfListOfInteger aModesIter (aModes);
|
||||
for (; aModesIter.More(); aModesIter.Next())
|
||||
for (TColStd_ListIteratorOfListOfInteger aModesIter (aModes); aModesIter.More(); aModesIter.Next())
|
||||
{
|
||||
mgrSelector->Activate (theIO, aModesIter.Value());
|
||||
}
|
||||
@@ -3223,6 +3228,30 @@ void AIS_InteractiveContext::ClearSelected (const Standard_Boolean theToUpdateVi
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : isDetected
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_InteractiveContext::isDetected (const Handle(AIS_InteractiveObject)& theObject)
|
||||
{
|
||||
for (Standard_Integer aDetIter = myDetectedSeq.Lower(); aDetIter <= myDetectedSeq.Upper(); aDetIter++)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) aPicked = MainSelector()->Picked(myDetectedSeq(aDetIter));
|
||||
Handle(AIS_InteractiveObject) anObj;
|
||||
if (!aPicked.IsNull())
|
||||
{
|
||||
anObj = Handle(AIS_InteractiveObject)::DownCast(aPicked->Selectable());
|
||||
}
|
||||
|
||||
if (!anObj.IsNull()
|
||||
&& anObj == theObject)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetSelected
|
||||
//purpose : Sets the whole object as selected and highlights it with selection color
|
||||
@@ -3283,7 +3312,8 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
}
|
||||
|
||||
// added to avoid untimely viewer update...
|
||||
mySelection->ClearAndSelect (anOwner);
|
||||
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||
mySelection->ClearAndSelect (anOwner, myFilters, isDetected (anObj));
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
@@ -3345,7 +3375,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
|
||||
unhighlightSelected();
|
||||
}
|
||||
|
||||
mySelection->ClearAndSelect (theOwner);
|
||||
mySelection->ClearAndSelect (theOwner, myFilters, isDetected (anObject));
|
||||
if (myAutoHilight)
|
||||
{
|
||||
Handle(Prs3d_Drawer) aCustomStyle;
|
||||
@@ -3396,16 +3426,17 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myFilters->IsOk(theOwner) && !theOwner->IsSelected())
|
||||
if (!myFilters->IsOk (theOwner) && !theOwner->IsSelected())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mySelection->Select (theOwner);
|
||||
AIS_SelectionScheme aSelScheme = theOwner->IsSelected() ? AIS_SelectionScheme_Remove : AIS_SelectionScheme_Add;
|
||||
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||
mySelection->Select (theOwner, myFilters, aSelScheme, isDetected (anObj));
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
|
||||
if (!aStatusPtr)
|
||||
{
|
||||
@@ -3464,7 +3495,8 @@ Standard_Boolean AIS_InteractiveContext::SetSelectedState (const Handle(SelectMg
|
||||
}
|
||||
else
|
||||
{
|
||||
const AIS_SelectStatus aSelStatus = mySelection->Select (theEntity);
|
||||
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(theEntity->Selectable());
|
||||
const AIS_SelectStatus aSelStatus = mySelection->Select (theEntity, myFilters, AIS_SelectionScheme_Remove, isDetected (anObj));
|
||||
theEntity->SetSelected (false);
|
||||
return aSelStatus == AIS_SS_Removed;
|
||||
}
|
||||
|
@@ -1302,6 +1302,9 @@ protected: //! @name internal methods
|
||||
Standard_EXPORT AIS_StatusOfDetection moveTo (const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean theToRedrawOnUpdate);
|
||||
|
||||
//! Returns True if the object is detected.
|
||||
Standard_EXPORT Standard_Boolean isDetected (const Handle(AIS_InteractiveObject)& theObject);
|
||||
|
||||
//! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
|
||||
Standard_EXPORT void unselectOwners (const Handle(AIS_InteractiveObject)& theObject);
|
||||
|
||||
|
@@ -211,7 +211,7 @@ void AIS_Line::UnsetWidth()
|
||||
//=======================================================================
|
||||
void AIS_Line::ComputeInfiniteLine( const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
Handle(GeomAdaptor_Curve) curv = new GeomAdaptor_Curve(myComponent);
|
||||
GeomAdaptor_Curve curv(myComponent);
|
||||
StdPrs_Curve::Add(aPresentation,curv,myDrawer);
|
||||
|
||||
//pas de prise en compte lors du FITALL
|
||||
@@ -230,7 +230,7 @@ void AIS_Line::ComputeSegmentLine( const Handle(Prs3d_Presentation)& aPresentati
|
||||
myComponent = new Geom_Line(P1,gp_Dir(P2.XYZ()-P1.XYZ()));
|
||||
|
||||
Standard_Real dist = P1.Distance(P2);
|
||||
Handle(GeomAdaptor_Curve) curv = new GeomAdaptor_Curve(myComponent,0.,dist);
|
||||
GeomAdaptor_Curve curv(myComponent,0.,dist);
|
||||
StdPrs_Curve::Add(aPresentation,curv,myDrawer);
|
||||
}
|
||||
|
||||
|
@@ -1116,18 +1116,23 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
//Check mode
|
||||
AIS_ManipulatorMode aMode = (AIS_ManipulatorMode) theMode;
|
||||
const AIS_ManipulatorMode aMode = (AIS_ManipulatorMode) theMode;
|
||||
if (aMode == AIS_MM_None)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Handle(SelectMgr_EntityOwner) anOwner;
|
||||
if (aMode == AIS_MM_None)
|
||||
{
|
||||
anOwner = new SelectMgr_EntityOwner (this, 5);
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_Translation || aMode == AIS_MM_None)
|
||||
// Sensitivity calculation for manipulator parts allows to avoid
|
||||
// overlapping of sensitive areas when size of manipulator is small.
|
||||
// Sensitivity is calculated relative to the default size of the manipulator (100.0f).
|
||||
const Standard_ShortReal aSensitivityCoef = myAxes[0].Size() / 100.0f;
|
||||
const Standard_Integer aHighSensitivity = Max (Min (RealToInt (aSensitivityCoef * 15), 15), 3); // clamp sensitivity within range [3, 15]
|
||||
const Standard_Integer aLowSensitivity = Max (Min (RealToInt (aSensitivityCoef * 10), 10), 2); // clamp sensitivity within range [2, 10]
|
||||
|
||||
switch (aMode)
|
||||
{
|
||||
case AIS_MM_Translation:
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1136,23 +1141,21 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
continue;
|
||||
}
|
||||
const Axis& anAxis = myAxes[anIt];
|
||||
if (aMode != AIS_MM_None)
|
||||
{
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Translation, 9);
|
||||
}
|
||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_Translation, 9);
|
||||
|
||||
// define sensitivity by line
|
||||
Handle(Select3D_SensitiveSegment) aLine = new Select3D_SensitiveSegment (anOwner, gp::Origin(), anAxis.TranslatorTipPosition());
|
||||
aLine->SetSensitivityFactor (15);
|
||||
Handle(Select3D_SensitiveSegment) aLine = new Select3D_SensitiveSegment(anOwner, gp::Origin(), anAxis.TranslatorTipPosition());
|
||||
aLine->SetSensitivityFactor (aHighSensitivity);
|
||||
theSelection->Add (aLine);
|
||||
|
||||
// enlarge sensitivity by triangulation
|
||||
Handle(Select3D_SensitivePrimitiveArray) aTri = new Select3D_SensitivePrimitiveArray (anOwner);
|
||||
Handle(Select3D_SensitivePrimitiveArray) aTri = new Select3D_SensitivePrimitiveArray(anOwner);
|
||||
aTri->InitTriangulation (anAxis.TriangleArray()->Attributes(), anAxis.TriangleArray()->Indices(), TopLoc_Location());
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_Rotation || aMode == AIS_MM_None)
|
||||
case AIS_MM_Rotation:
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1161,22 +1164,20 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
continue;
|
||||
}
|
||||
const Axis& anAxis = myAxes[anIt];
|
||||
if (aMode != AIS_MM_None)
|
||||
{
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Rotation, 9);
|
||||
}
|
||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_Rotation, 9);
|
||||
|
||||
// define sensitivity by circle
|
||||
const gp_Circ aGeomCircle (gp_Ax2 (gp::Origin(), anAxis.ReferenceAxis().Direction()), anAxis.RotatorDiskRadius());
|
||||
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle (anOwner, aGeomCircle);
|
||||
aCircle->SetSensitivityFactor (15);
|
||||
theSelection->Add (aCircle);
|
||||
const gp_Circ aGeomCircle (gp_Ax2(gp::Origin(), anAxis.ReferenceAxis().Direction()), anAxis.RotatorDiskRadius());
|
||||
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle(anOwner, aGeomCircle);
|
||||
aCircle->SetSensitivityFactor (aLowSensitivity);
|
||||
theSelection->Add(aCircle);
|
||||
// enlarge sensitivity by triangulation
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new ManipSensTriangulation (anOwner, myAxes[anIt].RotatorDisk().Triangulation(), anAxis.ReferenceAxis().Direction());
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new ManipSensTriangulation(anOwner, myAxes[anIt].RotatorDisk().Triangulation(), anAxis.ReferenceAxis().Direction());
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_Scaling || aMode == AIS_MM_None)
|
||||
case AIS_MM_Scaling:
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1184,21 +1185,19 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (aMode != AIS_MM_None)
|
||||
{
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Scaling, 9);
|
||||
}
|
||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_Scaling, 9);
|
||||
|
||||
// define sensitivity by point
|
||||
Handle(Select3D_SensitivePoint) aPnt = new Select3D_SensitivePoint (anOwner, myAxes[anIt].ScalerCubePosition());
|
||||
aPnt->SetSensitivityFactor (15);
|
||||
Handle(Select3D_SensitivePoint) aPnt = new Select3D_SensitivePoint(anOwner, myAxes[anIt].ScalerCubePosition());
|
||||
aPnt->SetSensitivityFactor (aHighSensitivity);
|
||||
theSelection->Add (aPnt);
|
||||
// enlarge sensitivity by triangulation
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation (anOwner, myAxes[anIt].ScalerCube().Triangulation(), TopLoc_Location(), Standard_True);
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation(anOwner, myAxes[anIt].ScalerCube().Triangulation(), TopLoc_Location(), Standard_True);
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_TranslationPlane || aMode == AIS_MM_None)
|
||||
case AIS_MM_TranslationPlane:
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1206,28 +1205,33 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (aMode != AIS_MM_None)
|
||||
{
|
||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_TranslationPlane, 9);
|
||||
}
|
||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_TranslationPlane, 9);
|
||||
|
||||
// define sensitivity by two crossed lines
|
||||
gp_Pnt aP1, aP2;
|
||||
aP1 = myAxes[((anIt + 1) % 3)].TranslatorTipPosition();
|
||||
aP2 = myAxes[((anIt + 2) % 3)].TranslatorTipPosition();
|
||||
Standard_Real aSensitivityOffset = ZoomPersistence() ? aHighSensitivity * (0.5 + M_SQRT2) : 0.0;
|
||||
gp_Pnt aP1 = myAxes[((anIt + 1) % 3)].TranslatorTipPosition().Translated (myAxes[((anIt + 2) % 3)].ReferenceAxis().Direction().XYZ() * aSensitivityOffset);
|
||||
gp_Pnt aP2 = myAxes[((anIt + 2) % 3)].TranslatorTipPosition().Translated (myAxes[((anIt + 1) % 3)].ReferenceAxis().Direction().XYZ() * aSensitivityOffset);
|
||||
gp_XYZ aMidP = (aP1.XYZ() + aP2.XYZ()) / 2.0;
|
||||
gp_XYZ anOrig = aMidP.Normalized().Multiplied (aSensitivityOffset);
|
||||
|
||||
Handle(Select3D_SensitiveSegment) aLine1 = new Select3D_SensitiveSegment(anOwner, aP1, aP2);
|
||||
aLine1->SetSensitivityFactor(10);
|
||||
theSelection->Add(aLine1);
|
||||
Handle(Select3D_SensitiveSegment) aLine2 = new Select3D_SensitiveSegment(anOwner, gp::Origin(), aMidP);
|
||||
aLine2->SetSensitivityFactor(10);
|
||||
theSelection->Add(aLine2);
|
||||
aLine1->SetSensitivityFactor(aLowSensitivity);
|
||||
theSelection->Add (aLine1);
|
||||
Handle(Select3D_SensitiveSegment) aLine2 = new Select3D_SensitiveSegment(anOwner, anOrig, aMidP);
|
||||
aLine2->SetSensitivityFactor (aLowSensitivity);
|
||||
theSelection->Add (aLine2);
|
||||
|
||||
// enlarge sensitivity by triangulation
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation(anOwner, myAxes[anIt].DraggerSector().Triangulation(), TopLoc_Location(), Standard_True);
|
||||
theSelection->Add(aTri);
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation(anOwner, myAxes[anIt].DraggerSector().Triangulation(), TopLoc_Location(), Standard_True);
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
anOwner = new SelectMgr_EntityOwner(this, 5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -222,7 +222,7 @@ void AIS_Plane::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
ComputeFrame();
|
||||
const Handle(Geom_Plane)& pl = myComponent;
|
||||
Handle(Geom_Plane) thegoodpl (Handle(Geom_Plane)::DownCast(pl->Translated(pl->Location(),myCenter)));
|
||||
Handle(GeomAdaptor_Surface) surf = new GeomAdaptor_Surface(thegoodpl);
|
||||
GeomAdaptor_Surface surf(thegoodpl);
|
||||
StdPrs_Plane::Add (thePrs, surf, myDrawer);
|
||||
}
|
||||
else
|
||||
|
@@ -55,24 +55,38 @@ void AIS_Selection::Clear()
|
||||
//function : Select
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& theObject)
|
||||
AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(SelectMgr_Filter)& theFilter,
|
||||
const AIS_SelectionScheme theSelScheme,
|
||||
const Standard_Boolean theIsDetected)
|
||||
{
|
||||
if (theObject.IsNull()
|
||||
|| !theObject->HasSelectable())
|
||||
if (theOwner.IsNull()
|
||||
|| !theOwner->HasSelectable())
|
||||
{
|
||||
return AIS_SS_NotDone;
|
||||
}
|
||||
|
||||
if (!myResultMap.IsBound (theObject))
|
||||
const Standard_Boolean isDetected = theIsDetected
|
||||
&& (theFilter.IsNull() || theFilter->IsOk (theOwner));
|
||||
|
||||
const Standard_Boolean wasSelected = theOwner->IsSelected();
|
||||
const Standard_Boolean toSelect = theOwner->Select (theSelScheme, isDetected);
|
||||
|
||||
if (toSelect && !wasSelected)
|
||||
{
|
||||
AIS_NListOfEntityOwner::Iterator aListIter;
|
||||
myresult.Append (theObject, aListIter);
|
||||
myResultMap.Bind (theObject, aListIter);
|
||||
theObject->SetSelected (Standard_True);
|
||||
myresult.Append (theOwner, aListIter);
|
||||
myResultMap.Bind (theOwner, aListIter);
|
||||
theOwner->SetSelected (Standard_True);
|
||||
return AIS_SS_Added;
|
||||
}
|
||||
|
||||
AIS_NListOfEntityOwner::Iterator aListIter = myResultMap.Find (theObject);
|
||||
if (!toSelect && !wasSelected)
|
||||
{
|
||||
return AIS_SS_NotDone;
|
||||
}
|
||||
|
||||
AIS_NListOfEntityOwner::Iterator aListIter = myResultMap.Find (theOwner);
|
||||
if (myIterator == aListIter)
|
||||
{
|
||||
if (myIterator.More())
|
||||
@@ -88,14 +102,14 @@ AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& the
|
||||
// In the mode of advanced mesh selection only one owner is created for all selection modes.
|
||||
// It is necessary to check the current detected entity
|
||||
// and remove the owner from map only if the detected entity is the same as previous selected (IsForcedHilight call)
|
||||
if (theObject->IsForcedHilight())
|
||||
if (theOwner->IsForcedHilight())
|
||||
{
|
||||
return AIS_SS_Added;
|
||||
}
|
||||
|
||||
myresult.Remove (aListIter);
|
||||
myResultMap.UnBind (theObject);
|
||||
theObject->SetSelected (Standard_False);
|
||||
myResultMap.UnBind (theOwner);
|
||||
theOwner->SetSelected (Standard_False);
|
||||
|
||||
// update list iterator for next object in <myresult> list if any
|
||||
if (aListIter.More())
|
||||
@@ -142,86 +156,39 @@ void AIS_Selection::SelectOwners (const AIS_NArray1OfEntityOwner& thePickedOwner
|
||||
const Standard_Boolean theToAllowSelOverlap,
|
||||
const Handle(SelectMgr_Filter)& theFilter)
|
||||
{
|
||||
(void )theToAllowSelOverlap;
|
||||
switch (theSelScheme)
|
||||
(void)theToAllowSelOverlap;
|
||||
|
||||
if (theSelScheme == AIS_SelectionScheme_ReplaceExtra
|
||||
&& thePickedOwners.Size() == myresult.Size())
|
||||
{
|
||||
case AIS_SelectionScheme_UNKNOWN:
|
||||
// If picked owners is equivalent to the selected then just clear selected.
|
||||
Standard_Boolean isTheSame = Standard_True;
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aPickedIter (thePickedOwners); aPickedIter.More(); aPickedIter.Next())
|
||||
{
|
||||
return;
|
||||
}
|
||||
case AIS_SelectionScheme_ReplaceExtra:
|
||||
{
|
||||
// If picked owners is equivalent to the selected then just clear selected
|
||||
// Else go to AIS_SelectionScheme_Replace
|
||||
if (thePickedOwners.Size() == myresult.Size())
|
||||
if (!myResultMap.IsBound (aPickedIter.Value()))
|
||||
{
|
||||
Standard_Boolean isTheSame = Standard_True;
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
if (!myResultMap.IsBound (aSelIter.Value()))
|
||||
{
|
||||
isTheSame = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isTheSame)
|
||||
{
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
isTheSame = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Standard_FALLTHROUGH
|
||||
case AIS_SelectionScheme_Replace:
|
||||
if (isTheSame)
|
||||
{
|
||||
Clear();
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
appendOwner (aSelIter.Value(), theFilter);
|
||||
}
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
case AIS_SelectionScheme_Add:
|
||||
{
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
appendOwner (aSelIter.Value(), theFilter);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case AIS_SelectionScheme_Remove:
|
||||
{
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
if (myResultMap.IsBound (aSelIter.Value()))
|
||||
{
|
||||
Select (aSelIter.Value());
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
case AIS_SelectionScheme_XOR:
|
||||
{
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
|
||||
if (anOwner.IsNull()
|
||||
|| !anOwner->HasSelectable()
|
||||
|| !theFilter->IsOk (anOwner))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (theSelScheme == AIS_SelectionScheme_Replace
|
||||
|| theSelScheme == AIS_SelectionScheme_ReplaceExtra
|
||||
|| theSelScheme == AIS_SelectionScheme_Clear)
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
Select (anOwner);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case AIS_SelectionScheme_Clear:
|
||||
{
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aPickedIter (thePickedOwners); aPickedIter.More(); aPickedIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner)& anOwner = aPickedIter.Value();
|
||||
Select (anOwner, theFilter, theSelScheme, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -34,23 +34,36 @@ public:
|
||||
|
||||
//! creates a new selection.
|
||||
Standard_EXPORT AIS_Selection();
|
||||
|
||||
|
||||
//! removes all the object of the selection.
|
||||
Standard_EXPORT virtual void Clear();
|
||||
|
||||
|
||||
//! 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 virtual AIS_SelectStatus Select (const Handle(SelectMgr_EntityOwner)& theObject);
|
||||
|
||||
//! @param[in] theOwner element to change selection state
|
||||
//! @param[in] theFilter context filter
|
||||
//! @param[in] theSelScheme selection scheme
|
||||
//! @param[in] theIsDetected flag of object detection
|
||||
//! @return result of selection
|
||||
Standard_EXPORT virtual AIS_SelectStatus Select (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(SelectMgr_Filter)& theFilter,
|
||||
const AIS_SelectionScheme theSelScheme,
|
||||
const Standard_Boolean theIsDetected);
|
||||
|
||||
//! the object is always add int the selection.
|
||||
//! faster when the number of objects selected is great.
|
||||
Standard_EXPORT virtual AIS_SelectStatus AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
|
||||
|
||||
//! clears the selection and adds the object in the selection.
|
||||
virtual void ClearAndSelect (const Handle(SelectMgr_EntityOwner)& theObject)
|
||||
//! @param[in] theObject element to change selection state
|
||||
//! @param[in] theFilter context filter
|
||||
//! @param[in] theIsDetected flag of object detection
|
||||
virtual void ClearAndSelect (const Handle(SelectMgr_EntityOwner)& theObject,
|
||||
const Handle(SelectMgr_Filter)& theFilter,
|
||||
const Standard_Boolean theIsDetected)
|
||||
{
|
||||
Clear();
|
||||
Select (theObject);
|
||||
Select (theObject, theFilter, AIS_SelectionScheme_Add, theIsDetected);
|
||||
}
|
||||
|
||||
//! checks if the object is in the selection.
|
||||
|
@@ -2,6 +2,8 @@ AIS.hxx
|
||||
AIS_Animation.cxx
|
||||
AIS_Animation.hxx
|
||||
AIS_AnimationTimer.hxx
|
||||
AIS_AnimationAxisRotation.cxx
|
||||
AIS_AnimationAxisRotation.hxx
|
||||
AIS_AnimationCamera.cxx
|
||||
AIS_AnimationCamera.hxx
|
||||
AIS_AnimationObject.cxx
|
||||
@@ -12,6 +14,8 @@ AIS_Axis.cxx
|
||||
AIS_Axis.hxx
|
||||
AIS_BadEdgeFilter.cxx
|
||||
AIS_BadEdgeFilter.hxx
|
||||
AIS_BaseAnimationObject.cxx
|
||||
AIS_BaseAnimationObject.hxx
|
||||
AIS_C0RegularityFilter.cxx
|
||||
AIS_C0RegularityFilter.hxx
|
||||
AIS_CameraFrustum.cxx
|
||||
|
@@ -93,7 +93,7 @@ static void findfourpoints(const Standard_Real ,
|
||||
}
|
||||
}
|
||||
|
||||
/*static Standard_Real curvature(const Standard_Real U, const Handle(Adaptor3d_Curve)& C)
|
||||
/*static Standard_Real curvature(const Standard_Real U, const Adaptor3d_Curve& C)
|
||||
{
|
||||
Standard_Real k, tau, mod1, mod2, OMEGA;
|
||||
gp_Pnt P;
|
||||
@@ -151,40 +151,34 @@ Approx_CurvlinFunc::Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D1, co
|
||||
|
||||
void Approx_CurvlinFunc::Init()
|
||||
{
|
||||
Handle(Adaptor3d_CurveOnSurface) CurOnSur;
|
||||
|
||||
Adaptor3d_CurveOnSurface CurOnSur;
|
||||
|
||||
switch(myCase) {
|
||||
case 1:
|
||||
{
|
||||
Init(myC3D, mySi_1, myUi_1);
|
||||
myFirstU1 = myC3D->FirstParameter();
|
||||
myLastU1 = myC3D->LastParameter();
|
||||
myFirstU2 = myLastU2 = 0;
|
||||
break;
|
||||
}
|
||||
Init (*myC3D, mySi_1, myUi_1);
|
||||
myFirstU1 = myC3D->FirstParameter();
|
||||
myLastU1 = myC3D->LastParameter();
|
||||
myFirstU2 = myLastU2 = 0;
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
CurOnSur = new Adaptor3d_CurveOnSurface(myC2D1, mySurf1);
|
||||
CurOnSur->Load(myC2D1);
|
||||
CurOnSur->Load(mySurf1);
|
||||
Init(CurOnSur, mySi_1, myUi_1);
|
||||
myFirstU1 = CurOnSur->FirstParameter();
|
||||
myLastU1 = CurOnSur->LastParameter();
|
||||
myFirstU2 = myLastU2 = 0;
|
||||
break;
|
||||
}
|
||||
CurOnSur.Load(myC2D1);
|
||||
CurOnSur.Load(mySurf1);
|
||||
Init(CurOnSur, mySi_1, myUi_1);
|
||||
myFirstU1 = CurOnSur.FirstParameter();
|
||||
myLastU1 = CurOnSur.LastParameter();
|
||||
myFirstU2 = myLastU2 = 0;
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
CurOnSur = new Adaptor3d_CurveOnSurface(myC2D1, mySurf1);
|
||||
Init(CurOnSur, mySi_1, myUi_1);
|
||||
myFirstU1 = CurOnSur->FirstParameter();
|
||||
myLastU1 = CurOnSur->LastParameter();
|
||||
CurOnSur->Load(myC2D2);
|
||||
CurOnSur->Load(mySurf2);
|
||||
Init(CurOnSur, mySi_2, myUi_2);
|
||||
myFirstU2 = CurOnSur->FirstParameter();
|
||||
myLastU2 = CurOnSur->LastParameter();
|
||||
}
|
||||
CurOnSur.Load(myC2D1);
|
||||
CurOnSur.Load(mySurf1);
|
||||
Init(CurOnSur, mySi_1, myUi_1);
|
||||
myFirstU1 = CurOnSur.FirstParameter();
|
||||
myLastU1 = CurOnSur.LastParameter();
|
||||
CurOnSur.Load(myC2D2);
|
||||
CurOnSur.Load(mySurf2);
|
||||
Init(CurOnSur, mySi_2, myUi_2);
|
||||
myFirstU2 = CurOnSur.FirstParameter();
|
||||
myLastU2 = CurOnSur.LastParameter();
|
||||
}
|
||||
|
||||
Length();
|
||||
@@ -196,20 +190,20 @@ void Approx_CurvlinFunc::Init()
|
||||
//purpose : Init the values
|
||||
//history : 23/10/1998 PMN : Cut at curve's discontinuities
|
||||
//=======================================================================
|
||||
void Approx_CurvlinFunc::Init (const Handle(Adaptor3d_Curve)& C, Handle(TColStd_HArray1OfReal)& Si,
|
||||
Handle(TColStd_HArray1OfReal)& Ui) const
|
||||
void Approx_CurvlinFunc::Init(Adaptor3d_Curve& C, Handle(TColStd_HArray1OfReal)& Si,
|
||||
Handle(TColStd_HArray1OfReal)& Ui) const
|
||||
{
|
||||
Standard_Real Step, FirstU, LastU;
|
||||
Standard_Integer i, j, k, NbInt, NbIntC3;
|
||||
FirstU = C->FirstParameter();
|
||||
LastU = C->LastParameter();
|
||||
FirstU = C.FirstParameter();
|
||||
LastU = C.LastParameter();
|
||||
|
||||
NbInt = 10;
|
||||
NbIntC3 = C->NbIntervals(GeomAbs_C3);
|
||||
NbIntC3 = C.NbIntervals(GeomAbs_C3);
|
||||
TColStd_Array1OfReal Disc(1, NbIntC3+1);
|
||||
|
||||
if (NbIntC3 >1) {
|
||||
C->Intervals(Disc, GeomAbs_C3);
|
||||
C.Intervals(Disc, GeomAbs_C3);
|
||||
}
|
||||
else {
|
||||
Disc(1) = FirstU;
|
||||
@@ -331,44 +325,46 @@ void Approx_CurvlinFunc::Trim(const Standard_Real First, const Standard_Real Las
|
||||
if ((Last - First) < Tol) return;
|
||||
|
||||
Standard_Real FirstU, LastU;
|
||||
Handle(Adaptor3d_CurveOnSurface) CurOnSur;
|
||||
Handle(Adaptor3d_CurveOnSurface) TCurOnSur;
|
||||
Adaptor3d_CurveOnSurface CurOnSur;
|
||||
Handle(Adaptor3d_CurveOnSurface) HCurOnSur;
|
||||
|
||||
switch(myCase) {
|
||||
case 1:
|
||||
myC3D = myC3D->Trim(myFirstU1, myLastU1, Tol);
|
||||
FirstU = GetUParameter(myC3D, First, 1);
|
||||
LastU = GetUParameter (myC3D, Last, 1);
|
||||
FirstU = GetUParameter(*myC3D, First, 1);
|
||||
LastU = GetUParameter (*myC3D, Last, 1);
|
||||
myC3D = myC3D->Trim(FirstU, LastU, Tol);
|
||||
break;
|
||||
case 3:
|
||||
CurOnSur = new Adaptor3d_CurveOnSurface(myC2D2, mySurf2);
|
||||
TCurOnSur = Handle(Adaptor3d_CurveOnSurface)::DownCast (CurOnSur->Trim(myFirstU2, myLastU2, Tol));
|
||||
myC2D2 = TCurOnSur->GetCurve();
|
||||
mySurf2 = TCurOnSur->GetSurface();
|
||||
CurOnSur->Load(myC2D2);
|
||||
CurOnSur->Load(mySurf2);
|
||||
CurOnSur.Load(myC2D2);
|
||||
CurOnSur.Load(mySurf2);
|
||||
HCurOnSur = Handle(Adaptor3d_CurveOnSurface)::DownCast (CurOnSur.Trim(myFirstU2, myLastU2, Tol));
|
||||
myC2D2 = HCurOnSur->GetCurve();
|
||||
mySurf2 = HCurOnSur->GetSurface();
|
||||
CurOnSur.Load(myC2D2);
|
||||
CurOnSur.Load(mySurf2);
|
||||
|
||||
FirstU = GetUParameter(CurOnSur, First, 1);
|
||||
LastU = GetUParameter(CurOnSur, Last, 1);
|
||||
TCurOnSur = Handle(Adaptor3d_CurveOnSurface)::DownCast (CurOnSur->Trim(FirstU, LastU, Tol));
|
||||
myC2D2 = TCurOnSur->GetCurve();
|
||||
mySurf2 = TCurOnSur->GetSurface();
|
||||
HCurOnSur = Handle(Adaptor3d_CurveOnSurface)::DownCast (CurOnSur.Trim(FirstU, LastU, Tol));
|
||||
myC2D2 = HCurOnSur->GetCurve();
|
||||
mySurf2 = HCurOnSur->GetSurface();
|
||||
|
||||
Standard_FALLTHROUGH
|
||||
case 2:
|
||||
CurOnSur = new Adaptor3d_CurveOnSurface(myC2D1, mySurf1);
|
||||
TCurOnSur = Handle(Adaptor3d_CurveOnSurface)::DownCast (CurOnSur->Trim(myFirstU1, myLastU1, Tol));
|
||||
myC2D1 = TCurOnSur->GetCurve();
|
||||
mySurf1 = TCurOnSur->GetSurface();
|
||||
CurOnSur->Load(myC2D1);
|
||||
CurOnSur->Load(mySurf1);
|
||||
CurOnSur.Load(myC2D1);
|
||||
CurOnSur.Load(mySurf1);
|
||||
HCurOnSur = Handle(Adaptor3d_CurveOnSurface)::DownCast (CurOnSur.Trim(myFirstU1, myLastU1, Tol));
|
||||
myC2D1 = HCurOnSur->GetCurve();
|
||||
mySurf1 = HCurOnSur->GetSurface();
|
||||
CurOnSur.Load(myC2D1);
|
||||
CurOnSur.Load(mySurf1);
|
||||
|
||||
FirstU = GetUParameter(CurOnSur, First, 1);
|
||||
LastU = GetUParameter(CurOnSur, Last, 1);
|
||||
TCurOnSur = Handle(Adaptor3d_CurveOnSurface)::DownCast (CurOnSur->Trim(FirstU, LastU, Tol));
|
||||
myC2D1 = TCurOnSur->GetCurve();
|
||||
mySurf1 = TCurOnSur->GetSurface();
|
||||
HCurOnSur = Handle(Adaptor3d_CurveOnSurface)::DownCast (CurOnSur.Trim(FirstU, LastU, Tol));
|
||||
myC2D1 = HCurOnSur->GetCurve();
|
||||
mySurf1 = HCurOnSur->GetSurface();
|
||||
}
|
||||
myFirstS = First;
|
||||
myLastS = Last;
|
||||
@@ -376,39 +372,41 @@ void Approx_CurvlinFunc::Trim(const Standard_Real First, const Standard_Real Las
|
||||
|
||||
void Approx_CurvlinFunc::Length()
|
||||
{
|
||||
Handle(Adaptor3d_CurveOnSurface) CurOnSur;
|
||||
Adaptor3d_CurveOnSurface CurOnSur;
|
||||
Standard_Real FirstU, LastU;
|
||||
|
||||
switch(myCase){
|
||||
case 1:
|
||||
FirstU = myC3D->FirstParameter();
|
||||
LastU = myC3D->LastParameter();
|
||||
myLength = Length (myC3D, FirstU, LastU);
|
||||
myLength = Length (*myC3D, FirstU, LastU);
|
||||
myLength1 = myLength2 = 0;
|
||||
break;
|
||||
case 2:
|
||||
CurOnSur = new Adaptor3d_CurveOnSurface(myC2D1, mySurf1);
|
||||
FirstU = CurOnSur->FirstParameter();
|
||||
LastU = CurOnSur->LastParameter();
|
||||
CurOnSur.Load(myC2D1);
|
||||
CurOnSur.Load(mySurf1);
|
||||
FirstU = CurOnSur.FirstParameter();
|
||||
LastU = CurOnSur.LastParameter();
|
||||
myLength = Length(CurOnSur, FirstU, LastU);
|
||||
myLength1 = myLength2 = 0;
|
||||
break;
|
||||
case 3:
|
||||
CurOnSur = new Adaptor3d_CurveOnSurface(myC2D1, mySurf1);
|
||||
FirstU = CurOnSur->FirstParameter();
|
||||
LastU = CurOnSur->LastParameter();
|
||||
CurOnSur.Load(myC2D1);
|
||||
CurOnSur.Load(mySurf1);
|
||||
FirstU = CurOnSur.FirstParameter();
|
||||
LastU = CurOnSur.LastParameter();
|
||||
myLength1 = Length(CurOnSur, FirstU, LastU);
|
||||
CurOnSur->Load(myC2D2);
|
||||
CurOnSur->Load(mySurf2);
|
||||
FirstU = CurOnSur->FirstParameter();
|
||||
LastU = CurOnSur->LastParameter();
|
||||
CurOnSur.Load(myC2D2);
|
||||
CurOnSur.Load(mySurf2);
|
||||
FirstU = CurOnSur.FirstParameter();
|
||||
LastU = CurOnSur.LastParameter();
|
||||
myLength2 = Length(CurOnSur, FirstU, LastU);
|
||||
myLength = (myLength1 + myLength2)/2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Standard_Real Approx_CurvlinFunc::Length(const Handle(Adaptor3d_Curve)& C, const Standard_Real FirstU, const Standard_Real LastU) const
|
||||
Standard_Real Approx_CurvlinFunc::Length(Adaptor3d_Curve& C, const Standard_Real FirstU, const Standard_Real LastU) const
|
||||
{
|
||||
Standard_Real Length;
|
||||
|
||||
@@ -425,22 +423,24 @@ Standard_Real Approx_CurvlinFunc::GetLength() const
|
||||
Standard_Real Approx_CurvlinFunc::GetSParameter(const Standard_Real U) const
|
||||
{
|
||||
Standard_Real S=0, S1, S2;
|
||||
Handle(Adaptor3d_CurveOnSurface) CurOnSur;
|
||||
Adaptor3d_CurveOnSurface CurOnSur;
|
||||
|
||||
switch (myCase) {
|
||||
case 1:
|
||||
S = GetSParameter (myC3D, U, myLength);
|
||||
S = GetSParameter (*myC3D, U, myLength);
|
||||
break;
|
||||
case 2:
|
||||
CurOnSur = new Adaptor3d_CurveOnSurface(myC2D1, mySurf1);
|
||||
CurOnSur.Load(myC2D1);
|
||||
CurOnSur.Load(mySurf1);
|
||||
S = GetSParameter(CurOnSur, U, myLength);
|
||||
break;
|
||||
case 3:
|
||||
CurOnSur = new Adaptor3d_CurveOnSurface(myC2D1, mySurf1);
|
||||
S1 = GetSParameter(CurOnSur, U, myLength1);
|
||||
CurOnSur->Load(myC2D2);
|
||||
CurOnSur->Load(mySurf2);
|
||||
S2 = GetSParameter(CurOnSur, U, myLength2);
|
||||
CurOnSur.Load(myC2D1);
|
||||
CurOnSur.Load(mySurf1);
|
||||
S1 = GetSParameter(CurOnSur, U, myLength1);
|
||||
CurOnSur.Load(myC2D2);
|
||||
CurOnSur.Load(mySurf2);
|
||||
S2 = GetSParameter(CurOnSur, U, myLength2);
|
||||
S = (S1 + S2)/2;
|
||||
}
|
||||
return S;
|
||||
@@ -448,9 +448,9 @@ Standard_Real Approx_CurvlinFunc::GetSParameter(const Standard_Real U) const
|
||||
|
||||
|
||||
|
||||
Standard_Real Approx_CurvlinFunc::GetUParameter (const Handle(Adaptor3d_Curve)& C,
|
||||
const Standard_Real S,
|
||||
const Standard_Integer NumberOfCurve) const
|
||||
Standard_Real Approx_CurvlinFunc::GetUParameter(Adaptor3d_Curve& C,
|
||||
const Standard_Real S,
|
||||
const Standard_Integer NumberOfCurve) const
|
||||
{
|
||||
Standard_Real deltaS, base, U, Length;
|
||||
Standard_Integer NbInt, NInterval, i;
|
||||
@@ -513,12 +513,12 @@ Standard_Real Approx_CurvlinFunc::GetUParameter (const Handle(Adaptor3d_Curve)&
|
||||
return U;
|
||||
}
|
||||
|
||||
Standard_Real Approx_CurvlinFunc::GetSParameter(const Handle(Adaptor3d_Curve)& C, const Standard_Real U, const Standard_Real Len) const
|
||||
Standard_Real Approx_CurvlinFunc::GetSParameter(Adaptor3d_Curve& C, const Standard_Real U, const Standard_Real Len) const
|
||||
{
|
||||
Standard_Real S, Origin;
|
||||
|
||||
Origin = C->FirstParameter();
|
||||
S = myFirstS + Length(C, Origin, U)/Len;
|
||||
Origin = C.FirstParameter();
|
||||
S = myFirstS + Length(C, Origin, U)/Len;
|
||||
return S;
|
||||
}
|
||||
|
||||
@@ -530,7 +530,7 @@ Standard_Boolean Approx_CurvlinFunc::EvalCase1(const Standard_Real S, const Stan
|
||||
gp_Vec dC_dU, dC_dS, d2C_dU2, d2C_dS2;
|
||||
Standard_Real U, Mag, dU_dS, d2U_dS2;
|
||||
|
||||
U = GetUParameter (myC3D, S, 1);
|
||||
U = GetUParameter (*myC3D, S, 1);
|
||||
|
||||
switch(Order) {
|
||||
|
||||
@@ -612,16 +612,16 @@ Standard_Boolean Approx_CurvlinFunc::EvalCurOnSur(const Standard_Real S, const S
|
||||
|
||||
if (NumberOfCurve == 1) {
|
||||
Cur2D = myC2D1;
|
||||
Surf = mySurf1;
|
||||
Handle(Adaptor3d_CurveOnSurface) CurOnSur = new Adaptor3d_CurveOnSurface(myC2D1, mySurf1);
|
||||
Surf = mySurf1;
|
||||
Adaptor3d_CurveOnSurface CurOnSur(myC2D1, mySurf1);
|
||||
U = GetUParameter(CurOnSur, S, 1);
|
||||
if(myCase == 3) Length = myLength1;
|
||||
else Length = myLength;
|
||||
}
|
||||
else if (NumberOfCurve == 2) {
|
||||
Cur2D = myC2D2;
|
||||
Surf = mySurf2;
|
||||
Handle(Adaptor3d_CurveOnSurface) CurOnSur = new Adaptor3d_CurveOnSurface(myC2D2, mySurf2);
|
||||
Surf = mySurf2;
|
||||
Adaptor3d_CurveOnSurface CurOnSur(myC2D2, mySurf2);
|
||||
U = GetUParameter(CurOnSur, S, 2);
|
||||
Length = myLength2;
|
||||
}
|
||||
|
@@ -64,14 +64,14 @@ public:
|
||||
Standard_EXPORT void Length();
|
||||
|
||||
//! Computes length of the curve segment.
|
||||
Standard_EXPORT Standard_Real Length (const Handle(Adaptor3d_Curve)& C, const Standard_Real FirstU, const Standard_Real LasrU) const;
|
||||
Standard_EXPORT Standard_Real Length (Adaptor3d_Curve& C, const Standard_Real FirstU, const Standard_Real LasrU) const;
|
||||
|
||||
Standard_EXPORT Standard_Real GetLength() const;
|
||||
|
||||
//! returns original parameter corresponding S. if
|
||||
//! Case == 1 computation is performed on myC2D1 and mySurf1,
|
||||
//! otherwise it is done on myC2D2 and mySurf2.
|
||||
Standard_EXPORT Standard_Real GetUParameter (const Handle(Adaptor3d_Curve)& C, const Standard_Real S, const Standard_Integer NumberOfCurve) const;
|
||||
Standard_EXPORT Standard_Real GetUParameter (Adaptor3d_Curve& C, const Standard_Real S, const Standard_Integer NumberOfCurve) const;
|
||||
|
||||
//! returns original parameter corresponding S.
|
||||
Standard_EXPORT Standard_Real GetSParameter (const Standard_Real U) const;
|
||||
@@ -100,10 +100,10 @@ private:
|
||||
|
||||
Standard_EXPORT void Init();
|
||||
|
||||
Standard_EXPORT void Init (const Handle(Adaptor3d_Curve)& C, Handle(TColStd_HArray1OfReal)& Si, Handle(TColStd_HArray1OfReal)& Ui) const;
|
||||
Standard_EXPORT void Init (Adaptor3d_Curve& C, Handle(TColStd_HArray1OfReal)& Si, Handle(TColStd_HArray1OfReal)& Ui) const;
|
||||
|
||||
//! returns curvilinear parameter corresponding U.
|
||||
Standard_EXPORT Standard_Real GetSParameter (const Handle(Adaptor3d_Curve)& C, const Standard_Real U, const Standard_Real Length) const;
|
||||
Standard_EXPORT Standard_Real GetSParameter (Adaptor3d_Curve& C, const Standard_Real U, const Standard_Real Length) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean EvalCurOnSur (const Standard_Real S, const Standard_Integer Order, TColStd_Array1OfReal& Result, const Standard_Integer NumberOfCurve) const;
|
||||
|
||||
|
@@ -111,7 +111,7 @@ static void ProjectPointOnCurve(const Standard_Real InitValue,
|
||||
const gp_Pnt& APoint,
|
||||
const Standard_Real Tolerance,
|
||||
const Standard_Integer NumIteration,
|
||||
const Handle(Adaptor3d_Curve)& Curve,
|
||||
const Adaptor3d_Curve& Curve,
|
||||
Standard_Boolean& Status,
|
||||
Standard_Real& Result)
|
||||
{
|
||||
@@ -125,7 +125,7 @@ static void ProjectPointOnCurve(const Standard_Real InitValue,
|
||||
do
|
||||
{
|
||||
num_iter++;
|
||||
Curve->D2(param, a_point, d1, d2);
|
||||
Curve.D2(param, a_point, d1, d2);
|
||||
vector = gp_Vec(a_point,APoint);
|
||||
|
||||
func = vector.Dot(d1);
|
||||
@@ -143,8 +143,8 @@ static void ProjectPointOnCurve(const Standard_Real InitValue,
|
||||
if( Abs(func_derivative) > Toler )
|
||||
param -= func / func_derivative;
|
||||
|
||||
param = Max(param,Curve->FirstParameter());
|
||||
param = Min(param,Curve->LastParameter());
|
||||
param = Max(param,Curve.FirstParameter());
|
||||
param = Min(param,Curve.LastParameter());
|
||||
}
|
||||
} while (not_done && num_iter <= NumIteration);
|
||||
|
||||
@@ -156,7 +156,7 @@ static void ProjectPointOnCurve(const Standard_Real InitValue,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Real ComputeTolReached(const Handle(Adaptor3d_Curve)& c3d,
|
||||
const Handle(Adaptor3d_CurveOnSurface)& cons,
|
||||
const Adaptor3d_CurveOnSurface& cons,
|
||||
const Standard_Integer nbp)
|
||||
{
|
||||
Standard_Real d2 = 0.0; // Square max discrete deviation.
|
||||
@@ -170,7 +170,7 @@ static Standard_Real ComputeTolReached(const Handle(Adaptor3d_Curve)& c3d,
|
||||
try
|
||||
{
|
||||
Pc3d = c3d->Value(u);
|
||||
Pcons = cons->Value(u);
|
||||
Pcons = cons.Value(u);
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
{
|
||||
@@ -202,7 +202,7 @@ static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
|
||||
const Standard_Integer nbp,
|
||||
const Standard_Real *pc3d,
|
||||
const Handle(Adaptor3d_Curve)& c3d,
|
||||
const Handle(Adaptor3d_CurveOnSurface)& cons,
|
||||
const Adaptor3d_CurveOnSurface& cons,
|
||||
Standard_Real& tol,
|
||||
const Standard_Real oldtol)
|
||||
{
|
||||
@@ -217,8 +217,8 @@ static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
|
||||
Standard_Real aParamFirst = 3.0 * pc3d[0] - 2.0 * pc3d[nbp - 1];
|
||||
Standard_Real aParamLast = 3.0 * pc3d[nbp - 1] - 2.0 * pc3d[0];
|
||||
|
||||
Standard_Real FirstPar = cons->FirstParameter();
|
||||
Standard_Real LastPar = cons->LastParameter();
|
||||
Standard_Real FirstPar = cons.FirstParameter();
|
||||
Standard_Real LastPar = cons.LastParameter();
|
||||
if (aParamFirst < FirstPar)
|
||||
aParamFirst = FirstPar;
|
||||
if (aParamLast > LastPar)
|
||||
@@ -247,7 +247,7 @@ static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
|
||||
return Standard_False;
|
||||
}
|
||||
tprev = tcons;
|
||||
gp_Pnt Pcons = cons->Value(tcons);
|
||||
gp_Pnt Pcons = cons.Value(tcons);
|
||||
Standard_Real temp = Pc3d.SquareDistance(Pcons);
|
||||
if(temp > d2) d2 = temp;
|
||||
}
|
||||
@@ -337,9 +337,9 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
|
||||
// Create and fill data structure.
|
||||
Approx_SameParameter_Data aData;
|
||||
aData.myCOnS = new Adaptor3d_CurveOnSurface(myHCurve2d,mySurf);
|
||||
aData.myC2dPF = aData.myCOnS->FirstParameter();
|
||||
aData.myC2dPL = aData.myCOnS->LastParameter();
|
||||
aData.myCOnS = Adaptor3d_CurveOnSurface(myHCurve2d,mySurf);
|
||||
aData.myC2dPF = aData.myCOnS.FirstParameter();
|
||||
aData.myC2dPL = aData.myCOnS.LastParameter();
|
||||
aData.myC3dPF = myC3d->FirstParameter();
|
||||
aData.myC3dPL = myC3d->LastParameter();
|
||||
aData.myNbPnt = 0; // No points initially.
|
||||
@@ -376,7 +376,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
if(aData.myNbPnt < aNbPnt )
|
||||
{
|
||||
myTolReached = ComputeTolReached(myC3d,aData.myCOnS, 2 * myNbSamples);
|
||||
myCurve2d = Geom2dAdaptor::MakeCurve (myHCurve2d);
|
||||
myCurve2d = Geom2dAdaptor::MakeCurve (*myHCurve2d);
|
||||
myDone = Standard_False;
|
||||
return;
|
||||
}
|
||||
@@ -444,11 +444,11 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
|
||||
if (anApproximator.IsDone() || anApproximator.HasResult())
|
||||
{
|
||||
Handle(Adaptor3d_CurveOnSurface) ACS = Handle(Adaptor3d_CurveOnSurface)::DownCast(aData.myCOnS->ShallowCopy());
|
||||
Adaptor3d_CurveOnSurface ACS = aData.myCOnS;
|
||||
GeomLib_MakeCurvefromApprox aCurveBuilder(anApproximator);
|
||||
Handle(Geom2d_BSplineCurve) aC2d = aCurveBuilder.Curve2dFromTwo1d(1,2);
|
||||
Handle(Adaptor2d_Curve2d) aHCurve2d = new Geom2dAdaptor_Curve(aC2d);
|
||||
aData.myCOnS->Load(aHCurve2d);
|
||||
aData.myCOnS.Load(aHCurve2d);
|
||||
myTolReached = ComputeTolReached(myC3d,aData.myCOnS, 2 * myNbSamples);
|
||||
|
||||
const Standard_Real aMult = 250.0; // To be tolerant with discrete tolerance.
|
||||
@@ -482,9 +482,9 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
// using data from the last loop iteration or initial data. Use data set with minimal deflection.
|
||||
|
||||
// Original 2d curve.
|
||||
aData.myCOnS->Load(myHCurve2d);
|
||||
aData.myCOnS.Load(myHCurve2d);
|
||||
myTolReached = ComputeTolReached(myC3d,aData.myCOnS, 2 * myNbSamples);
|
||||
myCurve2d = Geom2dAdaptor::MakeCurve (myHCurve2d);
|
||||
myCurve2d = Geom2dAdaptor::MakeCurve (*myHCurve2d);
|
||||
|
||||
// Approximation curve.
|
||||
Standard_Integer num_knots = aData.myNbPnt + 7;
|
||||
@@ -515,7 +515,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
GeomLib_MakeCurvefromApprox aCurveBuilder(anApproximator);
|
||||
Handle(Geom2d_BSplineCurve) aC2d = aCurveBuilder.Curve2dFromTwo1d(1,2);
|
||||
Handle(Adaptor2d_Curve2d) aHCurve2d = new Geom2dAdaptor_Curve(aC2d);
|
||||
aData.myCOnS->Load(aHCurve2d);
|
||||
aData.myCOnS.Load(aHCurve2d);
|
||||
|
||||
Standard_Real anApproxTol = ComputeTolReached(myC3d,aData.myCOnS,2 * myNbSamples);
|
||||
if (anApproxTol < myTolReached)
|
||||
@@ -527,7 +527,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
myDone = Standard_True;
|
||||
}
|
||||
|
||||
myCurveOnSurface = Handle(Adaptor3d_CurveOnSurface)::DownCast(aData.myCOnS->ShallowCopy());
|
||||
myCurveOnSurface = Handle(Adaptor3d_CurveOnSurface)::DownCast(aData.myCOnS.ShallowCopy());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -643,18 +643,18 @@ Standard_Boolean Approx_SameParameter::CheckSameParameter(Approx_SameParameter_D
|
||||
|
||||
// Compute initial distance on boundary points.
|
||||
gp_Pnt Pcons, Pc3d;
|
||||
theData.myCOnS->D0(theData.myC2dPF, Pcons);
|
||||
theData.myCOnS.D0(theData.myC2dPF, Pcons);
|
||||
myC3d->D0(theData.myC3dPF, Pc3d);
|
||||
Standard_Real dist2 = Pcons.SquareDistance(Pc3d);
|
||||
Standard_Real dmax2 = dist2;
|
||||
|
||||
theData.myCOnS->D0(theData.myC2dPL, Pcons);
|
||||
theData.myCOnS.D0(theData.myC2dPL, Pcons);
|
||||
myC3d->D0(theData.myC3dPL, Pc3d);
|
||||
dist2 = Pcons.SquareDistance(Pc3d);
|
||||
dmax2 = Max(dmax2, dist2);
|
||||
|
||||
Extrema_LocateExtPC Projector;
|
||||
Projector.Initialize (myC3d, theData.myC3dPF, theData.myC3dPL, theData.myTol);
|
||||
Projector.Initialize (*myC3d, theData.myC3dPF, theData.myC3dPL, theData.myTol);
|
||||
|
||||
Standard_Integer count = 1;
|
||||
Standard_Real previousp = theData.myC3dPF, initp=0, curp;
|
||||
@@ -662,7 +662,7 @@ Standard_Boolean Approx_SameParameter::CheckSameParameter(Approx_SameParameter_D
|
||||
Standard_Boolean isProjOk = Standard_False;
|
||||
for (Standard_Integer ii = 1; ii < theData.myNbPnt; ii++)
|
||||
{
|
||||
theData.myCOnS->D0(theData.myPC2d[ii],Pcons);
|
||||
theData.myCOnS.D0(theData.myPC2d[ii],Pcons);
|
||||
myC3d->D0(theData.myPC3d[ii],Pc3d);
|
||||
dist2 = Pcons.SquareDistance(Pc3d);
|
||||
|
||||
@@ -692,7 +692,7 @@ Standard_Boolean Approx_SameParameter::CheckSameParameter(Approx_SameParameter_D
|
||||
}
|
||||
else
|
||||
{
|
||||
ProjectPointOnCurve(initp,Pcons,theData.myTol,30, myC3d,isProjOk,curp);
|
||||
ProjectPointOnCurve(initp,Pcons,theData.myTol,30, *myC3d,isProjOk,curp);
|
||||
}
|
||||
isProjOk = isProjOk && // Good projection.
|
||||
curp > previousp + myDeltaMin && // Point is separated from previous.
|
||||
@@ -706,7 +706,7 @@ Standard_Boolean Approx_SameParameter::CheckSameParameter(Approx_SameParameter_D
|
||||
}
|
||||
|
||||
// Whole parameter space search using general extrema.
|
||||
Extrema_ExtPC PR(Pcons, myC3d, theData.myC3dPF, theData.myC3dPL, theData.myTol);
|
||||
Extrema_ExtPC PR(Pcons, *myC3d, theData.myC3dPF, theData.myC3dPL, theData.myTol);
|
||||
if (!PR.IsDone() || PR.NbExt() == 0) // Lazy evaluation is used.
|
||||
continue;
|
||||
|
||||
@@ -747,7 +747,7 @@ Standard_Boolean Approx_SameParameter::CheckSameParameter(Approx_SameParameter_D
|
||||
//function : ComputeTangents
|
||||
//purpose : Sub-method in Build.
|
||||
//=======================================================================
|
||||
Standard_Boolean Approx_SameParameter::ComputeTangents(const Handle(Adaptor3d_CurveOnSurface) & theCOnS,
|
||||
Standard_Boolean Approx_SameParameter::ComputeTangents(const Adaptor3d_CurveOnSurface & theCOnS,
|
||||
Standard_Real &theFirstTangent,
|
||||
Standard_Real &theLastTangent) const
|
||||
{
|
||||
@@ -758,7 +758,7 @@ Standard_Boolean Approx_SameParameter::ComputeTangents(const Handle(Adaptor3d_Cu
|
||||
|
||||
// First point.
|
||||
const Standard_Real aParamFirst = myC3d->FirstParameter();
|
||||
theCOnS->D1(aParamFirst, aPntCOnS, aVecConS);
|
||||
theCOnS.D1(aParamFirst, aPntCOnS, aVecConS);
|
||||
myC3d->D1(aParamFirst, aPnt, aVec);
|
||||
Standard_Real aMagnitude = aVecConS.Magnitude();
|
||||
if (aMagnitude > aSmallMagnitude)
|
||||
@@ -768,7 +768,7 @@ Standard_Boolean Approx_SameParameter::ComputeTangents(const Handle(Adaptor3d_Cu
|
||||
|
||||
// Last point.
|
||||
const Standard_Real aParamLast = myC3d->LastParameter();
|
||||
theCOnS->D1(aParamLast,aPntCOnS,aVecConS);
|
||||
theCOnS.D1(aParamLast,aPntCOnS,aVecConS);
|
||||
myC3d->D1(aParamLast, aPnt, aVec);
|
||||
|
||||
aMagnitude = aVecConS.Magnitude();
|
||||
@@ -834,7 +834,7 @@ Standard_Boolean Approx_SameParameter::IncreaseNbPoles(const TColStd_Array1OfRea
|
||||
Standard_Real &theBestSqTol) const
|
||||
{
|
||||
Extrema_LocateExtPC Projector;
|
||||
Projector.Initialize (myC3d, myC3d->FirstParameter(), myC3d->LastParameter(), theData.myTol);
|
||||
Projector.Initialize (*myC3d, myC3d->FirstParameter(), myC3d->LastParameter(), theData.myTol);
|
||||
Standard_Real curp = 0.0;
|
||||
Standard_Boolean projok = Standard_False;
|
||||
|
||||
@@ -862,7 +862,7 @@ Standard_Boolean Approx_SameParameter::IncreaseNbPoles(const TColStd_Array1OfRea
|
||||
Standard_Real uc3d = 0.5*(theData.myPC3d[ii]+theData.myPC3d[ii+1]);
|
||||
|
||||
gp_Pnt Pcons;
|
||||
theData.myCOnS->D0(ucons,Pcons);
|
||||
theData.myCOnS.D0(ucons,Pcons);
|
||||
Projector.Perform(Pcons, uc3d);
|
||||
if (Projector.IsDone())
|
||||
{
|
||||
@@ -873,7 +873,7 @@ Standard_Boolean Approx_SameParameter::IncreaseNbPoles(const TColStd_Array1OfRea
|
||||
}
|
||||
else
|
||||
{
|
||||
ProjectPointOnCurve(uc3d,Pcons,theData.myTol,30, myC3d,projok,curp);
|
||||
ProjectPointOnCurve(uc3d,Pcons,theData.myTol,30, *myC3d,projok,curp);
|
||||
}
|
||||
if(projok)
|
||||
{
|
||||
@@ -910,7 +910,7 @@ Standard_Boolean Approx_SameParameter::IncreaseNbPoles(const TColStd_Array1OfRea
|
||||
Standard_Real uc3d = 0.5*(theData.myPC3d[n]+theData.myPC3d[n+1]);
|
||||
|
||||
gp_Pnt Pcons;
|
||||
theData.myCOnS->D0(ucons,Pcons);
|
||||
theData.myCOnS.D0(ucons,Pcons);
|
||||
Projector.Perform(Pcons, uc3d);
|
||||
if (Projector.IsDone())
|
||||
{
|
||||
@@ -921,7 +921,7 @@ Standard_Boolean Approx_SameParameter::IncreaseNbPoles(const TColStd_Array1OfRea
|
||||
}
|
||||
else
|
||||
{
|
||||
ProjectPointOnCurve(uc3d,Pcons,theData.myTol,30, myC3d,projok,curp);
|
||||
ProjectPointOnCurve(uc3d,Pcons,theData.myTol,30, *myC3d,projok,curp);
|
||||
}
|
||||
if(projok)
|
||||
{
|
||||
|
@@ -103,7 +103,7 @@ private:
|
||||
//! a lot of memory is used in intermediate computations.
|
||||
struct Approx_SameParameter_Data
|
||||
{
|
||||
Handle(Adaptor3d_CurveOnSurface) myCOnS; // Curve on surface.
|
||||
Adaptor3d_CurveOnSurface myCOnS; // Curve on surface.
|
||||
Standard_Integer myNbPnt; // Number of points.
|
||||
Standard_Real *myPC3d; // Parameters on 3d curve.
|
||||
Standard_Real *myPC2d; // Parameters on 2d curve.
|
||||
@@ -155,7 +155,7 @@ private:
|
||||
|
||||
//! Computes tangents on boundary points.
|
||||
//@return true if tangents are not null and false otherwise.
|
||||
Standard_Boolean ComputeTangents(const Handle(Adaptor3d_CurveOnSurface) & theCOnS,
|
||||
Standard_Boolean ComputeTangents(const Adaptor3d_CurveOnSurface & theCOnS,
|
||||
Standard_Real &theFirstTangent,
|
||||
Standard_Real &theLastTangent) const;
|
||||
|
||||
|
@@ -640,7 +640,7 @@ void BOPAlgo_Builder::FillSameDomainFaces(const Message_ProgressRange& theRange)
|
||||
{
|
||||
// At this stage, context should contain adaptor for all intersected faces,
|
||||
// so getting a type of the underlying surface should be done at no cost.
|
||||
if (myContext->SurfaceAdaptor(TopoDS::Face(aF))->GetType() == GeomAbs_Plane)
|
||||
if (myContext->SurfaceAdaptor(TopoDS::Face(aF)).GetType() == GeomAbs_Plane)
|
||||
{
|
||||
// Check bounding box of the face - it should not be open in any side
|
||||
const Bnd_Box& aBox = aSI.Box();
|
||||
|
@@ -889,7 +889,7 @@ Standard_Boolean BOPAlgo_PaveFiller::GetPBBox(const TopoDS_Edge& theE,
|
||||
}
|
||||
else {
|
||||
// build bounding box
|
||||
Handle(BRepAdaptor_Curve) aBAC = new BRepAdaptor_Curve(theE);
|
||||
BRepAdaptor_Curve aBAC(theE);
|
||||
Standard_Real aTol = BRep_Tool::Tolerance(theE) + Precision::Confusion();
|
||||
BndLib_Add3dCurve::Add(aBAC, theSFirst, theSLast, aTol, theBox);
|
||||
thePBBox.Bind(thePB, theBox);
|
||||
|
@@ -373,9 +373,9 @@ void BOPAlgo_PaveFiller::PerformEF(const Message_ProgressRange& theRange)
|
||||
//
|
||||
Standard_Boolean bLinePlane = Standard_False;
|
||||
if (aNbCPrts) {
|
||||
Handle(BRepAdaptor_Curve) aBAC = new BRepAdaptor_Curve(aE);
|
||||
bLinePlane = (aBAC->GetType() == GeomAbs_Line &&
|
||||
myContext->SurfaceAdaptor(aF)->GetType() == GeomAbs_Plane);
|
||||
BRepAdaptor_Curve aBAC(aE);
|
||||
bLinePlane = (aBAC.GetType() == GeomAbs_Line &&
|
||||
myContext->SurfaceAdaptor(aF).GetType() == GeomAbs_Plane);
|
||||
}
|
||||
//
|
||||
for (i=1; i<=aNbCPrts; ++i) {
|
||||
@@ -916,7 +916,7 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB
|
||||
|
||||
// Projection tool
|
||||
GeomAPI_ProjectPointOnSurf& aProjPS = myContext->ProjPS(aF);
|
||||
const Handle(BRepAdaptor_Surface)& aSurfAdaptor = myContext->SurfaceAdaptor (aF);
|
||||
BRepAdaptor_Surface& aSurfAdaptor = myContext->SurfaceAdaptor (aF);
|
||||
|
||||
// Iterate on pave blocks and combine pairs containing
|
||||
// the same vertices
|
||||
@@ -996,7 +996,7 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB
|
||||
if (!myContext->IsPointInFace(aF, gp_Pnt2d(U, V)))
|
||||
continue;
|
||||
|
||||
if (aSurfAdaptor->GetType() != GeomAbs_Plane ||
|
||||
if (aSurfAdaptor.GetType() != GeomAbs_Plane ||
|
||||
aBAC.GetType() != GeomAbs_Line)
|
||||
{
|
||||
gp_Pnt aPOnS = aProjPS.NearestPoint();
|
||||
|
@@ -62,6 +62,7 @@
|
||||
#include <IntTools_SequenceOfCurves.hxx>
|
||||
#include <IntTools_SequenceOfPntOn2Faces.hxx>
|
||||
#include <IntTools_Tools.hxx>
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
@@ -76,8 +77,8 @@
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
|
||||
//
|
||||
static Standard_Real ToleranceFF(const Handle(BRepAdaptor_Surface)& aBAS1,
|
||||
const Handle(BRepAdaptor_Surface)& aBAS2);
|
||||
static Standard_Real ToleranceFF(const BRepAdaptor_Surface& aBAS1,
|
||||
const BRepAdaptor_Surface& aBAS2);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
@@ -322,10 +323,10 @@ void BOPAlgo_PaveFiller::PerformFF(const Message_ProgressRange& theRange)
|
||||
const TopoDS_Face& aF1 = (*(TopoDS_Face *)(&myDS->Shape(nF1)));
|
||||
const TopoDS_Face& aF2 = (*(TopoDS_Face *)(&myDS->Shape(nF2)));
|
||||
//
|
||||
const Handle(BRepAdaptor_Surface)& aBAS1 = myContext->SurfaceAdaptor(aF1);
|
||||
const Handle(BRepAdaptor_Surface)& aBAS2 = myContext->SurfaceAdaptor(aF2);
|
||||
if (aBAS1->GetType() == GeomAbs_Plane &&
|
||||
aBAS2->GetType() == GeomAbs_Plane) {
|
||||
const BRepAdaptor_Surface& aBAS1 = myContext->SurfaceAdaptor(aF1);
|
||||
const BRepAdaptor_Surface& aBAS2 = myContext->SurfaceAdaptor(aF2);
|
||||
if (aBAS1.GetType() == GeomAbs_Plane &&
|
||||
aBAS2.GetType() == GeomAbs_Plane) {
|
||||
// Check if the planes are really interfering
|
||||
Standard_Boolean bToIntersect = CheckPlanes(nF1, nF2);
|
||||
if (!bToIntersect) {
|
||||
@@ -347,8 +348,8 @@ void BOPAlgo_PaveFiller::PerformFF(const Message_ProgressRange& theRange)
|
||||
// Keep shift value to use it as the tolerance for intersection curves
|
||||
Standard_Real aShiftValue = 0.;
|
||||
|
||||
if (aBAS1->GetType() != GeomAbs_Plane ||
|
||||
aBAS2->GetType() != GeomAbs_Plane) {
|
||||
if (aBAS1.GetType() != GeomAbs_Plane ||
|
||||
aBAS2.GetType() != GeomAbs_Plane) {
|
||||
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
for (TopExp_Explorer aExp1(aF1, TopAbs_EDGE); !isFound && aExp1.More(); aExp1.Next())
|
||||
@@ -578,14 +579,12 @@ void BOPAlgo_PaveFiller::MakeBlocks(const Message_ProgressRange& theRange)
|
||||
Standard_Integer i, nF1, nF2, aNbC, aNbP, j;
|
||||
Standard_Integer nV1, nV2;
|
||||
Standard_Real aT1, aT2;
|
||||
Handle(NCollection_BaseAllocator) aAllocator;
|
||||
Handle(NCollection_BaseAllocator) aAllocator = new NCollection_IncAllocator;
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
|
||||
TopoDS_Edge aES;
|
||||
Handle(BOPDS_PaveBlock) aPBOut;
|
||||
//
|
||||
//-----------------------------------------------------scope f
|
||||
aAllocator=
|
||||
NCollection_BaseAllocator::CommonBaseAllocator();
|
||||
//
|
||||
TColStd_ListOfInteger aLSE(aAllocator), aLBV(aAllocator);
|
||||
TColStd_MapOfInteger aMVOnIn(100, aAllocator), aMVCommon(100, aAllocator),
|
||||
@@ -785,7 +784,7 @@ void BOPAlgo_PaveFiller::MakeBlocks(const Message_ProgressRange& theRange)
|
||||
//
|
||||
// check if the pave block has a valid range
|
||||
Standard_Real aFirst, aLast;
|
||||
if (!BRepLib::FindValidRange(new GeomAdaptor_Curve(aIC.Curve()), aTolR3D,
|
||||
if (!BRepLib::FindValidRange(GeomAdaptor_Curve(aIC.Curve()), aTolR3D,
|
||||
aT1, BRep_Tool::Pnt(aV1), Max (aTolR3D, BRep_Tool::Tolerance(aV1)),
|
||||
aT2, BRep_Tool::Pnt(aV2), Max (aTolR3D, BRep_Tool::Tolerance(aV2)),
|
||||
aFirst, aLast))
|
||||
@@ -3176,7 +3175,7 @@ void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
|
||||
// Check if there will be valid range on the curve
|
||||
Standard_Real aFirst, aLast;
|
||||
Standard_Real aNewTolV = Max(aTolV, aDistVP + BOPTools_AlgoTools::DTolerance());
|
||||
if (!BRepLib::FindValidRange(new GeomAdaptor_Curve(aIC.Curve()), aIC.Tolerance(),
|
||||
if (!BRepLib::FindValidRange(GeomAdaptor_Curve(aIC.Curve()), aIC.Tolerance(),
|
||||
aT[0], aP[0], aNewTolV,
|
||||
aT[1], aP[1], aNewTolV,
|
||||
aFirst, aLast))
|
||||
@@ -3479,25 +3478,25 @@ void BOPAlgo_PaveFiller::RemovePaveBlocks(const TColStd_MapOfInteger& theEdges)
|
||||
//purpose : Computes the TolFF according to the tolerance value and
|
||||
// types of the faces.
|
||||
//=======================================================================
|
||||
Standard_Real ToleranceFF(const Handle(BRepAdaptor_Surface)& aBAS1,
|
||||
const Handle(BRepAdaptor_Surface)& aBAS2)
|
||||
Standard_Real ToleranceFF(const BRepAdaptor_Surface& aBAS1,
|
||||
const BRepAdaptor_Surface& aBAS2)
|
||||
{
|
||||
Standard_Real aTol1 = aBAS1->Tolerance();
|
||||
Standard_Real aTol2 = aBAS2->Tolerance();
|
||||
Standard_Real aTol1 = aBAS1.Tolerance();
|
||||
Standard_Real aTol2 = aBAS2.Tolerance();
|
||||
Standard_Real aTolFF = Max(aTol1, aTol2);
|
||||
//
|
||||
Standard_Boolean isAna1, isAna2;
|
||||
isAna1 = (aBAS1->GetType() == GeomAbs_Plane ||
|
||||
aBAS1->GetType() == GeomAbs_Cylinder ||
|
||||
aBAS1->GetType() == GeomAbs_Cone ||
|
||||
aBAS1->GetType() == GeomAbs_Sphere ||
|
||||
aBAS1->GetType() == GeomAbs_Torus);
|
||||
isAna1 = (aBAS1.GetType() == GeomAbs_Plane ||
|
||||
aBAS1.GetType() == GeomAbs_Cylinder ||
|
||||
aBAS1.GetType() == GeomAbs_Cone ||
|
||||
aBAS1.GetType() == GeomAbs_Sphere ||
|
||||
aBAS1.GetType() == GeomAbs_Torus);
|
||||
//
|
||||
isAna2 = (aBAS2->GetType() == GeomAbs_Plane ||
|
||||
aBAS2->GetType() == GeomAbs_Cylinder ||
|
||||
aBAS2->GetType() == GeomAbs_Cone ||
|
||||
aBAS2->GetType() == GeomAbs_Sphere ||
|
||||
aBAS2->GetType() == GeomAbs_Torus);
|
||||
isAna2 = (aBAS2.GetType() == GeomAbs_Plane ||
|
||||
aBAS2.GetType() == GeomAbs_Cylinder ||
|
||||
aBAS2.GetType() == GeomAbs_Cone ||
|
||||
aBAS2.GetType() == GeomAbs_Sphere ||
|
||||
aBAS2.GetType() == GeomAbs_Torus);
|
||||
//
|
||||
if (!isAna1 || !isAna2) {
|
||||
aTolFF = Max(aTolFF, 5.e-6);
|
||||
|
@@ -277,8 +277,8 @@ class BOPAlgo_MPC : public BOPAlgo_ParallelAlgo {
|
||||
}
|
||||
else
|
||||
{
|
||||
const Handle(BRepAdaptor_Surface)& aBAS = myContext->SurfaceAdaptor(myF);
|
||||
if (aBAS->IsUPeriodic() || aBAS->IsVPeriodic())
|
||||
const BRepAdaptor_Surface& aBAS = myContext->SurfaceAdaptor(myF);
|
||||
if (aBAS.IsUPeriodic() || aBAS.IsVPeriodic())
|
||||
{
|
||||
// The curve already exists. Adjust it for periodic cases.
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnSurf
|
||||
|
@@ -254,15 +254,15 @@ void BOPAlgo_PaveFiller::ProcessDE(const Message_ProgressRange& theRange)
|
||||
const TopoDS_Face& aDF = (*(TopoDS_Face *)(&myDS->Shape(nFD)));
|
||||
//
|
||||
Standard_Real aTolV = BRep_Tool::Tolerance(aDV);
|
||||
const Handle(BRepAdaptor_Surface)& aBAS = myContext->SurfaceAdaptor(aDF);
|
||||
const BRepAdaptor_Surface& aBAS = myContext->SurfaceAdaptor(aDF);
|
||||
//
|
||||
// 2D intersection tolerance should be computed as a resolution
|
||||
// from the tolerance of vertex to resolve the touching cases
|
||||
Standard_Real aTolInt = Precision::PConfusion();
|
||||
// UResolution from the tolerance of the vertex
|
||||
Standard_Real aURes = aBAS->UResolution(aTolV);
|
||||
Standard_Real aURes = aBAS.UResolution(aTolV);
|
||||
// VResolution from the tolerance of the vertex
|
||||
Standard_Real aVRes = aBAS->VResolution(aTolV);
|
||||
Standard_Real aVRes = aBAS.VResolution(aTolV);
|
||||
//
|
||||
aTolInt = Max(aTolInt, Max(aURes, aVRes));
|
||||
//
|
||||
@@ -279,7 +279,8 @@ void BOPAlgo_PaveFiller::ProcessDE(const Message_ProgressRange& theRange)
|
||||
aTolCmp = Max(aTolCmp, (bUDir ? aURes : aVRes));
|
||||
//
|
||||
// Prepare adaptor for the degenerated edge for intersection
|
||||
Handle(Geom2dAdaptor_Curve) aGAC1 = new Geom2dAdaptor_Curve(aC2DDE, aTD1, aTD2);
|
||||
Geom2dAdaptor_Curve aGAC1;
|
||||
aGAC1.Load(aC2DDE, aTD1, aTD2);
|
||||
//
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPBOut);
|
||||
for (; aItLPB.More(); aItLPB.Next()) {
|
||||
@@ -296,14 +297,14 @@ void BOPAlgo_PaveFiller::ProcessDE(const Message_ProgressRange& theRange)
|
||||
}
|
||||
//
|
||||
// Prepare adaptor for the passing edge for intersection
|
||||
Handle(Geom2dAdaptor_Curve) aGAC2 = new Geom2dAdaptor_Curve();
|
||||
Geom2dAdaptor_Curve aGAC2;
|
||||
//
|
||||
Handle(Geom2d_Line) aL2D = Handle(Geom2d_Line)::DownCast(aC2D);
|
||||
if (!aL2D.IsNull()) {
|
||||
aGAC2->Load(aC2D);
|
||||
aGAC2.Load(aC2D);
|
||||
}
|
||||
else {
|
||||
aGAC2->Load(aC2D, aT1, aT2);
|
||||
aGAC2.Load(aC2D, aT1, aT2);
|
||||
}
|
||||
// Intersection
|
||||
Geom2dInt_GInter aGInter(aGAC1, aGAC2, aTolInt, aTolInt);
|
||||
|
@@ -248,167 +248,178 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
|
||||
//
|
||||
// Build the shells
|
||||
aItF.Initialize (aLFConnected);
|
||||
for (i = 1; aItF.More() && !bAllFacesTaken; aItF.Next(), ++i) {
|
||||
for (i = 1; aItF.More() && !bAllFacesTaken; aItF.Next(), ++i)
|
||||
{
|
||||
const TopoDS_Shape& aFF = aItF.Value();
|
||||
if (!AddedFacesMap.Add(aFF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// make a new shell
|
||||
TopoDS_Shell aShellStart;
|
||||
aBB.MakeShell(aShellStart);
|
||||
aBB.Add(aShellStart, aFF);
|
||||
TopoDS_Shell aShell;
|
||||
aBB.MakeShell(aShell);
|
||||
aBB.Add(aShell, aFF);
|
||||
|
||||
aMEFP.Clear();
|
||||
TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEFP);
|
||||
//
|
||||
TopTools_ListOfShape aLShells;
|
||||
aLShells.Append(aShellStart);
|
||||
//
|
||||
TopTools_ListIteratorOfListOfShape aItLShells(aLShells);
|
||||
for (; aItLShells.More(); aItLShells.Next()) {
|
||||
TopoDS_Shell& aShell = TopoDS::Shell(aItLShells.ChangeValue());
|
||||
// loop on faces added to Shell;
|
||||
// add their neighbor faces to Shell and so on
|
||||
aItS.Initialize(aShell);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Face& aF = (*(TopoDS_Face*)(&aItS.Value()));
|
||||
Standard_Boolean isBoundary = aBoundaryFaces.Contains (aF);
|
||||
//
|
||||
aMEFP.Clear();
|
||||
TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEFP);
|
||||
//
|
||||
// loop on faces added to Shell;
|
||||
// add their neighbor faces to Shell and so on
|
||||
aItS.Initialize(aShell);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Face& aF = (*(TopoDS_Face*)(&aItS.Value()));
|
||||
Standard_Boolean isBoundary = aBoundaryFaces.Contains (aF);
|
||||
// loop on edges of aF; find a good neighbor face of aF by aE
|
||||
aExp.Init(aF, TopAbs_EDGE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Edge& aE = (*(TopoDS_Edge*)(&aExp.Current()));
|
||||
//
|
||||
// loop on edges of aF; find a good neighbor face of aF by aE
|
||||
aExp.Init(aF, TopAbs_EDGE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Edge& aE = (*(TopoDS_Edge*)(&aExp.Current()));
|
||||
//
|
||||
// proceed only free edges in this shell
|
||||
if (aMEFP.Contains(aE)) {
|
||||
const TopTools_ListOfShape& aLFP = aMEFP.FindFromKey(aE);
|
||||
aNbFP = aLFP.Extent();
|
||||
if (aNbFP > 1) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// avoid processing of internal edges
|
||||
anOr = aE.Orientation();
|
||||
if (anOr == TopAbs_INTERNAL) {
|
||||
// proceed only free edges in this shell
|
||||
if (aMEFP.Contains(aE)) {
|
||||
const TopTools_ListOfShape& aLFP = aMEFP.FindFromKey(aE);
|
||||
aNbFP = aLFP.Extent();
|
||||
if (aNbFP > 1) {
|
||||
continue;
|
||||
}
|
||||
// avoid processing of degenerated edges
|
||||
if (BRep_Tool::Degenerated(aE)) {
|
||||
}
|
||||
// avoid processing of internal edges
|
||||
anOr = aE.Orientation();
|
||||
if (anOr == TopAbs_INTERNAL) {
|
||||
continue;
|
||||
}
|
||||
// avoid processing of degenerated edges
|
||||
if (BRep_Tool::Degenerated(aE)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// candidate faces list
|
||||
const TopTools_ListOfShape& aLF = aEFMap.FindFromKey(aE);
|
||||
aNbLF = aLF.Extent();
|
||||
if (!aNbLF) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// prepare for selecting the next face
|
||||
// take only not-processed faces as a candidates
|
||||
BOPTools_ListOfCoupleOfShape aLCSOff;
|
||||
//
|
||||
Standard_Integer aNbWaysInside = 0;
|
||||
TopoDS_Face aSelF;
|
||||
TopTools_ListIteratorOfListOfShape aItLF(aLF);
|
||||
for (; aItLF.More(); aItLF.Next()) {
|
||||
const TopoDS_Face& aFL = (*(TopoDS_Face*)(&aItLF.Value()));
|
||||
if (aF.IsSame(aFL) || AddedFacesMap.Contains(aFL)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// candidate faces list
|
||||
const TopTools_ListOfShape& aLF = aEFMap.FindFromKey(aE);
|
||||
aNbLF = aLF.Extent();
|
||||
if (!aNbLF) {
|
||||
// find current edge in the face
|
||||
if (!BOPTools_AlgoTools::GetEdgeOff(aE, aFL, aEL)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// prepare for selecting the next face
|
||||
// take only not-processed faces as a candidates
|
||||
BOPTools_ListOfCoupleOfShape aLCSOff;
|
||||
//
|
||||
Standard_Integer aNbWaysInside = 0;
|
||||
TopoDS_Face aSelF;
|
||||
TopTools_ListIteratorOfListOfShape aItLF(aLF);
|
||||
for (; aItLF.More(); aItLF.Next()) {
|
||||
const TopoDS_Face& aFL = (*(TopoDS_Face*)(&aItLF.Value()));
|
||||
if (aF.IsSame(aFL) || AddedFacesMap.Contains(aFL)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// find current edge in the face
|
||||
if (!BOPTools_AlgoTools::GetEdgeOff(aE, aFL, aEL)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (isBoundary && !aBoundaryFaces.Contains (aFL))
|
||||
{
|
||||
++aNbWaysInside;
|
||||
aSelF = aFL;
|
||||
}
|
||||
aCSOff.SetShape1(aEL);
|
||||
aCSOff.SetShape2(aFL);
|
||||
aLCSOff.Append(aCSOff);
|
||||
}//for (; aItLF.More(); aItLF.Next()) {
|
||||
//
|
||||
aNbOff = aLCSOff.Extent();
|
||||
if (!aNbOff){
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// among all the adjacent faces chose one with the minimal
|
||||
// angle to the current one
|
||||
if (!isBoundary || aNbWaysInside != 1)
|
||||
if (isBoundary && !aBoundaryFaces.Contains (aFL))
|
||||
{
|
||||
if (aNbOff == 1) {
|
||||
aSelF = (*(TopoDS_Face*)(&aLCSOff.First().Shape2()));
|
||||
}
|
||||
else if (aNbOff > 1) {
|
||||
BOPTools_AlgoTools::GetFaceOff(aE, aF, aLCSOff, aSelF, aContext);
|
||||
}
|
||||
++aNbWaysInside;
|
||||
aSelF = aFL;
|
||||
}
|
||||
//
|
||||
if (!aSelF.IsNull() && AddedFacesMap.Add(aSelF)) {
|
||||
aBB.Add(aShell, aSelF);
|
||||
TopExp::MapShapesAndAncestors(aSelF, TopAbs_EDGE, TopAbs_FACE, aMEFP);
|
||||
}
|
||||
} // for (; aExp.More(); aExp.Next()) {
|
||||
} // for (; aItS.More(); aItS.Next()) {
|
||||
//
|
||||
// split the shell on multi-connected edges
|
||||
TopTools_ListOfShape aLShSp;
|
||||
RefineShell(aShell, aMEFP, aLShSp);
|
||||
//
|
||||
// collect the not closed shells for further processing
|
||||
TopTools_ListOfShape aLShNC;
|
||||
//
|
||||
TopTools_ListIteratorOfListOfShape aItLShSp(aLShSp);
|
||||
for (; aItLShSp.More(); aItLShSp.Next()) {
|
||||
TopoDS_Shell& aShSp = *((TopoDS_Shell*)&aItLShSp.Value());
|
||||
aCSOff.SetShape1(aEL);
|
||||
aCSOff.SetShape2(aFL);
|
||||
aLCSOff.Append(aCSOff);
|
||||
}//for (; aItLF.More(); aItLF.Next()) {
|
||||
//
|
||||
if (BRep_Tool::IsClosed(aShSp)) {
|
||||
aShSp.Closed(Standard_True);
|
||||
myLoops.Append(aShSp);
|
||||
aNbOff = aLCSOff.Extent();
|
||||
if (!aNbOff){
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
aLShNC.Append(aShSp);
|
||||
}
|
||||
}
|
||||
//
|
||||
bAllFacesTaken = (AddedFacesMap.Extent() == aNbShapes);
|
||||
if (bAllFacesTaken) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
if (aLShSp.Extent() == 1) {
|
||||
// not further processing of not closed shells is needed,
|
||||
// as it will not bring any new results
|
||||
continue;
|
||||
}
|
||||
//
|
||||
Standard_Integer aNbShNC = aLShNC.Extent();
|
||||
if (aNbShNC == 1) {
|
||||
// try to complete the shell with other faces
|
||||
aLShells.Append(aLShNC);
|
||||
}
|
||||
else if (aNbShNC > 1) {
|
||||
// remove th faces of not closed shells from the map of processed faces
|
||||
// and try to rebuild the shells using all not processed faces,
|
||||
// because faces of one shell might be needed for building the other
|
||||
TopTools_ListIteratorOfListOfShape aItLShNC(aLShNC);
|
||||
for (; aItLShNC.More(); aItLShNC.Next()) {
|
||||
TopoDS_Iterator aItNC(aItLShNC.Value());
|
||||
for (; aItNC.More(); aItNC.Next()) {
|
||||
AddedFacesMap.Remove(aItNC.Value());
|
||||
//
|
||||
// among all the adjacent faces chose one with the minimal
|
||||
// angle to the current one
|
||||
if (!isBoundary || aNbWaysInside != 1)
|
||||
{
|
||||
if (aNbOff == 1) {
|
||||
aSelF = (*(TopoDS_Face*)(&aLCSOff.First().Shape2()));
|
||||
}
|
||||
else if (aNbOff > 1) {
|
||||
BOPTools_AlgoTools::GetFaceOff(aE, aF, aLCSOff, aSelF, aContext);
|
||||
}
|
||||
}
|
||||
//
|
||||
if (!aSelF.IsNull() && AddedFacesMap.Add(aSelF)) {
|
||||
aBB.Add(aShell, aSelF);
|
||||
TopExp::MapShapesAndAncestors(aSelF, TopAbs_EDGE, TopAbs_FACE, aMEFP);
|
||||
}
|
||||
} // for (; aExp.More(); aExp.Next()) {
|
||||
} // for (; aItS.More(); aItS.Next()) {
|
||||
//
|
||||
// split the shell on multi-connected edges
|
||||
TopTools_ListOfShape aLShSp;
|
||||
RefineShell(aShell, aMEFP, aLShSp);
|
||||
//
|
||||
// collect the not closed shells for further processing
|
||||
TopTools_ListOfShape aLShNC;
|
||||
//
|
||||
TopTools_ListIteratorOfListOfShape aItLShSp(aLShSp);
|
||||
for (; aItLShSp.More(); aItLShSp.Next()) {
|
||||
TopoDS_Shell& aShSp = *((TopoDS_Shell*)&aItLShSp.Value());
|
||||
//
|
||||
if (BRep_Tool::IsClosed(aShSp)) {
|
||||
aShSp.Closed(Standard_True);
|
||||
myLoops.Append(aShSp);
|
||||
}
|
||||
else {
|
||||
aLShNC.Append(aShSp);
|
||||
}
|
||||
}
|
||||
//
|
||||
bAllFacesTaken = (AddedFacesMap.Extent() == aNbShapes);
|
||||
if (bAllFacesTaken) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
if (aLShSp.Extent() == 1) {
|
||||
// not further processing of not closed shells is needed,
|
||||
// as it will not bring any new results
|
||||
continue;
|
||||
}
|
||||
//
|
||||
|
||||
// remove th faces of not closed shells from the map of processed faces
|
||||
// and try to rebuild the shells using all not processed faces,
|
||||
// because faces of one shell might be needed for building the other
|
||||
TopTools_ListIteratorOfListOfShape aItLShNC(aLShNC);
|
||||
for (; aItLShNC.More(); aItLShNC.Next())
|
||||
{
|
||||
TopoDS_Iterator aItNC(aItLShNC.Value());
|
||||
for (; aItNC.More(); aItNC.Next())
|
||||
{
|
||||
AddedFacesMap.Remove(aItNC.Value());
|
||||
}
|
||||
}
|
||||
} // for (; aItF.More(); aItF.Next()) {
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopoDS_Shape FindShape (const TopoDS_Shape& theShapeToFind,
|
||||
const TopoDS_Shape& theShape)
|
||||
{
|
||||
TopoDS_Shape aRes;
|
||||
TopExp_Explorer anExp(theShape, theShapeToFind.ShapeType());
|
||||
for (; anExp.More(); anExp.Next())
|
||||
{
|
||||
const TopoDS_Shape& aShape = anExp.Current();
|
||||
if (aShape.IsSame(theShapeToFind))
|
||||
{
|
||||
aRes = aShape;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RefineShell
|
||||
//purpose :
|
||||
@@ -434,6 +445,21 @@ void RefineShell(TopoDS_Shell& theShell,
|
||||
aMEStop.Add(aE);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (aLF.Extent() == 2)
|
||||
{
|
||||
const TopoDS_Face& aF1 = TopoDS::Face(aLF.First());
|
||||
const TopoDS_Face& aF2 = TopoDS::Face(aLF.Last());
|
||||
|
||||
TopoDS_Shape aE1 = FindShape(aE, aF1);
|
||||
TopoDS_Shape aE2 = FindShape(aE, aF2);
|
||||
|
||||
if (aE1.Orientation() == aE2.Orientation())
|
||||
{
|
||||
aMEStop.Add(aE);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//
|
||||
// check for internal edges - count faces, in which the edge
|
||||
// is internal, twice
|
||||
|
@@ -69,7 +69,7 @@ static
|
||||
TopTools_MapOfShape& theMEdgesNoUniquePlane);
|
||||
|
||||
static
|
||||
Standard_Boolean FindPlane(const Handle(BRepAdaptor_Curve)& theCurve,
|
||||
Standard_Boolean FindPlane(const BRepAdaptor_Curve& theCurve,
|
||||
gp_Pln& thePlane);
|
||||
|
||||
static
|
||||
@@ -84,7 +84,7 @@ static
|
||||
gp_Dir& theTgt);
|
||||
|
||||
static
|
||||
Standard_Boolean FindEdgeTangent(const Handle(BRepAdaptor_Curve)& theCurve,
|
||||
Standard_Boolean FindEdgeTangent(const BRepAdaptor_Curve& theCurve,
|
||||
gp_Vec& theTangent);
|
||||
|
||||
//=======================================================================
|
||||
@@ -410,7 +410,7 @@ Standard_Integer BOPAlgo_Tools::EdgesToWires(const TopoDS_Shape& theEdges,
|
||||
aExp.Init(aSEdges, TopAbs_EDGE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(aExp.Current());
|
||||
Handle(BRepAdaptor_Curve) aBAC = new BRepAdaptor_Curve(aE);
|
||||
BRepAdaptor_Curve aBAC(aE);
|
||||
//
|
||||
gp_Pln aPln;
|
||||
if (FindPlane(aBAC, aPln)) {
|
||||
@@ -773,7 +773,7 @@ Standard_Boolean FindEdgeTangent(const TopoDS_Edge& theEdge,
|
||||
gp_Dir *pDTE = theDMEdgeTgt.ChangeSeek(theEdge);
|
||||
if (!pDTE) {
|
||||
gp_Vec aVTE;
|
||||
Handle(BRepAdaptor_Curve) aBAC = new BRepAdaptor_Curve(theEdge);
|
||||
BRepAdaptor_Curve aBAC(theEdge);
|
||||
if (!FindEdgeTangent(aBAC, aVTE)) {
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -787,26 +787,26 @@ Standard_Boolean FindEdgeTangent(const TopoDS_Edge& theEdge,
|
||||
//function : FindEdgeTangent
|
||||
//purpose : Finds the tangent for the edge
|
||||
//=======================================================================
|
||||
Standard_Boolean FindEdgeTangent(const Handle(BRepAdaptor_Curve)& theCurve,
|
||||
Standard_Boolean FindEdgeTangent(const BRepAdaptor_Curve& theCurve,
|
||||
gp_Vec& theTangent)
|
||||
{
|
||||
if (!theCurve->Is3DCurve()) {
|
||||
if (!theCurve.Is3DCurve()) {
|
||||
return Standard_False;
|
||||
}
|
||||
// for the line the tangent is defined by the direction
|
||||
if (theCurve->GetType() == GeomAbs_Line) {
|
||||
theTangent = theCurve->Line().Position().Direction();
|
||||
if (theCurve.GetType() == GeomAbs_Line) {
|
||||
theTangent = theCurve.Line().Position().Direction();
|
||||
return Standard_True;
|
||||
}
|
||||
//
|
||||
// for other curves take D1 and check for its length
|
||||
Standard_Real aT, aT1(theCurve->FirstParameter()), aT2(theCurve->LastParameter());
|
||||
Standard_Real aT, aT1(theCurve.FirstParameter()), aT2(theCurve.LastParameter());
|
||||
const Standard_Integer aNbP = 11;
|
||||
const Standard_Real aDt = (aT2 - aT1) / aNbP;
|
||||
//
|
||||
for (aT = aT1 + aDt; aT <= aT2; aT += aDt) {
|
||||
gp_Pnt aP;
|
||||
theCurve->D1(aT, aP, theTangent);
|
||||
theCurve.D1(aT, aP, theTangent);
|
||||
if (theTangent.Magnitude() > Precision::Confusion()) {
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -819,47 +819,47 @@ Standard_Boolean FindEdgeTangent(const Handle(BRepAdaptor_Curve)& theCurve,
|
||||
//function : FindPlane
|
||||
//purpose : Finds the plane in which the edge is located
|
||||
//=======================================================================
|
||||
Standard_Boolean FindPlane(const Handle(BRepAdaptor_Curve)& theCurve,
|
||||
Standard_Boolean FindPlane(const BRepAdaptor_Curve& theCurve,
|
||||
gp_Pln& thePlane)
|
||||
{
|
||||
if (!theCurve->Is3DCurve()) {
|
||||
if (!theCurve.Is3DCurve()) {
|
||||
return Standard_False;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bFound = Standard_True;
|
||||
gp_Vec aVN;
|
||||
switch (theCurve->GetType()) {
|
||||
switch (theCurve.GetType()) {
|
||||
case GeomAbs_Line:
|
||||
return Standard_False;
|
||||
case GeomAbs_Circle:
|
||||
aVN = theCurve->Circle().Position().Direction();
|
||||
aVN = theCurve.Circle().Position().Direction();
|
||||
break;
|
||||
case GeomAbs_Ellipse:
|
||||
aVN = theCurve->Ellipse().Position().Direction();
|
||||
aVN = theCurve.Ellipse().Position().Direction();
|
||||
break;
|
||||
case GeomAbs_Hyperbola:
|
||||
aVN = theCurve->Hyperbola().Position().Direction();
|
||||
aVN = theCurve.Hyperbola().Position().Direction();
|
||||
break;
|
||||
case GeomAbs_Parabola:
|
||||
aVN = theCurve->Parabola().Position().Direction();
|
||||
aVN = theCurve.Parabola().Position().Direction();
|
||||
break;
|
||||
default: {
|
||||
// for all other types of curve compute two tangent vectors
|
||||
// on the curve and cross them
|
||||
bFound = Standard_False;
|
||||
Standard_Real aT, aT1(theCurve->FirstParameter()), aT2(theCurve->LastParameter());
|
||||
Standard_Real aT, aT1(theCurve.FirstParameter()), aT2(theCurve.LastParameter());
|
||||
const Standard_Integer aNbP = 11;
|
||||
const Standard_Real aDt = (aT2 - aT1) / aNbP;
|
||||
//
|
||||
aT = aT1;
|
||||
gp_Pnt aP1;
|
||||
gp_Vec aV1;
|
||||
theCurve->D1(aT, aP1, aV1);
|
||||
theCurve.D1(aT, aP1, aV1);
|
||||
//
|
||||
for (aT = aT1 + aDt; aT <= aT2; aT += aDt) {
|
||||
gp_Pnt aP2;
|
||||
gp_Vec aV2;
|
||||
theCurve->D1(aT, aP2, aV2);
|
||||
theCurve.D1(aT, aP2, aV2);
|
||||
//
|
||||
aVN = aV1^aV2;
|
||||
if (aVN.Magnitude() > Precision::Confusion()) {
|
||||
@@ -872,7 +872,7 @@ Standard_Boolean FindPlane(const Handle(BRepAdaptor_Curve)& theCurve,
|
||||
}
|
||||
//
|
||||
if (bFound) {
|
||||
thePlane = gp_Pln(theCurve->Value(theCurve->FirstParameter()), gp_Dir(aVN));
|
||||
thePlane = gp_Pln(theCurve.Value(theCurve.FirstParameter()), gp_Dir(aVN));
|
||||
}
|
||||
return bFound;
|
||||
}
|
||||
@@ -935,7 +935,7 @@ Standard_Boolean FindPlane(const TopoDS_Shape& theWire,
|
||||
if (theMEdgesNoUniquePlane.Contains(aE)) {
|
||||
continue;
|
||||
}
|
||||
Handle(BRepAdaptor_Curve) aBAC = new BRepAdaptor_Curve(aE);
|
||||
BRepAdaptor_Curve aBAC(aE);
|
||||
if (FindPlane(aBAC, thePlane)) {
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ static
|
||||
Standard_Real Angle2D (const TopoDS_Vertex& aV,
|
||||
const TopoDS_Edge& anEdge,
|
||||
const TopoDS_Face& myFace,
|
||||
const Handle(GeomAdaptor_Surface)& aGAS,
|
||||
const GeomAdaptor_Surface& aGAS,
|
||||
const Standard_Boolean aFlag,
|
||||
const Handle(IntTools_Context)& theContext);
|
||||
|
||||
@@ -86,7 +86,7 @@ static
|
||||
const Standard_Real aAngleOut);
|
||||
|
||||
static
|
||||
void Path (const Handle(GeomAdaptor_Surface)& aGAS,
|
||||
void Path (const GeomAdaptor_Surface& aGAS,
|
||||
const TopoDS_Face& myFace,
|
||||
const MyDataMapOfShapeBoolean& aVertMap,
|
||||
const TopoDS_Vertex& aVa,
|
||||
@@ -103,16 +103,16 @@ static
|
||||
|
||||
static
|
||||
Standard_Real Tolerance2D (const TopoDS_Vertex& aV,
|
||||
const Handle(GeomAdaptor_Surface)& aGAS);
|
||||
const GeomAdaptor_Surface& aGAS);
|
||||
|
||||
|
||||
|
||||
static
|
||||
Standard_Real UTolerance2D (const TopoDS_Vertex& aV,
|
||||
const Handle(GeomAdaptor_Surface)& aGAS);
|
||||
const GeomAdaptor_Surface& aGAS);
|
||||
static
|
||||
Standard_Real VTolerance2D (const TopoDS_Vertex& aV,
|
||||
const Handle(GeomAdaptor_Surface)& aGAS);
|
||||
const GeomAdaptor_Surface& aGAS);
|
||||
|
||||
static
|
||||
void RefineAngles(const TopoDS_Face& myFace,
|
||||
@@ -293,8 +293,8 @@ void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
|
||||
}
|
||||
//
|
||||
// 3. Angles in mySmartMap
|
||||
const Handle(BRepAdaptor_Surface)& aBAS = theContext->SurfaceAdaptor(myFace);
|
||||
const Handle(GeomAdaptor_Surface)& aGAS = aBAS->Surface();
|
||||
const BRepAdaptor_Surface& aBAS = theContext->SurfaceAdaptor(myFace);
|
||||
const GeomAdaptor_Surface& aGAS=aBAS.Surface();
|
||||
//
|
||||
for (i=1; i<=aNb; i++) {
|
||||
const TopoDS_Vertex& aV = (*(TopoDS_Vertex *)(&mySmartMap.FindKey(i)));
|
||||
@@ -351,7 +351,7 @@ void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
|
||||
// function: Path
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void Path (const Handle(GeomAdaptor_Surface)& aGAS,
|
||||
void Path (const GeomAdaptor_Surface& aGAS,
|
||||
const TopoDS_Face& myFace,
|
||||
const MyDataMapOfShapeBoolean& aVertMap,
|
||||
const TopoDS_Vertex& aVFirst,
|
||||
@@ -740,7 +740,7 @@ Standard_Integer NbWaysOut(const BOPAlgo_ListOfEdgeInfo& aLEInfo)
|
||||
Standard_Real Angle2D (const TopoDS_Vertex& aV,
|
||||
const TopoDS_Edge& anEdge,
|
||||
const TopoDS_Face& myFace,
|
||||
const Handle(GeomAdaptor_Surface)& aGAS,
|
||||
const GeomAdaptor_Surface& aGAS,
|
||||
const Standard_Boolean bIsIN,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
@@ -825,16 +825,16 @@ Standard_Real Angle (const gp_Dir2d& aDir2D)
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
Standard_Real Tolerance2D (const TopoDS_Vertex& aV,
|
||||
const Handle(GeomAdaptor_Surface)& aGAS)
|
||||
const GeomAdaptor_Surface& aGAS)
|
||||
{
|
||||
Standard_Real aTol2D, anUr, aVr, aTolV3D;
|
||||
GeomAbs_SurfaceType aType;
|
||||
//
|
||||
aType=aGAS->GetType();
|
||||
aType=aGAS.GetType();
|
||||
aTolV3D=BRep_Tool::Tolerance(aV);
|
||||
|
||||
anUr=aGAS->UResolution(aTolV3D);
|
||||
aVr =aGAS->VResolution(aTolV3D);
|
||||
anUr=aGAS.UResolution(aTolV3D);
|
||||
aVr =aGAS.VResolution(aTolV3D);
|
||||
aTol2D=(aVr>anUr) ? aVr : anUr;
|
||||
//
|
||||
if (aTol2D < aTolV3D) {
|
||||
@@ -852,10 +852,10 @@ Standard_Real Angle (const gp_Dir2d& aDir2D)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real UTolerance2D (const TopoDS_Vertex& aV,
|
||||
const Handle(GeomAdaptor_Surface)& aGAS)
|
||||
const GeomAdaptor_Surface& aGAS)
|
||||
{
|
||||
const Standard_Real aTolV3D = BRep_Tool::Tolerance(aV);
|
||||
const Standard_Real anUr = aGAS->UResolution(aTolV3D);
|
||||
const Standard_Real anUr = aGAS.UResolution(aTolV3D);
|
||||
//
|
||||
return anUr;
|
||||
}
|
||||
@@ -865,10 +865,10 @@ Standard_Real UTolerance2D (const TopoDS_Vertex& aV,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real VTolerance2D (const TopoDS_Vertex& aV,
|
||||
const Handle(GeomAdaptor_Surface)& aGAS)
|
||||
const GeomAdaptor_Surface& aGAS)
|
||||
{
|
||||
const Standard_Real aTolV3D = BRep_Tool::Tolerance(aV);
|
||||
const Standard_Real anVr = aGAS->VResolution(aTolV3D);
|
||||
const Standard_Real anVr = aGAS.VResolution(aTolV3D);
|
||||
//
|
||||
return anVr;
|
||||
}
|
||||
@@ -1011,8 +1011,7 @@ Standard_Boolean RefineAngle2D(const TopoDS_Vertex& aV,
|
||||
gp_Pnt2d aPV, aP, aP1, aP2;
|
||||
Handle(Geom2d_Curve) aC2D;
|
||||
Handle(Geom2d_Line) aLi;
|
||||
Handle(Geom2dAdaptor_Curve) aGAC1 = new Geom2dAdaptor_Curve();
|
||||
Handle(Geom2dAdaptor_Curve) aGAC2 = new Geom2dAdaptor_Curve();
|
||||
Geom2dAdaptor_Curve aGAC1, aGAC2;
|
||||
Geom2dInt_GInter aGInter;
|
||||
IntRes2d_Domain aDomain1, aDomain2;
|
||||
//
|
||||
@@ -1021,16 +1020,16 @@ Standard_Boolean RefineAngle2D(const TopoDS_Vertex& aV,
|
||||
aTolInt=1.e-10;
|
||||
//
|
||||
BOPTools_AlgoTools2D::CurveOnSurface(aE, myFace, aC2D, aT1, aT2, aTol, theContext);
|
||||
aGAC1->Load(aC2D, aT1, aT2);
|
||||
aGAC1.Load(aC2D, aT1, aT2);
|
||||
//
|
||||
aTV=BRep_Tool::Parameter (aV, aE, myFace);
|
||||
aGAC1->D0(aTV, aPV);
|
||||
aGAC1.D0(aTV, aPV);
|
||||
//
|
||||
aTOp = (fabs(aTV-aT1) < fabs(aTV-aT2)) ? aT2 : aT1;
|
||||
//
|
||||
const Standard_Real MaxDT = 0.3 * (aT2 - aT1);
|
||||
aGAC1->D0(aT1, aP1);
|
||||
aGAC1->D0(aT2, aP2);
|
||||
aGAC1.D0(aT1, aP1);
|
||||
aGAC1.D0(aT2, aP2);
|
||||
aDomain1.SetValues(aP1, aT1, aTolInt, aP2, aT2, aTolInt);
|
||||
//
|
||||
for (i=0; i<2; ++i) {
|
||||
@@ -1040,7 +1039,7 @@ Standard_Boolean RefineAngle2D(const TopoDS_Vertex& aV,
|
||||
gp_Dir2d aDiri(aXi, aYi);
|
||||
aLi=new Geom2d_Line(aPV, aDiri);
|
||||
//
|
||||
aGAC2->Load(aLi);
|
||||
aGAC2.Load(aLi);
|
||||
//
|
||||
aGInter.Perform(aGAC1, aDomain1, aGAC2, aDomain2, aTolInt, aTolInt);
|
||||
if (!aGInter.IsDone()) {
|
||||
@@ -1068,7 +1067,7 @@ Standard_Boolean RefineAngle2D(const TopoDS_Vertex& aV,
|
||||
}
|
||||
//
|
||||
aT = aT1max + aCf*dT;
|
||||
aGAC1->D0(aT, aP);
|
||||
aGAC1.D0(aT, aP);
|
||||
gp_Vec2d aV2D(aPV, aP);
|
||||
gp_Dir2d aDir2D(aV2D);
|
||||
//
|
||||
|
@@ -1472,7 +1472,7 @@ Standard_Boolean BOPTools_AlgoTools::IsHole(const TopoDS_Shape& aW,
|
||||
break; //xx
|
||||
}
|
||||
//
|
||||
Handle(BRepAdaptor_Curve2d) aBAC2D = new BRepAdaptor_Curve2d(aE, aFF);
|
||||
BRepAdaptor_Curve2d aBAC2D(aE, aFF);
|
||||
aNbS=Geom2dInt_Geom2dCurveTool::NbSamples(aBAC2D);
|
||||
if (aNbS>2) {
|
||||
aNbS*=4;
|
||||
@@ -1487,10 +1487,10 @@ Standard_Boolean BOPTools_AlgoTools::IsHole(const TopoDS_Shape& aW,
|
||||
dU=-dU;
|
||||
}
|
||||
//
|
||||
aBAC2D->D0(aU, aP2D0);
|
||||
aBAC2D.D0(aU, aP2D0);
|
||||
for(i=2; i<=aNbS; i++) {
|
||||
aU=aU1+(i-1)*dU;
|
||||
aBAC2D->D0(aU, aP2D1);
|
||||
aBAC2D.D0(aU, aP2D1);
|
||||
aP2D0.Coord(aX0, aY0);
|
||||
aP2D1.Coord(aX1, aY1);
|
||||
//
|
||||
@@ -2152,26 +2152,26 @@ Standard_Real MinStep3D(const TopoDS_Edge& theE1,
|
||||
}
|
||||
//
|
||||
// try to compute the minimal 3D step
|
||||
const Handle(BRepAdaptor_Surface)& aBAS = theContext->SurfaceAdaptor(aF);
|
||||
const BRepAdaptor_Surface& aBAS = theContext->SurfaceAdaptor(aF);
|
||||
Standard_Real aR = 0.;
|
||||
GeomAbs_SurfaceType aSType = aBAS->GetType();
|
||||
GeomAbs_SurfaceType aSType = aBAS.GetType();
|
||||
switch (aSType) {
|
||||
case GeomAbs_Cylinder: {
|
||||
aR = aBAS->Cylinder().Radius();
|
||||
aR = aBAS.Cylinder().Radius();
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Cone: {
|
||||
gp_Lin aL(aBAS->Cone().Axis());
|
||||
gp_Lin aL(aBAS.Cone().Axis());
|
||||
aR = aL.Distance(aP);
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Sphere: {
|
||||
aDtMin = Max(aDtMin, 5.e-4);
|
||||
aR = aBAS->Sphere().Radius();
|
||||
aR = aBAS.Sphere().Radius();
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Torus: {
|
||||
aR = aBAS->Torus().MajorRadius();
|
||||
aR = aBAS.Torus().MajorRadius();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -2195,14 +2195,14 @@ Standard_Real MinStep3D(const TopoDS_Edge& theE1,
|
||||
const BOPTools_CoupleOfShape& aCS = aIt.Value();
|
||||
const TopoDS_Face& aF = (*(TopoDS_Face*)(&aCS.Shape2()));
|
||||
//
|
||||
const Handle(BRepAdaptor_Surface)& aBAS = theContext->SurfaceAdaptor(aF);
|
||||
const BRepAdaptor_Surface& aBAS = theContext->SurfaceAdaptor(aF);
|
||||
//
|
||||
Standard_Real aUMin, aUMax, aVMin, aVMax;
|
||||
theContext->UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
|
||||
//
|
||||
Standard_Real aDU = aUMax - aUMin;
|
||||
if (aDU > 0.) {
|
||||
Standard_Real aURes = aBAS->UResolution(aDtMax);
|
||||
Standard_Real aURes = aBAS.UResolution(aDtMax);
|
||||
if (2*aURes > aDU) {
|
||||
break;
|
||||
}
|
||||
@@ -2210,7 +2210,7 @@ Standard_Real MinStep3D(const TopoDS_Edge& theE1,
|
||||
//
|
||||
Standard_Real aDV = aVMax - aVMin;
|
||||
if (aDV > 0.) {
|
||||
Standard_Real aVRes = aBAS->VResolution(aDtMax);
|
||||
Standard_Real aVRes = aBAS.VResolution(aDtMax);
|
||||
if (2*aVRes > aDV) {
|
||||
break;
|
||||
}
|
||||
|
@@ -251,24 +251,24 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnFace
|
||||
Handle(Geom2d_Curve)& theC2DA,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Handle(BRepAdaptor_Surface) aBASTmp = new BRepAdaptor_Surface();
|
||||
Handle(BRepAdaptor_Surface) pBAS;
|
||||
BRepAdaptor_Surface aBASTmp;
|
||||
const BRepAdaptor_Surface* pBAS;
|
||||
if (!theContext.IsNull()) {
|
||||
pBAS = theContext->SurfaceAdaptor(theF);
|
||||
pBAS = &theContext->SurfaceAdaptor(theF);
|
||||
}
|
||||
else {
|
||||
aBASTmp->Initialize(theF, Standard_True);
|
||||
pBAS = aBASTmp;
|
||||
aBASTmp.Initialize(theF, Standard_True);
|
||||
pBAS = &aBASTmp;
|
||||
}
|
||||
//
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnSurf(pBAS, theFirst, theLast, theC2D, theC2DA);
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnSurf(*pBAS, theFirst, theLast, theC2D, theC2DA);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AdjustPCurveOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
|
||||
(const Handle(BRepAdaptor_Surface)& aBAS,
|
||||
(const BRepAdaptor_Surface& aBAS,
|
||||
const Standard_Real aFirst,
|
||||
const Standard_Real aLast,
|
||||
const Handle(Geom2d_Curve)& aC2D,
|
||||
@@ -278,11 +278,11 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
|
||||
Standard_Real UMin, UMax, VMin, VMax, aT, u2, v2, du, dv, aDelta;
|
||||
Standard_Real aUPeriod;
|
||||
//
|
||||
const TopoDS_Face& aF=aBAS->Face();
|
||||
UMin=aBAS->FirstUParameter();
|
||||
UMax=aBAS->LastUParameter();
|
||||
VMin=aBAS->FirstVParameter();
|
||||
VMax=aBAS->LastVParameter();
|
||||
const TopoDS_Face& aF=aBAS.Face();
|
||||
UMin=aBAS.FirstUParameter();
|
||||
UMax=aBAS.LastUParameter();
|
||||
VMin=aBAS.FirstVParameter();
|
||||
VMax=aBAS.LastVParameter();
|
||||
//
|
||||
aDelta=Precision::PConfusion();
|
||||
|
||||
@@ -296,8 +296,8 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
|
||||
//
|
||||
// du
|
||||
du = 0.;
|
||||
if (aBAS->IsUPeriodic()) {
|
||||
aUPeriod = aBAS->UPeriod();
|
||||
if (aBAS.IsUPeriodic()) {
|
||||
aUPeriod = aBAS.UPeriod();
|
||||
|
||||
//
|
||||
// a. try to clarify u2 using the precision (aDelta)
|
||||
@@ -311,10 +311,10 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
|
||||
GeomInt::AdjustPeriodic(u2, UMin, UMax, aUPeriod, u2, du, 0.);
|
||||
//
|
||||
if (du==0.) {
|
||||
if (aBAS->GetType()==GeomAbs_Cylinder) {
|
||||
if (aBAS.GetType()==GeomAbs_Cylinder) {
|
||||
Standard_Real aR, dFi, aTol;
|
||||
//
|
||||
gp_Cylinder aCylinder=aBAS->Cylinder();
|
||||
gp_Cylinder aCylinder=aBAS.Cylinder();
|
||||
aR=aCylinder.Radius();
|
||||
aTol=MaxToleranceEdge(aF);
|
||||
dFi=aTol/aR;
|
||||
@@ -333,10 +333,10 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
|
||||
|
||||
// dv
|
||||
dv = 0.;
|
||||
if (aBAS->IsVPeriodic()) {
|
||||
if (aBAS.IsVPeriodic()) {
|
||||
Standard_Real aVPeriod, aVm, aVr, aVmid, dVm, dVr;
|
||||
//
|
||||
aVPeriod = aBAS->VPeriod();
|
||||
aVPeriod = aBAS.VPeriod();
|
||||
mincond = (VMin - v2 > aDelta);
|
||||
maxcond = (v2 - VMax > aDelta);
|
||||
//
|
||||
@@ -361,8 +361,8 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
|
||||
Standard_Real u,v;
|
||||
u = u2 + du;
|
||||
v = v2 + dv;
|
||||
if (aBAS->IsUPeriodic()) {
|
||||
aUPeriod = aBAS->UPeriod();
|
||||
if (aBAS.IsUPeriodic()) {
|
||||
aUPeriod = aBAS.UPeriod();
|
||||
if ((UMax - UMin - 2*aDelta) > aUPeriod) {
|
||||
if ((u > (UMin + aDelta + aUPeriod)) ||
|
||||
(u < (UMax - aDelta - aUPeriod))) {
|
||||
@@ -377,8 +377,8 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
|
||||
}
|
||||
//
|
||||
u = u2 + du;
|
||||
if (aBAS->IsVPeriodic()) {
|
||||
Standard_Real aVPeriod = aBAS->VPeriod();
|
||||
if (aBAS.IsVPeriodic()) {
|
||||
Standard_Real aVPeriod = aBAS.VPeriod();
|
||||
if ((VMax - VMin - 2*aDelta) > aVPeriod) {
|
||||
if ((v > (VMin + aDelta + aVPeriod)) ||
|
||||
(v < (VMax - aDelta - aVPeriod))) {
|
||||
@@ -521,14 +521,14 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
|
||||
Standard_Real& TolReached2d,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Handle(BRepAdaptor_Surface) aBASTmp = new BRepAdaptor_Surface();
|
||||
Handle(BRepAdaptor_Surface) pBAS;
|
||||
BRepAdaptor_Surface aBASTmp;
|
||||
const BRepAdaptor_Surface* pBAS;
|
||||
if (!theContext.IsNull()) {
|
||||
pBAS = theContext->SurfaceAdaptor(aF);
|
||||
pBAS = &theContext->SurfaceAdaptor(aF);
|
||||
}
|
||||
else {
|
||||
aBASTmp->Initialize(aF, Standard_True);
|
||||
pBAS = aBASTmp;
|
||||
aBASTmp.Initialize(aF, Standard_True);
|
||||
pBAS = &aBASTmp;
|
||||
}
|
||||
//
|
||||
Handle(BRepAdaptor_Surface) aBAHS = new BRepAdaptor_Surface(*pBAS);
|
||||
@@ -622,7 +622,7 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
|
||||
|
||||
// Adjust curve for periodic surface
|
||||
Handle(Geom2d_Curve) aC2DA;
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnSurf (pBAS, aT1, aT2, aC2D, aC2DA);
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnSurf (*pBAS, aT1, aT2, aC2D, aC2DA);
|
||||
aC2D = aC2DA;
|
||||
|
||||
// Make sure that the range of the 2D curve is sufficient for representation of the 3D curve.
|
||||
@@ -639,7 +639,7 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
|
||||
}
|
||||
|
||||
// compute the appropriate tolerance for the edge
|
||||
Handle(Geom_Surface) aS = pBAS->Surface()->Surface();
|
||||
Handle(Geom_Surface) aS = pBAS->Surface().Surface();
|
||||
aS = Handle(Geom_Surface)::DownCast(aS->Transformed(pBAS->Trsf()));
|
||||
//
|
||||
Standard_Real aT;
|
||||
|
@@ -129,7 +129,7 @@ public:
|
||||
|
||||
//! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
|
||||
//! [aT1, aT2] - range to adjust
|
||||
Standard_EXPORT static void AdjustPCurveOnSurf(const Handle(BRepAdaptor_Surface)& aF,
|
||||
Standard_EXPORT static void AdjustPCurveOnSurf(const BRepAdaptor_Surface& aF,
|
||||
const Standard_Real aT1,
|
||||
const Standard_Real aT2,
|
||||
const Handle(Geom2d_Curve)& aC2D,
|
||||
|
@@ -961,7 +961,7 @@ Standard_Integer BOPTools_AlgoTools3D::PointInFace
|
||||
//
|
||||
Geom2dHatch_Hatcher& aHatcher = theContext->Hatcher(theF);
|
||||
//
|
||||
Handle(Geom2dAdaptor_Curve) aHCur = new Geom2dAdaptor_Curve(theL2D);
|
||||
Geom2dAdaptor_Curve aHCur(theL2D);
|
||||
//
|
||||
aHatcher.ClrHatchings();
|
||||
aIH = aHatcher.AddHatching(aHCur);
|
||||
|
@@ -488,7 +488,7 @@ static Standard_Real MapEdgeLength(const TopoDS_Edge& theEdge,
|
||||
Standard_Real aLen = 0.;
|
||||
if (!BRep_Tool::Degenerated(theEdge))
|
||||
{
|
||||
Handle(BRepAdaptor_Curve) aCurve = new BRepAdaptor_Curve(theEdge);
|
||||
BRepAdaptor_Curve aCurve(theEdge);
|
||||
aLen = GCPnts_AbscissaPoint::Length(aCurve);
|
||||
}
|
||||
pLen = theMapEdgeLen.Bound(theEdge, aLen);
|
||||
@@ -505,7 +505,7 @@ namespace {
|
||||
const TopoDS_Edge* Edge; // Edge
|
||||
Standard_Real VParameter; // Parameter of the vertex on the edge
|
||||
Standard_Boolean IsClosed; // Closed flag of the edge
|
||||
Handle(Geom2dAdaptor_Curve) GAdaptor; // 2D adaptor for PCurve of the edge on the face
|
||||
Geom2dAdaptor_Curve GAdaptor; // 2D adaptor for PCurve of the edge on the face
|
||||
Standard_Real First; // First parameter in the range
|
||||
Standard_Real Last; // Last parameter in the rage
|
||||
};
|
||||
@@ -532,10 +532,10 @@ static
|
||||
Standard_Real aMaxDist = 0.;
|
||||
Standard_Real aTol2d = 1.e-10;
|
||||
//
|
||||
IntRes2d_Domain aDom1(theEData1.GAdaptor->Value(aT11), aT11, aTol2d,
|
||||
theEData1.GAdaptor->Value(aT12), aT12, aTol2d);
|
||||
IntRes2d_Domain aDom2(theEData2.GAdaptor->Value(aT21), aT21, aTol2d,
|
||||
theEData2.GAdaptor->Value(aT22), aT22, aTol2d);
|
||||
IntRes2d_Domain aDom1(theEData1.GAdaptor.Value(aT11), aT11, aTol2d,
|
||||
theEData1.GAdaptor.Value(aT12), aT12, aTol2d);
|
||||
IntRes2d_Domain aDom2(theEData2.GAdaptor.Value(aT21), aT21, aTol2d,
|
||||
theEData2.GAdaptor.Value(aT22), aT22, aTol2d);
|
||||
//
|
||||
anInter.Perform(theEData1.GAdaptor, aDom1, theEData2.GAdaptor, aDom2, aTol2d, aTol2d);
|
||||
if (!anInter.IsDone() || (!anInter.NbSegments() && !anInter.NbPoints())) {
|
||||
@@ -658,7 +658,7 @@ void CorrectWires(const TopoDS_Face& aFx,
|
||||
if (aD2>aD2max) {
|
||||
aD2max=aD2;
|
||||
}
|
||||
EdgeData anEData = {&aE, aT, isClosed, new Geom2dAdaptor_Curve(aC2D), aT1, aT2};
|
||||
EdgeData anEData = {&aE, aT, isClosed, Geom2dAdaptor_Curve(aC2D), aT1, aT2};
|
||||
aLEPars.Append(anEData);
|
||||
}
|
||||
//
|
||||
@@ -894,7 +894,7 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
||||
Handle(GeomAdaptor_Curve) aHCurve =
|
||||
new GeomAdaptor_Curve(ProjOnPlane);
|
||||
|
||||
Handle(ProjLib_ProjectedCurve) proj = new ProjLib_ProjectedCurve(GAHS,aHCurve);
|
||||
ProjLib_ProjectedCurve proj(GAHS,aHCurve);
|
||||
Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
|
||||
Handle(Geom2dAdaptor_Curve) GHPC =
|
||||
new Geom2dAdaptor_Curve(PC,
|
||||
|
@@ -60,7 +60,7 @@ public: //! @name public interfaces
|
||||
//! Clears the indices
|
||||
void Clear()
|
||||
{
|
||||
myPairs.Clear();
|
||||
myPairs.clear();
|
||||
}
|
||||
|
||||
//! Sorts the indices
|
||||
|
@@ -398,7 +398,7 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnPlane(const TopoDS_Edge& E,
|
||||
Handle(GeomAdaptor_Surface) HS = new GeomAdaptor_Surface(GP);
|
||||
Handle(GeomAdaptor_Curve) HC = new GeomAdaptor_Curve(ProjOnPlane);
|
||||
|
||||
Handle(ProjLib_ProjectedCurve) Proj = new ProjLib_ProjectedCurve(HS, HC);
|
||||
ProjLib_ProjectedCurve Proj(HS, HC);
|
||||
Handle(Geom2d_Curve) pc = Geom2dAdaptor::MakeCurve(Proj);
|
||||
|
||||
if (pc->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) {
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
|
||||
typedef NCollection_Array1<Handle(BRepAdaptor_Curve)> BRepAdaptor_Array1OfCurve;
|
||||
typedef NCollection_Array1<BRepAdaptor_Curve> BRepAdaptor_Array1OfCurve;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -90,8 +90,8 @@ Handle(Adaptor3d_Curve) BRepAdaptor_CompCurve::ShallowCopy() const
|
||||
aCopy->myCurves = new (BRepAdaptor_HArray1OfCurve) (1, myCurves->Size());
|
||||
for (Standard_Integer anI = 1; anI <= myCurves->Size(); ++anI)
|
||||
{
|
||||
const Handle(Adaptor3d_Curve) aCurve = myCurves->Value(anI)->ShallowCopy();
|
||||
const Handle(BRepAdaptor_Curve) aBrepCurve = Handle(BRepAdaptor_Curve)::DownCast(aCurve);
|
||||
const Handle(Adaptor3d_Curve) aCurve = myCurves->Value(anI).ShallowCopy();
|
||||
const BRepAdaptor_Curve& aBrepCurve = *(Handle(BRepAdaptor_Curve)::DownCast(aCurve));
|
||||
aCopy->myCurves->SetValue(anI, aBrepCurve);
|
||||
}
|
||||
aCopy->myKnots = myKnots;
|
||||
@@ -129,7 +129,7 @@ Handle(Adaptor3d_Curve) BRepAdaptor_CompCurve::ShallowCopy() const
|
||||
E = wexp.Current();
|
||||
if (! BRep_Tool::Degenerated(E)) {
|
||||
ii++;
|
||||
myCurves->ChangeValue(ii) = new BRepAdaptor_Curve(E);
|
||||
myCurves->ChangeValue(ii).Initialize(E);
|
||||
if (AC) {
|
||||
myKnots->SetValue(ii+1, myKnots->Value(ii));
|
||||
myKnots->ChangeValue(ii+1) +=
|
||||
@@ -141,12 +141,12 @@ Handle(Adaptor3d_Curve) BRepAdaptor_CompCurve::ShallowCopy() const
|
||||
|
||||
Forward = Standard_True; // Default ; The Reverse Edges are parsed.
|
||||
if((NbEdge > 2) || ((NbEdge==2) && (!myWire.Closed())) ) {
|
||||
TopAbs_Orientation Or = myCurves->Value(1)->Edge().Orientation();
|
||||
TopAbs_Orientation Or = myCurves->Value(1).Edge().Orientation();
|
||||
TopoDS_Vertex VI, VL;
|
||||
TopExp::CommonVertex(myCurves->Value(1)->Edge(),
|
||||
myCurves->Value(2)->Edge(),
|
||||
TopExp::CommonVertex(myCurves->Value(1).Edge(),
|
||||
myCurves->Value(2).Edge(),
|
||||
VI);
|
||||
VL = TopExp::LastVertex(myCurves->Value(1)->Edge());
|
||||
VL = TopExp::LastVertex(myCurves->Value(1).Edge());
|
||||
if (VI.IsSame(VL)) { // The direction of parsing is always preserved
|
||||
if (Or == TopAbs_REVERSED)
|
||||
Forward = Standard_False;
|
||||
@@ -182,29 +182,29 @@ Handle(Adaptor3d_Curve) BRepAdaptor_CompCurve::ShallowCopy() const
|
||||
CurIndex = (i1+i2)/2; // Small optimization
|
||||
if (i1==i2) {
|
||||
if (l > f)
|
||||
HC = Handle(BRepAdaptor_Curve)::DownCast(myCurves->Value(i1)->Trim(f, l, PTol));
|
||||
HC = Handle(BRepAdaptor_Curve)::DownCast(myCurves->Value(i1).Trim(f, l, PTol));
|
||||
else
|
||||
HC = Handle(BRepAdaptor_Curve)::DownCast(myCurves->Value(i1)->Trim(l, f, PTol));
|
||||
myCurves->SetValue(i1, HC);
|
||||
HC = Handle(BRepAdaptor_Curve)::DownCast(myCurves->Value(i1).Trim(l, f, PTol));
|
||||
myCurves->SetValue(i1, *HC);
|
||||
}
|
||||
else {
|
||||
const Handle(BRepAdaptor_Curve)& c1 = myCurves->Value(i1);
|
||||
const Handle(BRepAdaptor_Curve)& c2 = myCurves->Value(i2);
|
||||
const BRepAdaptor_Curve& c1 = myCurves->Value(i1);
|
||||
const BRepAdaptor_Curve& c2 = myCurves->Value(i2);
|
||||
Standard_Real k;
|
||||
|
||||
k = c1->LastParameter();
|
||||
k = c1.LastParameter();
|
||||
if (k>f)
|
||||
HC = Handle(BRepAdaptor_Curve)::DownCast(c1->Trim(f, k, PTol));
|
||||
HC = Handle(BRepAdaptor_Curve)::DownCast(c1.Trim(f, k, PTol));
|
||||
else
|
||||
HC = Handle(BRepAdaptor_Curve)::DownCast(c1->Trim(k, f, PTol));
|
||||
myCurves->SetValue(i1, HC);
|
||||
HC = Handle(BRepAdaptor_Curve)::DownCast(c1.Trim(k, f, PTol));
|
||||
myCurves->SetValue(i1, *HC);
|
||||
|
||||
k = c2->FirstParameter();
|
||||
k = c2.FirstParameter();
|
||||
if (k<=l)
|
||||
HC = Handle(BRepAdaptor_Curve)::DownCast(c2->Trim(k, l, PTol));
|
||||
HC = Handle(BRepAdaptor_Curve)::DownCast(c2.Trim(k, l, PTol));
|
||||
else
|
||||
HC = Handle(BRepAdaptor_Curve)::DownCast(c2->Trim(l, k, PTol));
|
||||
myCurves->SetValue(i2, HC);
|
||||
HC = Handle(BRepAdaptor_Curve)::DownCast(c2.Trim(l, k, PTol));
|
||||
myCurves->SetValue(i2, *HC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
Standard_Integer index = CurIndex;
|
||||
UonE = U;
|
||||
Prepare(UonE, d, index);
|
||||
E = myCurves->Value(index)->Edge();
|
||||
E = myCurves->Value(index).Edge();
|
||||
}
|
||||
|
||||
Standard_Real BRepAdaptor_CompCurve::FirstParameter() const
|
||||
@@ -237,14 +237,14 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
GeomAbs_Shape BRepAdaptor_CompCurve::Continuity() const
|
||||
{
|
||||
if ( myCurves->Length() > 1) return GeomAbs_C0;
|
||||
return myCurves->Value(1)->Continuity();
|
||||
return myCurves->Value(1).Continuity();
|
||||
}
|
||||
|
||||
Standard_Integer BRepAdaptor_CompCurve::NbIntervals(const GeomAbs_Shape S) const
|
||||
{
|
||||
Standard_Integer NbInt, ii;
|
||||
for (ii=1, NbInt=0; ii<=myCurves->Length(); ii++)
|
||||
NbInt += myCurves->ChangeValue(ii)->NbIntervals(S);
|
||||
NbInt += myCurves->ChangeValue(ii).NbIntervals(S);
|
||||
|
||||
return NbInt;
|
||||
}
|
||||
@@ -256,9 +256,9 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
Standard_Real f, F, delta;
|
||||
|
||||
// First curve (direction of parsing of the edge)
|
||||
n = myCurves->ChangeValue(1)->NbIntervals(S);
|
||||
n = myCurves->ChangeValue(1).NbIntervals(S);
|
||||
Handle(TColStd_HArray1OfReal) Ti = new (TColStd_HArray1OfReal) (1, n+1);
|
||||
myCurves->ChangeValue(1)->Intervals(Ti->ChangeArray1(), S);
|
||||
myCurves->ChangeValue(1).Intervals(Ti->ChangeArray1(), S);
|
||||
InvPrepare(1, f, delta);
|
||||
F = myKnots->Value(1);
|
||||
if (delta < 0) {
|
||||
@@ -273,9 +273,9 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
|
||||
// and the next
|
||||
for (ii=2; ii<=myCurves->Length(); ii++) {
|
||||
n = myCurves->ChangeValue(ii)->NbIntervals(S);
|
||||
n = myCurves->ChangeValue(ii).NbIntervals(S);
|
||||
if (n != Ti->Length()-1) Ti = new (TColStd_HArray1OfReal) (1, n+1);
|
||||
myCurves->ChangeValue(ii)->Intervals(Ti->ChangeArray1(), S);
|
||||
myCurves->ChangeValue(ii).Intervals(Ti->ChangeArray1(), S);
|
||||
InvPrepare(ii, f, delta);
|
||||
F = myKnots->Value(ii);
|
||||
if (delta < 0) {
|
||||
@@ -321,7 +321,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
Standard_Real u = U, d;
|
||||
Standard_Integer index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
return myCurves->Value(index)->Value(u);
|
||||
return myCurves->Value(index).Value(u);
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::D0(const Standard_Real U,
|
||||
@@ -330,7 +330,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
Standard_Real u = U, d;
|
||||
Standard_Integer index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
myCurves->Value(index)->D0(u, P);
|
||||
myCurves->Value(index).D0(u, P);
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::D1(const Standard_Real U,
|
||||
@@ -340,7 +340,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
Standard_Real u = U, d;
|
||||
Standard_Integer index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
myCurves->Value(index)->D1(u, P, V);
|
||||
myCurves->Value(index).D1(u, P, V);
|
||||
V*=d;
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
Standard_Real u = U, d;
|
||||
Standard_Integer index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
myCurves->Value(index)->D2(u, P, V1, V2);
|
||||
myCurves->Value(index).D2(u, P, V1, V2);
|
||||
V1*=d;
|
||||
V2 *= d*d;
|
||||
}
|
||||
@@ -365,7 +365,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
Standard_Real u = U, d;
|
||||
Standard_Integer index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
myCurves->Value(index)->D3(u, P, V1, V2, V3);
|
||||
myCurves->Value(index).D3(u, P, V1, V2, V3);
|
||||
V1*=d;
|
||||
V2 *= d*d;
|
||||
V3 *= d*d*d;
|
||||
@@ -378,7 +378,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
Standard_Integer index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
|
||||
return (myCurves->Value(index)->DN(u, N) * Pow(d, N));
|
||||
return (myCurves->Value(index).DN(u, N) * Pow(d, N));
|
||||
}
|
||||
|
||||
Standard_Real BRepAdaptor_CompCurve::Resolution(const Standard_Real R3d) const
|
||||
@@ -386,7 +386,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
Standard_Real Res = 1.e200, r;
|
||||
Standard_Integer ii, L = myCurves->Length();
|
||||
for (ii=1; ii<=L; ii++) {
|
||||
r = myCurves->Value(ii)->Resolution(R3d);
|
||||
r = myCurves->Value(ii).Resolution(R3d);
|
||||
if (r < Res) Res = r;
|
||||
}
|
||||
return Res;
|
||||
@@ -401,57 +401,57 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
|
||||
gp_Lin BRepAdaptor_CompCurve::Line() const
|
||||
{
|
||||
return myCurves->Value(1)->Line();
|
||||
return myCurves->Value(1).Line();
|
||||
}
|
||||
|
||||
gp_Circ BRepAdaptor_CompCurve::Circle() const
|
||||
{
|
||||
return myCurves->Value(1)->Circle();
|
||||
return myCurves->Value(1).Circle();
|
||||
}
|
||||
|
||||
gp_Elips BRepAdaptor_CompCurve::Ellipse() const
|
||||
{
|
||||
return myCurves->Value(1)->Ellipse();
|
||||
return myCurves->Value(1).Ellipse();
|
||||
}
|
||||
|
||||
gp_Hypr BRepAdaptor_CompCurve::Hyperbola() const
|
||||
{
|
||||
return myCurves->Value(1)->Hyperbola();
|
||||
return myCurves->Value(1).Hyperbola();
|
||||
}
|
||||
|
||||
gp_Parab BRepAdaptor_CompCurve::Parabola() const
|
||||
{
|
||||
return myCurves->Value(1)->Parabola();
|
||||
return myCurves->Value(1).Parabola();
|
||||
}
|
||||
|
||||
Standard_Integer BRepAdaptor_CompCurve::Degree() const
|
||||
{
|
||||
return myCurves->Value(1)->Degree();
|
||||
return myCurves->Value(1).Degree();
|
||||
}
|
||||
|
||||
Standard_Boolean BRepAdaptor_CompCurve::IsRational() const
|
||||
{
|
||||
return myCurves->Value(1)->IsRational();
|
||||
return myCurves->Value(1).IsRational();
|
||||
}
|
||||
|
||||
Standard_Integer BRepAdaptor_CompCurve::NbPoles() const
|
||||
{
|
||||
return myCurves->Value(1)->NbPoles();
|
||||
return myCurves->Value(1).NbPoles();
|
||||
}
|
||||
|
||||
Standard_Integer BRepAdaptor_CompCurve::NbKnots() const
|
||||
{
|
||||
return myCurves->Value(1)->NbKnots();
|
||||
return myCurves->Value(1).NbKnots();
|
||||
}
|
||||
|
||||
Handle(Geom_BezierCurve) BRepAdaptor_CompCurve::Bezier() const
|
||||
{
|
||||
return myCurves->Value(1)->Bezier();
|
||||
return myCurves->Value(1).Bezier();
|
||||
}
|
||||
|
||||
Handle(Geom_BSplineCurve) BRepAdaptor_CompCurve::BSpline() const
|
||||
{
|
||||
return myCurves->Value(1)->BSpline();
|
||||
return myCurves->Value(1).BSpline();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -496,7 +496,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
|
||||
}
|
||||
|
||||
// Invert ?
|
||||
const TopoDS_Edge& E = myCurves->Value(theCurIndex)->Edge();
|
||||
const TopoDS_Edge& E = myCurves->Value(theCurIndex).Edge();
|
||||
TopAbs_Orientation Or = E.Orientation();
|
||||
Standard_Boolean Reverse;
|
||||
Reverse = (Forward && (Or == TopAbs_REVERSED)) ||
|
||||
@@ -521,7 +521,7 @@ void BRepAdaptor_CompCurve::InvPrepare(const Standard_Integer index,
|
||||
Standard_Real& Delta) const
|
||||
{
|
||||
// Invert?
|
||||
const TopoDS_Edge& E = myCurves->Value(index)->Edge();
|
||||
const TopoDS_Edge& E = myCurves->Value(index).Edge();
|
||||
TopAbs_Orientation Or = E.Orientation();
|
||||
Standard_Boolean Reverse;
|
||||
Reverse = (Forward && (Or == TopAbs_REVERSED)) ||
|
||||
|
@@ -80,8 +80,8 @@ Handle(Adaptor3d_Curve) BRepAdaptor_Curve::ShallowCopy() const
|
||||
|
||||
aCopy->myTrsf = myTrsf;
|
||||
|
||||
const Handle(Adaptor3d_Curve) aCurve = myCurve->ShallowCopy();
|
||||
const Handle(GeomAdaptor_Curve) aGeomCurve = Handle(GeomAdaptor_Curve)::DownCast(aCurve);
|
||||
const Handle(Adaptor3d_Curve) aCurve = myCurve.ShallowCopy();
|
||||
const GeomAdaptor_Curve& aGeomCurve = *(Handle(GeomAdaptor_Curve)::DownCast(aCurve));
|
||||
aCopy->myCurve = aGeomCurve;
|
||||
|
||||
if (!myConSurf.IsNull())
|
||||
@@ -99,7 +99,7 @@ Handle(Adaptor3d_Curve) BRepAdaptor_Curve::ShallowCopy() const
|
||||
//=======================================================================
|
||||
void BRepAdaptor_Curve::Reset()
|
||||
{
|
||||
myCurve->Reset();
|
||||
myCurve.Reset();
|
||||
myConSurf.Nullify();
|
||||
myEdge.Nullify();
|
||||
myTrsf = gp_Trsf();
|
||||
@@ -120,8 +120,7 @@ void BRepAdaptor_Curve::Initialize(const TopoDS_Edge& E)
|
||||
Handle(Geom_Curve) C = BRep_Tool::Curve(E,L,pf,pl);
|
||||
|
||||
if (!C.IsNull()) {
|
||||
myCurve = new GeomAdaptor_Curve();
|
||||
myCurve->Load(C,pf,pl);
|
||||
myCurve.Load(C,pf,pl);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Curve) PC;
|
||||
@@ -148,7 +147,7 @@ void BRepAdaptor_Curve::Initialize(const TopoDS_Edge& E)
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Curve::Initialize(const TopoDS_Edge& E,
|
||||
const TopoDS_Face& F)
|
||||
const TopoDS_Face& F)
|
||||
{
|
||||
myConSurf.Nullify();
|
||||
|
||||
@@ -203,7 +202,7 @@ Standard_Boolean BRepAdaptor_Curve::IsCurveOnSurface() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Handle(GeomAdaptor_Curve)& BRepAdaptor_Curve::Curve() const
|
||||
const GeomAdaptor_Curve& BRepAdaptor_Curve::Curve() const
|
||||
{
|
||||
return myCurve;
|
||||
}
|
||||
@@ -213,9 +212,9 @@ const Handle(GeomAdaptor_Curve)& BRepAdaptor_Curve::Curve() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Handle(Adaptor3d_CurveOnSurface)& BRepAdaptor_Curve::CurveOnSurface() const
|
||||
const Adaptor3d_CurveOnSurface& BRepAdaptor_Curve::CurveOnSurface() const
|
||||
{
|
||||
return myConSurf;
|
||||
return *myConSurf;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -246,7 +245,7 @@ Standard_Real BRepAdaptor_Curve::Tolerance() const
|
||||
Standard_Real BRepAdaptor_Curve::FirstParameter() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve->FirstParameter();
|
||||
return myCurve.FirstParameter();
|
||||
}
|
||||
else {
|
||||
return myConSurf->FirstParameter();
|
||||
@@ -258,10 +257,10 @@ Standard_Real BRepAdaptor_Curve::FirstParameter() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BRepAdaptor_Curve::LastParameter() const
|
||||
Standard_Real BRepAdaptor_Curve::LastParameter() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve->LastParameter();
|
||||
return myCurve.LastParameter();
|
||||
}
|
||||
else {
|
||||
return myConSurf->LastParameter();
|
||||
@@ -276,7 +275,7 @@ Standard_Real BRepAdaptor_Curve::LastParameter() const
|
||||
GeomAbs_Shape BRepAdaptor_Curve::Continuity() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve->Continuity();
|
||||
return myCurve.Continuity();
|
||||
}
|
||||
else {
|
||||
return myConSurf->Continuity();
|
||||
@@ -291,7 +290,7 @@ GeomAbs_Shape BRepAdaptor_Curve::Continuity() const
|
||||
Standard_Integer BRepAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve->NbIntervals(S);
|
||||
return myCurve.NbIntervals(S);
|
||||
}
|
||||
else {
|
||||
return myConSurf->NbIntervals(S);
|
||||
@@ -307,7 +306,7 @@ void BRepAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
|
||||
const GeomAbs_Shape S) const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
myCurve->Intervals(T, S);
|
||||
myCurve.Intervals(T, S);
|
||||
}
|
||||
else {
|
||||
myConSurf->Intervals(T, S);
|
||||
@@ -321,16 +320,17 @@ void BRepAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
|
||||
//=======================================================================
|
||||
|
||||
Handle(Adaptor3d_Curve) BRepAdaptor_Curve::Trim(const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const Standard_Real Tol) const
|
||||
const Standard_Real Last,
|
||||
const Standard_Real Tol) const
|
||||
{
|
||||
// On fait une copie de this pour garder la trsf.
|
||||
Handle(BRepAdaptor_Curve) res;
|
||||
if (myConSurf.IsNull()){
|
||||
Handle(GeomAdaptor_Curve) aGAC = myCurve;
|
||||
const_cast<Handle(GeomAdaptor_Curve)&>(myCurve) = Handle(GeomAdaptor_Curve)::DownCast(myCurve->Trim(First, Last, Tol));
|
||||
res = new BRepAdaptor_Curve(*this);
|
||||
const_cast<Handle(GeomAdaptor_Curve)&>(myCurve) = aGAC;
|
||||
Standard_Real pf = FirstParameter(), pl = LastParameter();
|
||||
Handle(Geom_Curve) C = myCurve.Curve();
|
||||
const_cast<GeomAdaptor_Curve*>(&myCurve)->Load(C,First,Last);
|
||||
res = new BRepAdaptor_Curve (*this);
|
||||
const_cast<GeomAdaptor_Curve*>(&myCurve)->Load(C,pf,pl);
|
||||
}
|
||||
else {
|
||||
Handle(Adaptor3d_CurveOnSurface) sav = myConSurf;
|
||||
@@ -350,7 +350,7 @@ Handle(Adaptor3d_Curve) BRepAdaptor_Curve::Trim(const Standard_Real First,
|
||||
Standard_Boolean BRepAdaptor_Curve::IsClosed() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve->IsClosed();
|
||||
return myCurve.IsClosed();
|
||||
}
|
||||
else {
|
||||
return myConSurf->IsClosed();
|
||||
@@ -365,7 +365,7 @@ Standard_Boolean BRepAdaptor_Curve::IsClosed() const
|
||||
Standard_Boolean BRepAdaptor_Curve::IsPeriodic() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve->IsPeriodic();
|
||||
return myCurve.IsPeriodic();
|
||||
}
|
||||
else {
|
||||
return myConSurf->IsPeriodic();
|
||||
@@ -380,7 +380,7 @@ Standard_Boolean BRepAdaptor_Curve::IsPeriodic() const
|
||||
Standard_Real BRepAdaptor_Curve::Period() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve->Period();
|
||||
return myCurve.Period();
|
||||
}
|
||||
else {
|
||||
return myConSurf->Period();
|
||||
@@ -396,7 +396,7 @@ gp_Pnt BRepAdaptor_Curve::Value(const Standard_Real U) const
|
||||
{
|
||||
gp_Pnt P;
|
||||
if (myConSurf.IsNull())
|
||||
P = myCurve->Value(U);
|
||||
P = myCurve.Value(U);
|
||||
else
|
||||
P = myConSurf->Value(U);
|
||||
P.Transform(myTrsf);
|
||||
@@ -411,7 +411,7 @@ gp_Pnt BRepAdaptor_Curve::Value(const Standard_Real U) const
|
||||
void BRepAdaptor_Curve::D0(const Standard_Real U, gp_Pnt& P) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
myCurve->D0(U,P);
|
||||
myCurve.D0(U,P);
|
||||
else
|
||||
myConSurf->D0(U,P);
|
||||
P.Transform(myTrsf);
|
||||
@@ -423,10 +423,10 @@ void BRepAdaptor_Curve::D0(const Standard_Real U, gp_Pnt& P) const
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Curve::D1(const Standard_Real U,
|
||||
gp_Pnt& P, gp_Vec& V) const
|
||||
gp_Pnt& P, gp_Vec& V) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
myCurve->D1(U,P,V);
|
||||
myCurve.D1(U,P,V);
|
||||
else
|
||||
myConSurf->D1(U,P,V);
|
||||
P.Transform(myTrsf);
|
||||
@@ -439,10 +439,10 @@ void BRepAdaptor_Curve::D1(const Standard_Real U,
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Curve::D2(const Standard_Real U,
|
||||
gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const
|
||||
gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
myCurve->D2(U,P,V1,V2);
|
||||
myCurve.D2(U,P,V1,V2);
|
||||
else
|
||||
myConSurf->D2(U,P,V1,V2);
|
||||
P.Transform(myTrsf);
|
||||
@@ -456,11 +456,11 @@ void BRepAdaptor_Curve::D2(const Standard_Real U,
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_Curve::D3(const Standard_Real U,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
myCurve->D3(U,P,V1,V2,V3);
|
||||
myCurve.D3(U,P,V1,V2,V3);
|
||||
else
|
||||
myConSurf->D3(U,P,V1,V2,V3);
|
||||
P.Transform(myTrsf);
|
||||
@@ -474,12 +474,12 @@ void BRepAdaptor_Curve::D3(const Standard_Real U,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Vec BRepAdaptor_Curve::DN (const Standard_Real U,
|
||||
const Standard_Integer N) const
|
||||
gp_Vec BRepAdaptor_Curve::DN(const Standard_Real U,
|
||||
const Standard_Integer N) const
|
||||
{
|
||||
gp_Vec V;
|
||||
if (myConSurf.IsNull())
|
||||
V = myCurve->DN(U,N);
|
||||
V = myCurve.DN(U,N);
|
||||
else
|
||||
V = myConSurf->DN(U,N);
|
||||
V.Transform(myTrsf);
|
||||
@@ -494,7 +494,7 @@ gp_Vec BRepAdaptor_Curve::DN (const Standard_Real U,
|
||||
Standard_Real BRepAdaptor_Curve::Resolution(const Standard_Real R) const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve->Resolution(R);
|
||||
return myCurve.Resolution(R);
|
||||
}
|
||||
else {
|
||||
return myConSurf->Resolution(R);
|
||||
@@ -509,7 +509,7 @@ Standard_Real BRepAdaptor_Curve::Resolution(const Standard_Real R) const
|
||||
GeomAbs_CurveType BRepAdaptor_Curve::GetType() const
|
||||
{
|
||||
if (myConSurf.IsNull()) {
|
||||
return myCurve->GetType();
|
||||
return myCurve.GetType();
|
||||
}
|
||||
else {
|
||||
return myConSurf->GetType();
|
||||
@@ -525,7 +525,7 @@ gp_Lin BRepAdaptor_Curve::Line() const
|
||||
{
|
||||
gp_Lin L;
|
||||
if (myConSurf.IsNull())
|
||||
L = myCurve->Line();
|
||||
L = myCurve.Line();
|
||||
else
|
||||
L = myConSurf->Line();
|
||||
L.Transform(myTrsf);
|
||||
@@ -541,7 +541,7 @@ gp_Circ BRepAdaptor_Curve::Circle() const
|
||||
{
|
||||
gp_Circ C;
|
||||
if (myConSurf.IsNull())
|
||||
C = myCurve->Circle();
|
||||
C = myCurve.Circle();
|
||||
else
|
||||
C = myConSurf->Circle();
|
||||
C.Transform(myTrsf);
|
||||
@@ -557,7 +557,7 @@ gp_Elips BRepAdaptor_Curve::Ellipse() const
|
||||
{
|
||||
gp_Elips E;
|
||||
if (myConSurf.IsNull())
|
||||
E = myCurve->Ellipse();
|
||||
E = myCurve.Ellipse();
|
||||
else
|
||||
E = myConSurf->Ellipse();
|
||||
E.Transform(myTrsf);
|
||||
@@ -573,7 +573,7 @@ gp_Hypr BRepAdaptor_Curve::Hyperbola() const
|
||||
{
|
||||
gp_Hypr H;
|
||||
if (myConSurf.IsNull())
|
||||
H = myCurve->Hyperbola();
|
||||
H = myCurve.Hyperbola();
|
||||
else
|
||||
H = myConSurf->Hyperbola();
|
||||
H.Transform(myTrsf);
|
||||
@@ -589,7 +589,7 @@ gp_Parab BRepAdaptor_Curve::Parabola() const
|
||||
{
|
||||
gp_Parab P;
|
||||
if (myConSurf.IsNull())
|
||||
P = myCurve->Parabola();
|
||||
P = myCurve.Parabola();
|
||||
else
|
||||
P = myConSurf->Parabola();
|
||||
P.Transform(myTrsf);
|
||||
@@ -604,7 +604,7 @@ gp_Parab BRepAdaptor_Curve::Parabola() const
|
||||
Standard_Integer BRepAdaptor_Curve::Degree() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
return myCurve->Degree();
|
||||
return myCurve.Degree();
|
||||
else
|
||||
return myConSurf->Degree();
|
||||
}
|
||||
@@ -617,7 +617,7 @@ Standard_Integer BRepAdaptor_Curve::Degree() const
|
||||
Standard_Boolean BRepAdaptor_Curve::IsRational() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
return myCurve->IsRational();
|
||||
return myCurve.IsRational();
|
||||
else
|
||||
return myConSurf->IsRational();
|
||||
}
|
||||
@@ -629,7 +629,7 @@ Standard_Boolean BRepAdaptor_Curve::IsRational() const
|
||||
Standard_Integer BRepAdaptor_Curve::NbPoles() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
return myCurve->NbPoles();
|
||||
return myCurve.NbPoles();
|
||||
else
|
||||
return myConSurf->NbPoles();
|
||||
}
|
||||
@@ -641,7 +641,7 @@ Standard_Integer BRepAdaptor_Curve::NbPoles() const
|
||||
Standard_Integer BRepAdaptor_Curve::NbKnots() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
return myCurve->NbKnots();
|
||||
return myCurve.NbKnots();
|
||||
else
|
||||
return myConSurf->NbKnots();
|
||||
}
|
||||
@@ -655,7 +655,7 @@ Handle(Geom_BezierCurve) BRepAdaptor_Curve::Bezier() const
|
||||
{
|
||||
Handle(Geom_BezierCurve) BC;
|
||||
if (myConSurf.IsNull()) {
|
||||
BC = myCurve->Bezier();
|
||||
BC = myCurve.Bezier();
|
||||
}
|
||||
else {
|
||||
BC = myConSurf->Bezier();
|
||||
@@ -674,7 +674,7 @@ Handle(Geom_BSplineCurve) BRepAdaptor_Curve::BSpline() const
|
||||
{
|
||||
Handle(Geom_BSplineCurve) BS;
|
||||
if (myConSurf.IsNull()) {
|
||||
BS = myCurve->BSpline();
|
||||
BS = myCurve.BSpline();
|
||||
}
|
||||
else {
|
||||
BS = myConSurf->BSpline();
|
||||
@@ -690,10 +690,10 @@ Handle(Geom_BSplineCurve) BRepAdaptor_Curve::BSpline() const
|
||||
|
||||
Handle(Geom_OffsetCurve) BRepAdaptor_Curve::OffsetCurve() const
|
||||
{
|
||||
if ( !Is3DCurve() || myCurve->GetType() != GeomAbs_OffsetCurve)
|
||||
if ( !Is3DCurve() || myCurve.GetType() != GeomAbs_OffsetCurve)
|
||||
throw Standard_NoSuchObject("BRepAdaptor_Curve::OffsetCurve");
|
||||
|
||||
Handle(Geom_OffsetCurve) anOffC = myCurve->OffsetCurve();
|
||||
Handle(Geom_OffsetCurve) anOffC = myCurve.OffsetCurve();
|
||||
return myTrsf.Form() == gp_Identity
|
||||
? anOffC : Handle(Geom_OffsetCurve)::DownCast(anOffC->Transformed(myTrsf));
|
||||
}
|
||||
|
@@ -103,10 +103,10 @@ public:
|
||||
Standard_EXPORT Standard_Boolean IsCurveOnSurface() const;
|
||||
|
||||
//! Returns the Curve of the edge.
|
||||
Standard_EXPORT const Handle(GeomAdaptor_Curve)& Curve() const;
|
||||
Standard_EXPORT const GeomAdaptor_Curve& Curve() const;
|
||||
|
||||
//! Returns the CurveOnSurface of the edge.
|
||||
Standard_EXPORT const Handle(Adaptor3d_CurveOnSurface)& CurveOnSurface() const;
|
||||
Standard_EXPORT const Adaptor3d_CurveOnSurface& CurveOnSurface() const;
|
||||
|
||||
//! Returns the edge.
|
||||
Standard_EXPORT const TopoDS_Edge& Edge() const;
|
||||
@@ -217,7 +217,7 @@ public:
|
||||
private:
|
||||
|
||||
gp_Trsf myTrsf;
|
||||
Handle(GeomAdaptor_Curve) myCurve;
|
||||
GeomAdaptor_Curve myCurve;
|
||||
Handle(Adaptor3d_CurveOnSurface) myConSurf;
|
||||
TopoDS_Edge myEdge;
|
||||
|
||||
|
@@ -45,7 +45,6 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepAdaptor_Surface, Adaptor3d_Surface)
|
||||
//=======================================================================
|
||||
BRepAdaptor_Surface::BRepAdaptor_Surface()
|
||||
{
|
||||
mySurf = new GeomAdaptor_Surface();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +56,6 @@ BRepAdaptor_Surface::BRepAdaptor_Surface()
|
||||
BRepAdaptor_Surface::BRepAdaptor_Surface(const TopoDS_Face& F,
|
||||
const Standard_Boolean R)
|
||||
{
|
||||
mySurf = new GeomAdaptor_Surface();
|
||||
Initialize(F,R);
|
||||
}
|
||||
|
||||
@@ -71,8 +69,9 @@ Handle(Adaptor3d_Surface) BRepAdaptor_Surface::ShallowCopy() const
|
||||
{
|
||||
Handle(BRepAdaptor_Surface) aCopy = new BRepAdaptor_Surface();
|
||||
|
||||
const Handle(Adaptor3d_Surface) aSurface = mySurf->ShallowCopy();
|
||||
aCopy->mySurf = Handle(GeomAdaptor_Surface)::DownCast(aSurface);
|
||||
const Handle(Adaptor3d_Surface) aSurface = mySurf.ShallowCopy();
|
||||
const GeomAdaptor_Surface& aGeomSurface = *(Handle(GeomAdaptor_Surface)::DownCast(aSurface));
|
||||
aCopy->mySurf = aGeomSurface;
|
||||
|
||||
aCopy->myTrsf = myTrsf;
|
||||
aCopy->myFace = myFace;
|
||||
@@ -96,10 +95,10 @@ void BRepAdaptor_Surface::Initialize(const TopoDS_Face& F,
|
||||
if (Restriction) {
|
||||
Standard_Real umin,umax,vmin,vmax;
|
||||
BRepTools::UVBounds(F,umin,umax,vmin,vmax);
|
||||
mySurf->Load(aSurface,umin,umax,vmin,vmax);
|
||||
mySurf.Load(aSurface,umin,umax,vmin,vmax);
|
||||
}
|
||||
else
|
||||
mySurf->Load(aSurface);
|
||||
mySurf.Load(aSurface);
|
||||
myTrsf = L.Transformation();
|
||||
}
|
||||
|
||||
@@ -109,11 +108,23 @@ void BRepAdaptor_Surface::Initialize(const TopoDS_Face& F,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Handle(GeomAdaptor_Surface)& BRepAdaptor_Surface::Surface() const
|
||||
const GeomAdaptor_Surface& BRepAdaptor_Surface::Surface() const
|
||||
{
|
||||
return mySurf;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeSurface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GeomAdaptor_Surface& BRepAdaptor_Surface::ChangeSurface()
|
||||
{
|
||||
return mySurf;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Trsf
|
||||
//purpose :
|
||||
@@ -154,7 +165,7 @@ Standard_Real BRepAdaptor_Surface::Tolerance() const
|
||||
void BRepAdaptor_Surface::UIntervals(TColStd_Array1OfReal& T,
|
||||
const GeomAbs_Shape S) const
|
||||
{
|
||||
mySurf->UIntervals(T,S);
|
||||
mySurf.UIntervals(T,S);
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +177,7 @@ void BRepAdaptor_Surface::UIntervals(TColStd_Array1OfReal& T,
|
||||
void BRepAdaptor_Surface::VIntervals(TColStd_Array1OfReal& T,
|
||||
const GeomAbs_Shape S) const
|
||||
{
|
||||
mySurf->VIntervals(T,S);
|
||||
mySurf.VIntervals(T,S);
|
||||
}
|
||||
|
||||
|
||||
@@ -181,7 +192,7 @@ Handle(Adaptor3d_Surface) BRepAdaptor_Surface::UTrim
|
||||
const Standard_Real Tol ) const
|
||||
{
|
||||
Handle(GeomAdaptor_Surface) HS = new GeomAdaptor_Surface();
|
||||
HS->Load (Handle(Geom_Surface)::DownCast(mySurf->Surface()->Transformed(myTrsf)));
|
||||
HS->Load (Handle(Geom_Surface)::DownCast(mySurf.Surface()->Transformed(myTrsf)));
|
||||
return HS->UTrim(First,Last,Tol);
|
||||
}
|
||||
|
||||
@@ -197,7 +208,7 @@ Handle(Adaptor3d_Surface) BRepAdaptor_Surface::VTrim
|
||||
const Standard_Real Tol) const
|
||||
{
|
||||
Handle(GeomAdaptor_Surface) HS = new GeomAdaptor_Surface();
|
||||
HS->Load (Handle(Geom_Surface)::DownCast(mySurf->Surface()->Transformed(myTrsf)));
|
||||
HS->Load (Handle(Geom_Surface)::DownCast(mySurf.Surface()->Transformed(myTrsf)));
|
||||
return HS->VTrim(First,Last,Tol);
|
||||
}
|
||||
|
||||
@@ -210,7 +221,7 @@ Handle(Adaptor3d_Surface) BRepAdaptor_Surface::VTrim
|
||||
gp_Pnt BRepAdaptor_Surface::Value(const Standard_Real U,
|
||||
const Standard_Real V) const
|
||||
{
|
||||
return mySurf->Value(U,V).Transformed(myTrsf);
|
||||
return mySurf.Value(U,V).Transformed(myTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -222,7 +233,7 @@ void BRepAdaptor_Surface::D0(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
gp_Pnt& P) const
|
||||
{
|
||||
mySurf->D0(U,V,P);
|
||||
mySurf.D0(U,V,P);
|
||||
P.Transform(myTrsf);
|
||||
}
|
||||
|
||||
@@ -237,7 +248,7 @@ void BRepAdaptor_Surface::D1(const Standard_Real U,
|
||||
gp_Vec& D1U,
|
||||
gp_Vec& D1V)const
|
||||
{
|
||||
mySurf->D1(U,V,P,D1U,D1V);
|
||||
mySurf.D1(U,V,P,D1U,D1V);
|
||||
P.Transform(myTrsf);
|
||||
D1U.Transform(myTrsf);
|
||||
D1V.Transform(myTrsf);
|
||||
@@ -257,7 +268,7 @@ void BRepAdaptor_Surface::D2(const Standard_Real U,
|
||||
gp_Vec& D2V,
|
||||
gp_Vec& D2UV)const
|
||||
{
|
||||
mySurf->D2(U,V,P,D1U,D1V,D2U,D2V,D2UV);
|
||||
mySurf.D2(U,V,P,D1U,D1V,D2U,D2V,D2UV);
|
||||
P.Transform(myTrsf);
|
||||
D1U.Transform(myTrsf);
|
||||
D1V.Transform(myTrsf);
|
||||
@@ -280,7 +291,7 @@ void BRepAdaptor_Surface::D3(const Standard_Real U,
|
||||
gp_Vec& D3U, gp_Vec& D3V,
|
||||
gp_Vec& D3UUV, gp_Vec& D3UVV)const
|
||||
{
|
||||
mySurf->D3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
|
||||
mySurf.D3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
|
||||
P.Transform(myTrsf);
|
||||
D1U.Transform(myTrsf);
|
||||
D1V.Transform(myTrsf);
|
||||
@@ -304,7 +315,7 @@ gp_Vec BRepAdaptor_Surface::DN(const Standard_Real U,
|
||||
const Standard_Integer Nu,
|
||||
const Standard_Integer Nv) const
|
||||
{
|
||||
return mySurf->DN(U,V,Nu,Nv).Transformed(myTrsf);
|
||||
return mySurf.DN(U,V,Nu,Nv).Transformed(myTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -314,7 +325,7 @@ gp_Vec BRepAdaptor_Surface::DN(const Standard_Real U,
|
||||
|
||||
gp_Pln BRepAdaptor_Surface::Plane()const
|
||||
{
|
||||
return mySurf->Plane().Transformed(myTrsf);
|
||||
return mySurf.Plane().Transformed(myTrsf);
|
||||
}
|
||||
|
||||
|
||||
@@ -325,7 +336,7 @@ gp_Pln BRepAdaptor_Surface::Plane()const
|
||||
|
||||
gp_Cylinder BRepAdaptor_Surface::Cylinder()const
|
||||
{
|
||||
return mySurf->Cylinder().Transformed(myTrsf);
|
||||
return mySurf.Cylinder().Transformed(myTrsf);
|
||||
}
|
||||
|
||||
|
||||
@@ -336,7 +347,7 @@ gp_Cylinder BRepAdaptor_Surface::Cylinder()const
|
||||
|
||||
gp_Sphere BRepAdaptor_Surface::Sphere()const
|
||||
{
|
||||
return mySurf->Sphere().Transformed(myTrsf);
|
||||
return mySurf.Sphere().Transformed(myTrsf);
|
||||
}
|
||||
|
||||
|
||||
@@ -347,7 +358,7 @@ gp_Sphere BRepAdaptor_Surface::Sphere()const
|
||||
|
||||
gp_Cone BRepAdaptor_Surface::Cone()const
|
||||
{
|
||||
return mySurf->Cone().Transformed(myTrsf);
|
||||
return mySurf.Cone().Transformed(myTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -357,7 +368,7 @@ gp_Cone BRepAdaptor_Surface::Cone()const
|
||||
|
||||
gp_Torus BRepAdaptor_Surface::Torus()const
|
||||
{
|
||||
return mySurf->Torus().Transformed(myTrsf);
|
||||
return mySurf.Torus().Transformed(myTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -368,7 +379,7 @@ gp_Torus BRepAdaptor_Surface::Torus()const
|
||||
Handle(Geom_BezierSurface) BRepAdaptor_Surface::Bezier() const
|
||||
{
|
||||
return Handle(Geom_BezierSurface)::DownCast
|
||||
(mySurf->Bezier()->Transformed(myTrsf));
|
||||
(mySurf.Bezier()->Transformed(myTrsf));
|
||||
}
|
||||
|
||||
|
||||
@@ -380,7 +391,7 @@ Handle(Geom_BezierSurface) BRepAdaptor_Surface::Bezier() const
|
||||
Handle(Geom_BSplineSurface) BRepAdaptor_Surface::BSpline() const
|
||||
{
|
||||
return Handle(Geom_BSplineSurface)::DownCast
|
||||
(mySurf->BSpline()->Transformed(myTrsf));
|
||||
(mySurf.BSpline()->Transformed(myTrsf));
|
||||
}
|
||||
|
||||
|
||||
@@ -391,7 +402,7 @@ Handle(Geom_BSplineSurface) BRepAdaptor_Surface::BSpline() const
|
||||
|
||||
gp_Ax1 BRepAdaptor_Surface::AxeOfRevolution() const
|
||||
{
|
||||
return mySurf->AxeOfRevolution().Transformed(myTrsf);
|
||||
return mySurf.AxeOfRevolution().Transformed(myTrsf);
|
||||
}
|
||||
|
||||
|
||||
@@ -402,7 +413,7 @@ gp_Ax1 BRepAdaptor_Surface::AxeOfRevolution() const
|
||||
|
||||
gp_Dir BRepAdaptor_Surface::Direction() const
|
||||
{
|
||||
return mySurf->Direction().Transformed(myTrsf);
|
||||
return mySurf.Direction().Transformed(myTrsf);
|
||||
}
|
||||
|
||||
|
||||
@@ -414,7 +425,7 @@ gp_Dir BRepAdaptor_Surface::Direction() const
|
||||
Handle(Adaptor3d_Curve) BRepAdaptor_Surface::BasisCurve() const
|
||||
{
|
||||
Handle(GeomAdaptor_Surface) HS = new GeomAdaptor_Surface();
|
||||
HS->Load (Handle(Geom_Surface)::DownCast(mySurf->Surface()->Transformed(myTrsf)));
|
||||
HS->Load (Handle(Geom_Surface)::DownCast(mySurf.Surface()->Transformed(myTrsf)));
|
||||
|
||||
return HS->BasisCurve();
|
||||
}
|
||||
@@ -428,7 +439,7 @@ Handle(Adaptor3d_Curve) BRepAdaptor_Surface::BasisCurve() const
|
||||
Handle(Adaptor3d_Surface) BRepAdaptor_Surface::BasisSurface() const
|
||||
{
|
||||
Handle(GeomAdaptor_Surface) HS = new GeomAdaptor_Surface();
|
||||
HS->Load (Handle(Geom_Surface)::DownCast(mySurf->Surface()->Transformed(myTrsf)));
|
||||
HS->Load (Handle(Geom_Surface)::DownCast(mySurf.Surface()->Transformed(myTrsf)));
|
||||
return HS->BasisSurface();
|
||||
}
|
||||
|
||||
@@ -440,6 +451,6 @@ Handle(Adaptor3d_Surface) BRepAdaptor_Surface::BasisSurface() const
|
||||
|
||||
Standard_Real BRepAdaptor_Surface::OffsetValue() const
|
||||
{
|
||||
return mySurf->OffsetValue();
|
||||
return mySurf.OffsetValue();
|
||||
}
|
||||
|
||||
|
@@ -71,7 +71,10 @@ public:
|
||||
Standard_EXPORT void Initialize (const TopoDS_Face& F, const Standard_Boolean Restriction = Standard_True);
|
||||
|
||||
//! Returns the surface.
|
||||
Standard_EXPORT const Handle(GeomAdaptor_Surface)& Surface() const;
|
||||
Standard_EXPORT const GeomAdaptor_Surface& Surface() const;
|
||||
|
||||
//! Returns the surface.
|
||||
Standard_EXPORT GeomAdaptor_Surface& ChangeSurface();
|
||||
|
||||
//! Returns the surface coordinate system.
|
||||
Standard_EXPORT const gp_Trsf& Trsf() const;
|
||||
@@ -82,27 +85,27 @@ public:
|
||||
//! Returns the face tolerance.
|
||||
Standard_EXPORT Standard_Real Tolerance() const;
|
||||
|
||||
virtual Standard_Real FirstUParameter() const Standard_OVERRIDE { return mySurf->FirstUParameter(); }
|
||||
virtual Standard_Real FirstUParameter() const Standard_OVERRIDE { return mySurf.FirstUParameter(); }
|
||||
|
||||
virtual Standard_Real LastUParameter() const Standard_OVERRIDE { return mySurf->LastUParameter(); }
|
||||
virtual Standard_Real LastUParameter() const Standard_OVERRIDE { return mySurf.LastUParameter(); }
|
||||
|
||||
virtual Standard_Real FirstVParameter() const Standard_OVERRIDE { return mySurf->FirstVParameter(); }
|
||||
virtual Standard_Real FirstVParameter() const Standard_OVERRIDE { return mySurf.FirstVParameter(); }
|
||||
|
||||
virtual Standard_Real LastVParameter() const Standard_OVERRIDE { return mySurf->LastVParameter(); }
|
||||
virtual Standard_Real LastVParameter() const Standard_OVERRIDE { return mySurf.LastVParameter(); }
|
||||
|
||||
virtual GeomAbs_Shape UContinuity() const Standard_OVERRIDE { return mySurf->UContinuity(); }
|
||||
virtual GeomAbs_Shape UContinuity() const Standard_OVERRIDE { return mySurf.UContinuity(); }
|
||||
|
||||
virtual GeomAbs_Shape VContinuity() const Standard_OVERRIDE { return mySurf->VContinuity(); }
|
||||
virtual GeomAbs_Shape VContinuity() const Standard_OVERRIDE { return mySurf.VContinuity(); }
|
||||
|
||||
//! If necessary, breaks the surface in U intervals of
|
||||
//! continuity <S>. And returns the number of
|
||||
//! intervals.
|
||||
virtual Standard_Integer NbUIntervals (const GeomAbs_Shape theSh) const Standard_OVERRIDE { return mySurf->NbUIntervals (theSh); }
|
||||
virtual Standard_Integer NbUIntervals (const GeomAbs_Shape theSh) const Standard_OVERRIDE { return mySurf.NbUIntervals (theSh); }
|
||||
|
||||
//! If necessary, breaks the surface in V intervals of
|
||||
//! continuity <S>. And returns the number of
|
||||
//! intervals.
|
||||
virtual Standard_Integer NbVIntervals (const GeomAbs_Shape theSh) const Standard_OVERRIDE { return mySurf->NbVIntervals (theSh); }
|
||||
virtual Standard_Integer NbVIntervals (const GeomAbs_Shape theSh) const Standard_OVERRIDE { return mySurf.NbVIntervals (theSh); }
|
||||
|
||||
//! Returns the intervals with the requested continuity
|
||||
//! in the U direction.
|
||||
@@ -125,17 +128,17 @@ public:
|
||||
//! If <First> >= <Last>
|
||||
Standard_EXPORT Handle(Adaptor3d_Surface) VTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
|
||||
|
||||
virtual Standard_Boolean IsUClosed() const Standard_OVERRIDE { return mySurf->IsUClosed(); }
|
||||
virtual Standard_Boolean IsUClosed() const Standard_OVERRIDE { return mySurf.IsUClosed(); }
|
||||
|
||||
virtual Standard_Boolean IsVClosed() const Standard_OVERRIDE { return mySurf->IsVClosed(); }
|
||||
virtual Standard_Boolean IsVClosed() const Standard_OVERRIDE { return mySurf.IsVClosed(); }
|
||||
|
||||
virtual Standard_Boolean IsUPeriodic() const Standard_OVERRIDE { return mySurf->IsUPeriodic(); }
|
||||
virtual Standard_Boolean IsUPeriodic() const Standard_OVERRIDE { return mySurf.IsUPeriodic(); }
|
||||
|
||||
virtual Standard_Real UPeriod() const Standard_OVERRIDE { return mySurf->UPeriod(); }
|
||||
virtual Standard_Real UPeriod() const Standard_OVERRIDE { return mySurf.UPeriod(); }
|
||||
|
||||
virtual Standard_Boolean IsVPeriodic() const Standard_OVERRIDE { return mySurf->IsVPeriodic(); }
|
||||
virtual Standard_Boolean IsVPeriodic() const Standard_OVERRIDE { return mySurf.IsVPeriodic(); }
|
||||
|
||||
virtual Standard_Real VPeriod() const Standard_OVERRIDE { return mySurf->VPeriod(); }
|
||||
virtual Standard_Real VPeriod() const Standard_OVERRIDE { return mySurf.VPeriod(); }
|
||||
|
||||
//! Computes the point of parameters U,V on the surface.
|
||||
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
|
||||
@@ -171,17 +174,17 @@ public:
|
||||
|
||||
//! Returns the parametric U resolution corresponding
|
||||
//! to the real space resolution <R3d>.
|
||||
virtual Standard_Real UResolution (const Standard_Real theR3d) const Standard_OVERRIDE { return mySurf->UResolution (theR3d); }
|
||||
virtual Standard_Real UResolution (const Standard_Real theR3d) const Standard_OVERRIDE { return mySurf.UResolution (theR3d); }
|
||||
|
||||
//! Returns the parametric V resolution corresponding
|
||||
//! to the real space resolution <R3d>.
|
||||
virtual Standard_Real VResolution (const Standard_Real theR3d) const Standard_OVERRIDE { return mySurf->VResolution (theR3d); }
|
||||
virtual Standard_Real VResolution (const Standard_Real theR3d) const Standard_OVERRIDE { return mySurf.VResolution (theR3d); }
|
||||
|
||||
//! Returns the type of the surface : Plane, Cylinder,
|
||||
//! Cone, Sphere, Torus, BezierSurface,
|
||||
//! BSplineSurface, SurfaceOfRevolution,
|
||||
//! SurfaceOfExtrusion, OtherSurface
|
||||
virtual GeomAbs_SurfaceType GetType() const Standard_OVERRIDE { return mySurf->GetType(); }
|
||||
virtual GeomAbs_SurfaceType GetType() const Standard_OVERRIDE { return mySurf.GetType(); }
|
||||
|
||||
Standard_EXPORT gp_Pln Plane() const Standard_OVERRIDE;
|
||||
|
||||
@@ -193,21 +196,21 @@ public:
|
||||
|
||||
Standard_EXPORT gp_Torus Torus() const Standard_OVERRIDE;
|
||||
|
||||
virtual Standard_Integer UDegree() const Standard_OVERRIDE { return mySurf->UDegree(); }
|
||||
virtual Standard_Integer UDegree() const Standard_OVERRIDE { return mySurf.UDegree(); }
|
||||
|
||||
virtual Standard_Integer NbUPoles() const Standard_OVERRIDE { return mySurf->NbUPoles(); }
|
||||
virtual Standard_Integer NbUPoles() const Standard_OVERRIDE { return mySurf.NbUPoles(); }
|
||||
|
||||
virtual Standard_Integer VDegree() const Standard_OVERRIDE { return mySurf->VDegree(); }
|
||||
virtual Standard_Integer VDegree() const Standard_OVERRIDE { return mySurf.VDegree(); }
|
||||
|
||||
virtual Standard_Integer NbVPoles() const Standard_OVERRIDE { return mySurf->NbVPoles(); }
|
||||
virtual Standard_Integer NbVPoles() const Standard_OVERRIDE { return mySurf.NbVPoles(); }
|
||||
|
||||
virtual Standard_Integer NbUKnots() const Standard_OVERRIDE { return mySurf->NbUKnots(); }
|
||||
virtual Standard_Integer NbUKnots() const Standard_OVERRIDE { return mySurf.NbUKnots(); }
|
||||
|
||||
virtual Standard_Integer NbVKnots() const Standard_OVERRIDE { return mySurf->NbVKnots(); }
|
||||
virtual Standard_Integer NbVKnots() const Standard_OVERRIDE { return mySurf.NbVKnots(); }
|
||||
|
||||
virtual Standard_Boolean IsURational() const Standard_OVERRIDE { return mySurf->IsURational(); }
|
||||
virtual Standard_Boolean IsURational() const Standard_OVERRIDE { return mySurf.IsURational(); }
|
||||
|
||||
virtual Standard_Boolean IsVRational() const Standard_OVERRIDE { return mySurf->IsVRational(); }
|
||||
virtual Standard_Boolean IsVRational() const Standard_OVERRIDE { return mySurf.IsVRational(); }
|
||||
|
||||
Standard_EXPORT Handle(Geom_BezierSurface) Bezier() const Standard_OVERRIDE;
|
||||
|
||||
@@ -233,7 +236,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
Handle(GeomAdaptor_Surface) mySurf;
|
||||
GeomAdaptor_Surface mySurf;
|
||||
gp_Trsf myTrsf;
|
||||
TopoDS_Face myFace;
|
||||
|
||||
|
@@ -15,8 +15,13 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepAdaptor_Curve2d.hxx>
|
||||
#include <BRepAlgo.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
#include <BRepLib_MakeEdge.hxx>
|
||||
@@ -25,10 +30,13 @@
|
||||
#include <ElCLib.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Geom2dConvert_ApproxArcsSegments.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <GeomConvert.hxx>
|
||||
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
|
||||
#include <GeomLProp.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <ShapeFix_Shape.hxx>
|
||||
@@ -40,6 +48,7 @@
|
||||
#include <TColStd_SequenceOfBoolean.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
@@ -47,6 +56,166 @@
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
|
||||
// The minimal tolerance of approximation (edges can be defined with yet smaller tolerance)
|
||||
static const Standard_Real MINIMAL_TOLERANCE = 0.0001;
|
||||
|
||||
namespace {
|
||||
|
||||
struct OrientedCurve
|
||||
{
|
||||
Handle(Geom2d_TrimmedCurve) Curve;
|
||||
Standard_Boolean IsReverse;
|
||||
inline gp_Pnt2d Point (const Standard_Boolean isEnd) const
|
||||
{
|
||||
if (isEnd == IsReverse)
|
||||
return Curve->StartPoint();
|
||||
return Curve->EndPoint();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ConvertWire
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Wire BRepAlgo::ConvertWire(const TopoDS_Wire& theWire,
|
||||
const Standard_Real theAngleTol,
|
||||
const TopoDS_Face& theFace)
|
||||
{
|
||||
TopoDS_Wire aResult;
|
||||
Standard_Real aMaxTol(0.);
|
||||
const Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace);
|
||||
NCollection_Vector<OrientedCurve> vecCurve;
|
||||
|
||||
BRepTools_WireExplorer anExpE(theWire, theFace);
|
||||
// Explore the edges in the current wire, in their connection order
|
||||
for (; anExpE.More(); anExpE.Next()) {
|
||||
const TopoDS_Edge& anEdge = anExpE.Current();
|
||||
BRepAdaptor_Curve2d aCurve(anEdge, theFace);
|
||||
Standard_Real aTol = BRep_Tool::Tolerance(anEdge);
|
||||
if (aTol < MINIMAL_TOLERANCE)
|
||||
aTol = MINIMAL_TOLERANCE;
|
||||
if (aTol > aMaxTol)
|
||||
aMaxTol = aTol;
|
||||
Geom2dConvert_ApproxArcsSegments anAlgo(aCurve, aTol, theAngleTol);
|
||||
const TColGeom2d_SequenceOfCurve& aResultApprox = anAlgo.GetResult();
|
||||
|
||||
// Form the array of approximated elementary curves
|
||||
if (anEdge.Orientation() == TopAbs_REVERSED) {
|
||||
for (Standard_Integer iCrv = aResultApprox.Length(); iCrv > 0 ; iCrv--) {
|
||||
const Handle(Geom2d_Curve)& aCrv = aResultApprox(iCrv);
|
||||
if (aCrv.IsNull() == Standard_False) {
|
||||
OrientedCurve& anOCurve = vecCurve.Append(OrientedCurve());
|
||||
anOCurve.Curve = Handle(Geom2d_TrimmedCurve)::DownCast(aCrv);
|
||||
anOCurve.IsReverse = Standard_True;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Standard_Integer iCrv = 1; iCrv <= aResultApprox.Length(); iCrv++) {
|
||||
const Handle(Geom2d_Curve)& aCrv = aResultApprox(iCrv);
|
||||
if (aCrv.IsNull() == Standard_False) {
|
||||
OrientedCurve& anOCurve = vecCurve.Append(OrientedCurve());
|
||||
anOCurve.Curve = Handle(Geom2d_TrimmedCurve)::DownCast(aCrv);
|
||||
anOCurve.IsReverse = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vecCurve.Length() > 0)
|
||||
{
|
||||
// Build the first vertex
|
||||
BRep_Builder aVBuilder;
|
||||
gp_Pnt2d aPnt[2] = {
|
||||
vecCurve(0).Point(Standard_False),
|
||||
vecCurve(vecCurve.Length() - 1).Point(Standard_True)
|
||||
};
|
||||
Standard_Real aDist = aPnt[0].Distance(aPnt[1]);
|
||||
if (aDist > aMaxTol + Precision::Confusion())
|
||||
aDist = Precision::Confusion();
|
||||
else {
|
||||
aDist = 0.5 * aDist + Precision::Confusion();
|
||||
aPnt[0] = 0.5 * (aPnt[0].XY() + aPnt[1].XY());
|
||||
}
|
||||
gp_Pnt aPnt3d;
|
||||
aSurf->D0(aPnt[0].X(), aPnt[0].Y(), aPnt3d);
|
||||
TopoDS_Vertex aFirstVertex;
|
||||
aVBuilder.MakeVertex(aFirstVertex, aPnt3d, aDist);
|
||||
|
||||
// Loop creating edges
|
||||
BRepBuilderAPI_MakeWire aMkWire;
|
||||
TopoDS_Edge anEdgeRes;
|
||||
TopoDS_Vertex aVertex = aFirstVertex;
|
||||
for (Standard_Integer iCrv = 0; iCrv < vecCurve.Length(); iCrv++) {
|
||||
const OrientedCurve& anOCurve = vecCurve(iCrv);
|
||||
TopoDS_Vertex aNextVertex;
|
||||
aPnt[0] = anOCurve.Point(Standard_True);
|
||||
if (iCrv == vecCurve.Length() - 1) {
|
||||
aPnt[1] = vecCurve(0).Point(Standard_False);
|
||||
aDist = aPnt[0].Distance(aPnt[1]);
|
||||
if (aDist > aMaxTol + Precision::Confusion()) {
|
||||
aSurf->D0(aPnt[0].X(), aPnt[0].Y(), aPnt3d);
|
||||
aVBuilder.MakeVertex(aNextVertex, aPnt3d, Precision::Confusion());
|
||||
} else {
|
||||
aNextVertex = aFirstVertex;
|
||||
}
|
||||
} else {
|
||||
aPnt[1] = vecCurve(iCrv + 1).Point(Standard_False);
|
||||
aDist = 0.5 * (aPnt[0].Distance(aPnt[1])) + Precision::Confusion();
|
||||
aPnt[0] = 0.5 * (aPnt[0].XY() + aPnt[1].XY());
|
||||
aSurf->D0(aPnt[0].X(), aPnt[0].Y(), aPnt3d);
|
||||
aVBuilder.MakeVertex(aNextVertex, aPnt3d, aDist);
|
||||
}
|
||||
const Standard_Real aParam[2] = {
|
||||
anOCurve.Curve->FirstParameter(),
|
||||
anOCurve.Curve->LastParameter()
|
||||
};
|
||||
if (anOCurve.IsReverse) {
|
||||
BRepBuilderAPI_MakeEdge aMkEdge(anOCurve.Curve, aSurf, aNextVertex,
|
||||
aVertex, aParam[0], aParam[1]);
|
||||
anEdgeRes = aMkEdge.Edge();
|
||||
anEdgeRes.Orientation(TopAbs_REVERSED);
|
||||
} else {
|
||||
BRepBuilderAPI_MakeEdge aMkEdge(anOCurve.Curve, aSurf, aVertex,
|
||||
aNextVertex, aParam[0], aParam[1]);
|
||||
anEdgeRes = aMkEdge.Edge();
|
||||
}
|
||||
aVertex = aNextVertex;
|
||||
aMkWire.Add(anEdgeRes);
|
||||
}
|
||||
|
||||
if (aMkWire.IsDone())
|
||||
aResult = aMkWire.Wire();
|
||||
}
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ConvertFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Face BRepAlgo::ConvertFace (const TopoDS_Face& theFace,
|
||||
const Standard_Real theAngleTolerance)
|
||||
{
|
||||
TopoDS_Face aResult;
|
||||
const Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace);
|
||||
BRepBuilderAPI_MakeFace aMkFace(aSurf,Precision::Confusion());
|
||||
|
||||
TopExp_Explorer anExp(theFace, TopAbs_WIRE);
|
||||
for (; anExp.More(); anExp.Next()) {
|
||||
const TopoDS_Wire& aWire = TopoDS::Wire(anExp.Current());
|
||||
const TopoDS_Wire aNewWire = ConvertWire(aWire, theAngleTolerance, theFace);
|
||||
aMkFace.Add(aNewWire);
|
||||
}
|
||||
if (aMkFace.IsDone()) {
|
||||
aResult = aMkFace.Face();
|
||||
}
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ConcatenateWire
|
||||
//purpose :
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
class TopoDS_Wire;
|
||||
class TopoDS_Edge;
|
||||
class TopoDS_Face;
|
||||
class TopoDS_Shape;
|
||||
|
||||
|
||||
@@ -43,6 +44,28 @@ public:
|
||||
//! Junction points between edges of wire may be sharp,
|
||||
//! resulting curve of the resulting edge may be C0.
|
||||
Standard_EXPORT static TopoDS_Edge ConcatenateWireC0 (const TopoDS_Wire& Wire);
|
||||
|
||||
//! Method of wire conversion, calls BRepAlgo_Approx internally.
|
||||
//! @param theWire
|
||||
//! Input Wire object.
|
||||
//! @param theAngleTolerance
|
||||
//! Angle (in radians) defining the continuity of the wire: if two vectors
|
||||
//! differ by less than this angle, the result will be smooth (zero angle of
|
||||
//! tangent lines between curve elements).
|
||||
//! @return
|
||||
//! The new TopoDS_Wire object consisting of edges each representing an arc
|
||||
//! of circle or a linear segment. The accuracy of conversion is defined
|
||||
//! as the maximal tolerance of edges in theWire.
|
||||
static Standard_EXPORT TopoDS_Wire ConvertWire
|
||||
(const TopoDS_Wire& theWire,
|
||||
const Standard_Real theAngleTolerance,
|
||||
const TopoDS_Face& theFace);
|
||||
|
||||
//! Method of face conversion. The API corresponds to the method ConvertWire.
|
||||
//! This is a shortcut for calling ConvertWire() for each wire in theFace.
|
||||
static Standard_EXPORT TopoDS_Face ConvertFace
|
||||
(const TopoDS_Face& theFace,
|
||||
const Standard_Real theAngleTolerance);
|
||||
|
||||
//! Checks if the shape is "correct". If not, returns
|
||||
//! <Standard_False>, else returns <Standard_True>.
|
||||
|
@@ -42,12 +42,14 @@
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
//#define OCCT_DEBUG_ALGO
|
||||
//#define DRAW
|
||||
#ifdef DRAW
|
||||
#include <DBRep.hxx>
|
||||
#pragma comment(lib,"TKDraw")
|
||||
#endif
|
||||
#ifdef OCCT_DEBUG_ALGO
|
||||
Standard_Boolean AffichLoop = Standard_False;
|
||||
Standard_Boolean AffichLoop = Standard_True;
|
||||
Standard_Integer NbLoops = 0;
|
||||
Standard_Integer NbWires = 1;
|
||||
static char* name = new char[100];
|
||||
@@ -58,7 +60,8 @@ static char* name = new char[100];
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepAlgo_Loop::BRepAlgo_Loop()
|
||||
BRepAlgo_Loop::BRepAlgo_Loop():
|
||||
myTolConf (0.001)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -185,7 +188,6 @@ static TopoDS_Vertex UpdateClosedEdge(const TopoDS_Edge& E,
|
||||
Standard_Boolean OnStart = 0, OnEnd = 0;
|
||||
//// modified by jgv, 13.04.04 for OCC5634 ////
|
||||
TopExp::Vertices (E,V1,V2);
|
||||
//Standard_Real Tol = Precision::Confusion();
|
||||
Standard_Real Tol = BRep_Tool::Tolerance( V1 );
|
||||
///////////////////////////////////////////////
|
||||
|
||||
@@ -427,13 +429,12 @@ static void StoreInMVE (const TopoDS_Face& F,
|
||||
TopoDS_Edge& E,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& MVE,
|
||||
Standard_Boolean& YaCouture,
|
||||
TopTools_DataMapOfShapeShape& VerticesForSubstitute )
|
||||
TopTools_DataMapOfShapeShape& VerticesForSubstitute,
|
||||
const Standard_Real theTolConf)
|
||||
{
|
||||
TopoDS_Vertex V1, V2, V;
|
||||
TopTools_ListOfShape Empty;
|
||||
|
||||
Standard_Real Tol = 0.001; //5.e-05; //5.e-07;
|
||||
// gp_Pnt P1, P2, P;
|
||||
gp_Pnt P1, P;
|
||||
BRep_Builder BB;
|
||||
for (Standard_Integer iV = 1; iV <= MVE.Extent(); iV++)
|
||||
@@ -449,7 +450,7 @@ static void StoreInMVE (const TopoDS_Face& F,
|
||||
{
|
||||
V1 = TopoDS::Vertex( itl.Value() );
|
||||
P1 = BRep_Tool::Pnt( V1 );
|
||||
if (P.IsEqual( P1, Tol ) && !V.IsSame(V1))
|
||||
if (P.IsEqual( P1, theTolConf ) && !V.IsSame(V1))
|
||||
{
|
||||
V.Orientation( V1.Orientation() );
|
||||
if (VerticesForSubstitute.IsBound( V1 ))
|
||||
@@ -574,7 +575,7 @@ void BRepAlgo_Loop::Perform()
|
||||
TopoDS_Edge& E = TopoDS::Edge(itl1.Value());
|
||||
if (!Emap.Add(E))
|
||||
continue;
|
||||
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute);
|
||||
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute, myTolConf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -586,7 +587,7 @@ void BRepAlgo_Loop::Perform()
|
||||
for (itl.Initialize(myConstEdges); itl.More(); itl.Next()) {
|
||||
TopoDS_Edge& E = TopoDS::Edge(itl.Value());
|
||||
if (DejaVu.Add(E))
|
||||
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute);
|
||||
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute, myTolConf);
|
||||
}
|
||||
|
||||
#ifdef DRAW
|
||||
@@ -626,42 +627,42 @@ void BRepAlgo_Loop::Perform()
|
||||
//--------------------------------
|
||||
RemovePendingEdges(MVE);
|
||||
|
||||
if (MVE.Extent() == 0) break;
|
||||
if (MVE.Extent() == 0) break;
|
||||
//--------------------------------
|
||||
// Start edge.
|
||||
//--------------------------------
|
||||
EF = CE = TopoDS::Edge(MVE(1).First());
|
||||
TopExp::Vertices(CE,V1,V2);
|
||||
TopExp::Vertices(CE, V1, V2);
|
||||
//--------------------------------
|
||||
// VF vertex start of new wire
|
||||
//--------------------------------
|
||||
if (CE.Orientation() == TopAbs_FORWARD) { CV = VF = V1;}
|
||||
else { CV = VF = V2;}
|
||||
if (CE.Orientation() == TopAbs_FORWARD) { CV = VF = V1; }
|
||||
else { CV = VF = V2; }
|
||||
if (!MVE.Contains(CV)) continue;
|
||||
TopTools_ListOfShape& aListEdges = MVE.ChangeFromKey(CV);
|
||||
for ( itl.Initialize(aListEdges); itl.More(); itl.Next()) {
|
||||
for (itl.Initialize(aListEdges); itl.More(); itl.Next()) {
|
||||
if (itl.Value().IsEqual(CE)) {
|
||||
aListEdges.Remove(itl);
|
||||
break;
|
||||
aListEdges.Remove(itl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
End = Standard_False;
|
||||
|
||||
End = Standard_False;
|
||||
|
||||
while (!End) {
|
||||
//-------------------------------
|
||||
// Construction of a wire.
|
||||
//-------------------------------
|
||||
TopExp::Vertices(CE,V1,V2);
|
||||
TopExp::Vertices(CE, V1, V2);
|
||||
if (!CV.IsSame(V1)) CV = V1; else CV = V2;
|
||||
|
||||
B.Add (NW,CE);
|
||||
B.Add(NW, CE);
|
||||
UsedEdges.Add(CE);
|
||||
|
||||
if (!MVE.Contains(CV) || MVE.FindFromKey(CV).IsEmpty()) {
|
||||
End = Standard_True;
|
||||
}
|
||||
else {
|
||||
End = !SelectEdge(myFace,CE,CV,NE,MVE.ChangeFromKey(CV));
|
||||
End = !SelectEdge(myFace, CE, CV, NE, MVE.ChangeFromKey(CV));
|
||||
if (!End) {
|
||||
CE = NE;
|
||||
if (MVE.FindFromKey(CV).IsEmpty())
|
||||
@@ -672,35 +673,41 @@ void BRepAlgo_Loop::Perform()
|
||||
//--------------------------------------------------
|
||||
// Add new wire to the set of wires
|
||||
//------------------------------------------------
|
||||
Standard_Real Tol = 0.001; //5.e-05; //5.e-07;
|
||||
TopExp_Explorer explo( NW, TopAbs_VERTEX );
|
||||
for (; explo.More(); explo.Next())
|
||||
{
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex( explo.Current() );
|
||||
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &(aV).TShape());
|
||||
TV->Tolerance( Tol );
|
||||
TV->Modified( Standard_True );
|
||||
}
|
||||
for (explo.Init( NW, TopAbs_EDGE ); explo.More(); explo.Next())
|
||||
{
|
||||
const TopoDS_Edge& aE = TopoDS::Edge( explo.Current() );
|
||||
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &(aE).TShape());
|
||||
TE->Tolerance( Tol );
|
||||
TE->Modified( Standard_True );
|
||||
}
|
||||
|
||||
if (VF.IsSame(CV) && SamePnt2d(VF,EF,CE,myFace))
|
||||
if (VF.IsSame(CV))
|
||||
{
|
||||
NW.Closed (Standard_True);
|
||||
myNewWires.Append (NW);
|
||||
if (SamePnt2d(VF, EF, CE, myFace))
|
||||
{
|
||||
NW.Closed(Standard_True);
|
||||
myNewWires.Append(NW);
|
||||
}
|
||||
else if(BRep_Tool::Tolerance(VF) < myTolConf)
|
||||
{
|
||||
BRep_Builder aBB;
|
||||
aBB.UpdateVertex(VF, myTolConf);
|
||||
if (SamePnt2d(VF, EF, CE, myFace))
|
||||
{
|
||||
NW.Closed(Standard_True);
|
||||
myNewWires.Append(NW);
|
||||
}
|
||||
#ifdef OCCT_DEBUG_ALGO
|
||||
else
|
||||
{
|
||||
std::cout << "BRepAlgo_Loop: Open Wire" << std::endl;
|
||||
if (AffichLoop)
|
||||
std::cout << "OpenWire is : NW_" << NbLoops << "_" << NbWires << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef OCCT_DEBUG_ALGO
|
||||
else {
|
||||
std::cout <<"BRepAlgo_Loop: Open Wire"<<std::endl;
|
||||
std::cout << "BRepAlgo_Loop: Open Wire" << std::endl;
|
||||
if (AffichLoop)
|
||||
std::cout << "OpenWire is : NW_"<<NbLoops<<"_"<<NbWires<<std::endl;
|
||||
}
|
||||
std::cout << "OpenWire is : NW_" << NbLoops << "_" << NbWires << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DRAW
|
||||
if (AffichLoop) {
|
||||
sprintf(name,"NW_%d_%d",NbLoops,NbWires++);
|
||||
@@ -777,8 +784,6 @@ void BRepAlgo_Loop::CutEdge (const TopoDS_Edge& E,
|
||||
VF = TopoDS::Vertex(aLocalV);
|
||||
aLocalV = VCEI.Oriented(TopAbs_REVERSED);
|
||||
VL = TopoDS::Vertex(aLocalV);
|
||||
// VF = TopoDS::Vertex(VCEI.Oriented(TopAbs_FORWARD));
|
||||
// VL = TopoDS::Vertex(VCEI.Oriented(TopAbs_REVERSED));
|
||||
}
|
||||
SV.Prepend(VF);
|
||||
SV.Append(VL);
|
||||
@@ -813,13 +818,9 @@ void BRepAlgo_Loop::CutEdge (const TopoDS_Edge& E,
|
||||
B.Add (NewEdge,aLocalEdge);
|
||||
aLocalEdge = V2.Oriented(TopAbs_REVERSED);
|
||||
B.Add (TopoDS::Edge(NewEdge),aLocalEdge);
|
||||
// B.Add (NewEdge,V1.Oriented(TopAbs_FORWARD));
|
||||
// B.Add (NewEdge,V2.Oriented(TopAbs_REVERSED));
|
||||
if (V1.IsSame(VF))
|
||||
U1 = f;
|
||||
else
|
||||
// U1=BRep_Tool::Parameter
|
||||
// (TopoDS::Vertex(V1.Oriented(TopAbs_INTERNAL)),WE);
|
||||
{
|
||||
TopoDS_Shape aLocalV = V1.Oriented(TopAbs_INTERNAL);
|
||||
U1=BRep_Tool::Parameter(TopoDS::Vertex(aLocalV),WE);
|
||||
@@ -830,8 +831,6 @@ void BRepAlgo_Loop::CutEdge (const TopoDS_Edge& E,
|
||||
{
|
||||
TopoDS_Shape aLocalV = V2.Oriented(TopAbs_INTERNAL);
|
||||
U2=BRep_Tool::Parameter(TopoDS::Vertex(aLocalV),WE);
|
||||
// U2=BRep_Tool::Parameter
|
||||
// (TopoDS::Vertex(V2.Oriented(TopAbs_INTERNAL)),WE);
|
||||
}
|
||||
B.Range (TopoDS::Edge(NewEdge),U1,U2);
|
||||
#ifdef DRAW
|
||||
|
@@ -86,8 +86,17 @@ public:
|
||||
|
||||
Standard_EXPORT void VerticesForSubstitute (TopTools_DataMapOfShapeShape& VerVerMap);
|
||||
|
||||
//! Set maximal tolerance used for comparing distaces between vertices.
|
||||
void SetTolConf(const Standard_Real theTolConf)
|
||||
{
|
||||
myTolConf = theTolConf;
|
||||
}
|
||||
|
||||
|
||||
//! Get maximal tolerance used for comparing distaces between vertices.
|
||||
Standard_Real GetTolConf() const
|
||||
{
|
||||
return myTolConf;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -108,6 +117,7 @@ private:
|
||||
TopTools_DataMapOfShapeListOfShape myCutEdges;
|
||||
TopTools_DataMapOfShapeShape myVerticesForSubstitute;
|
||||
BRepAlgo_Image myImageVV;
|
||||
Standard_Real myTolConf;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -244,7 +244,7 @@ void BRepAlgo_NormalProjection::SetDefaultParams()
|
||||
for(i = 1; i <= NbEdges; i++){
|
||||
DescenList.Clear();
|
||||
Handle(BRepAdaptor_Curve) hcur = new BRepAdaptor_Curve (TopoDS::Edge(Edges->Value(i)));
|
||||
Elementary = IsElementary(hcur);
|
||||
Elementary = IsElementary(*hcur);
|
||||
for(j = 1; j <= NbFaces; j++){
|
||||
Handle(BRepAdaptor_Surface) hsur = new BRepAdaptor_Surface (TopoDS::Face(Faces->Value(j)));
|
||||
|
||||
@@ -627,10 +627,10 @@ void BRepAlgo_NormalProjection::SetDefaultParams()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepAlgo_NormalProjection::IsElementary(const Handle(Adaptor3d_Curve)& C) const
|
||||
Standard_Boolean BRepAlgo_NormalProjection::IsElementary(const Adaptor3d_Curve& C) const
|
||||
{
|
||||
GeomAbs_CurveType type;
|
||||
type = C->GetType();
|
||||
type = C.GetType();
|
||||
switch(type) {
|
||||
case GeomAbs_Line:
|
||||
case GeomAbs_Circle:
|
||||
|
@@ -92,7 +92,7 @@ public:
|
||||
//! shape <S>.
|
||||
Standard_EXPORT const TopTools_ListOfShape& Generated (const TopoDS_Shape& S);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsElementary (const Handle(Adaptor3d_Curve)& C) const;
|
||||
Standard_EXPORT Standard_Boolean IsElementary (const Adaptor3d_Curve& C) const;
|
||||
|
||||
//! build the result as a list of wire if possible in --
|
||||
//! a first returns a wire only if there is only a wire.
|
||||
|
@@ -34,6 +34,8 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Returns a shape built by the shape construction algorithm.
|
||||
//! Does not check if the shape is built.
|
||||
Standard_EXPORT virtual const TopoDS_Shape& Shape() Standard_OVERRIDE;
|
||||
|
||||
// Provide access to methods of protected base class BOPAlgo_Options
|
||||
|
@@ -79,7 +79,7 @@ public:
|
||||
|
||||
Standard_EXPORT BRepApprox_Approx();
|
||||
|
||||
Standard_EXPORT void Perform (const Handle(BRepAdaptor_Surface)& Surf1, const Handle(BRepAdaptor_Surface)& Surf2, const Handle(BRepApprox_ApproxLine)& aLine, const Standard_Boolean ApproxXYZ = Standard_True, const Standard_Boolean ApproxU1V1 = Standard_True, const Standard_Boolean ApproxU2V2 = Standard_True, const Standard_Integer indicemin = 0, const Standard_Integer indicemax = 0);
|
||||
Standard_EXPORT void Perform (const BRepAdaptor_Surface& Surf1, const BRepAdaptor_Surface& Surf2, const Handle(BRepApprox_ApproxLine)& aLine, const Standard_Boolean ApproxXYZ = Standard_True, const Standard_Boolean ApproxU1V1 = Standard_True, const Standard_Boolean ApproxU2V2 = Standard_True, const Standard_Integer indicemin = 0, const Standard_Integer indicemax = 0);
|
||||
|
||||
Standard_EXPORT void Perform (const Handle(BRepApprox_ApproxLine)& aLine, const Standard_Boolean ApproxXYZ = Standard_True, const Standard_Boolean ApproxU1V1 = Standard_True, const Standard_Boolean ApproxU2V2 = Standard_True, const Standard_Integer indicemin = 0, const Standard_Integer indicemax = 0);
|
||||
|
||||
@@ -120,7 +120,7 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
Standard_EXPORT void Perform (const IntSurf_Quadric& Surf1, const Handle(BRepAdaptor_Surface)& Surf2, const Handle(BRepApprox_ApproxLine)& aLine, const Standard_Boolean ApproxXYZ, const Standard_Boolean ApproxU1V1, const Standard_Boolean ApproxU2V2, const Standard_Integer indicemin, const Standard_Integer indicemax, const Standard_Boolean isTheQuadFirst);
|
||||
Standard_EXPORT void Perform (const IntSurf_Quadric& Surf1, const BRepAdaptor_Surface& Surf2, const Handle(BRepApprox_ApproxLine)& aLine, const Standard_Boolean ApproxXYZ, const Standard_Boolean ApproxU1V1, const Standard_Boolean ApproxU2V2, const Standard_Integer indicemin, const Standard_Integer indicemax, const Standard_Boolean isTheQuadFirst);
|
||||
|
||||
Standard_EXPORT void UpdateTolReached();
|
||||
|
||||
|
@@ -37,7 +37,7 @@
|
||||
#include <AppParCurves_MultiBSpCurve.hxx>
|
||||
|
||||
|
||||
#define ThePSurface Handle(BRepAdaptor_Surface)
|
||||
#define ThePSurface BRepAdaptor_Surface
|
||||
#define ThePSurface_hxx <BRepAdaptor_Surface.hxx>
|
||||
#define ThePSurfaceTool BRepApprox_SurfaceTool
|
||||
#define ThePSurfaceTool_hxx <BRepApprox_SurfaceTool.hxx>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user