mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Compare commits
10 Commits
CR32857_us
...
CR32887
Author | SHA1 | Date | |
---|---|---|---|
|
c0418c96db | ||
|
83cc25e05b | ||
|
8b536fff48 | ||
|
ac76263667 | ||
|
efc007f044 | ||
|
c45ac27846 | ||
|
4a1eddc2c9 | ||
|
f001c6f012 | ||
|
8271ac6728 | ||
|
293b9f436b |
@@ -10,22 +10,6 @@ set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FO
|
||||
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")
|
||||
@@ -733,14 +717,14 @@ if (NOT DEFINED ANDROID AND CAN_USE_TBB)
|
||||
add_definitions (-DHAVE_TBB)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB12")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_TBB")
|
||||
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB12")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
|
||||
endif()
|
||||
@@ -820,12 +804,6 @@ 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 TKExpress ExpToCasExe
|
||||
DataExchange TKXDE TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh TKXDECascade
|
||||
Draw TKDraw TKTopTest TKOpenGlTest TKOpenGlesTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
|
||||
|
@@ -480,6 +480,3 @@ n TreeModel
|
||||
n View
|
||||
n ViewControl
|
||||
n VInspector
|
||||
n Express
|
||||
t TKExpress
|
||||
x ExpToCasExe
|
||||
|
@@ -22,4 +22,6 @@ if (3RDPARTY_DIR)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
find_package (BISON 3.7.4)
|
||||
# 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)
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# See the cotire manual for usage hints.
|
||||
#
|
||||
#=============================================================================
|
||||
# Copyright 2012-2018 Sascha Kratky
|
||||
# Copyright 2012-2016 Sascha Kratky
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation
|
||||
@@ -32,18 +32,16 @@ if(__COTIRE_INCLUDED)
|
||||
endif()
|
||||
set(__COTIRE_INCLUDED TRUE)
|
||||
|
||||
# call cmake_minimum_required, but prevent modification of the CMake policy stack in include mode
|
||||
# cmake_minimum_required also sets the policy version as a side effect, which we have to avoid
|
||||
if (NOT CMAKE_SCRIPT_MODE_FILE)
|
||||
cmake_policy(PUSH)
|
||||
endif()
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
if (NOT CMAKE_SCRIPT_MODE_FILE)
|
||||
cmake_policy(POP)
|
||||
endif()
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
|
||||
set (COTIRE_CMAKE_MODULE_VERSION "1.8.1")
|
||||
set (COTIRE_CMAKE_MODULE_VERSION "1.7.9")
|
||||
|
||||
# activate select policies
|
||||
if (POLICY CMP0025)
|
||||
@@ -106,11 +104,6 @@ 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)
|
||||
|
||||
@@ -239,13 +232,7 @@ function (cotire_filter_language_source_files _language _target _sourceFilesVar
|
||||
# add to excluded sources, if file has custom compile flags
|
||||
list (APPEND _excludedSourceFiles "${_sourceFile}")
|
||||
else()
|
||||
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()
|
||||
list (APPEND _sourceFiles "${_sourceFile}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -304,7 +291,7 @@ function (cotire_get_source_file_property_values _valuesVar _property)
|
||||
set (${_valuesVar} ${_values} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function (cotire_resolve_config_properties _configurations _propertiesVar)
|
||||
function (cotire_resolve_config_properites _configurations _propertiesVar)
|
||||
set (_properties "")
|
||||
foreach (_property ${ARGN})
|
||||
if ("${_property}" MATCHES "<CONFIG>")
|
||||
@@ -320,8 +307,8 @@ function (cotire_resolve_config_properties _configurations _propertiesVar)
|
||||
set (${_propertiesVar} ${_properties} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function (cotire_copy_set_properties _configurations _type _source _target)
|
||||
cotire_resolve_config_properties("${_configurations}" _properties ${ARGN})
|
||||
function (cotire_copy_set_properites _configurations _type _source _target)
|
||||
cotire_resolve_config_properites("${_configurations}" _properties ${ARGN})
|
||||
foreach (_property ${_properties})
|
||||
get_property(_isSet ${_type} ${_source} PROPERTY ${_property} SET)
|
||||
if (_isSet)
|
||||
@@ -331,18 +318,13 @@ function (cotire_copy_set_properties _configurations _type _source _target)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function (cotire_get_target_usage_requirements _target _config _targetRequirementsVar)
|
||||
function (cotire_get_target_usage_requirements _target _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)
|
||||
@@ -457,7 +439,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} ${_config} _linkedTargets)
|
||||
cotire_get_target_usage_requirements(${_target} _linkedTargets)
|
||||
foreach (_linkedTarget ${_linkedTargets})
|
||||
get_target_property(_targetOptions ${_linkedTarget} INTERFACE_COMPILE_OPTIONS)
|
||||
if (_targetOptions)
|
||||
@@ -589,7 +571,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} ${_config} _linkedTargets)
|
||||
cotire_get_target_usage_requirements(${_target} _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
|
||||
@@ -643,7 +625,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 AND NOT MINGW)
|
||||
if (WIN32)
|
||||
# convert Windows paths in include directories to CMake paths
|
||||
if (_includeDirs)
|
||||
set (_paths "")
|
||||
@@ -719,7 +701,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} ${_config} _linkedTargets)
|
||||
cotire_get_target_usage_requirements(${_target} _linkedTargets)
|
||||
foreach (_linkedTarget ${_linkedTargets})
|
||||
get_target_property(_definitions ${_linkedTarget} INTERFACE_COMPILE_DEFINITIONS)
|
||||
if (_definitions)
|
||||
@@ -727,7 +709,7 @@ function (cotire_get_target_compile_definitions _config _language _target _defin
|
||||
endif()
|
||||
endforeach()
|
||||
# parse additional compile definitions from target compile flags
|
||||
# and do not look at directory compile definitions, which we already handled
|
||||
# and don't 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})
|
||||
@@ -875,9 +857,6 @@ 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")
|
||||
@@ -895,9 +874,6 @@ 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
|
||||
@@ -924,16 +900,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_SEP_${_language}}${_include}")
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_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}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${_include}")
|
||||
else()
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -1068,10 +1044,10 @@ macro (cotire_check_ignore_header_file_path _headerFile _headerIsIgnoredVar)
|
||||
set (${_headerIsIgnoredVar} TRUE)
|
||||
elseif (IS_DIRECTORY "${_headerFile}")
|
||||
set (${_headerIsIgnoredVar} TRUE)
|
||||
elseif ("${_headerFile}" MATCHES "\\.\\.|[_-]fixed")
|
||||
# heuristic: ignore headers with embedded parent directory references or "-fixed" or "_fixed" in path
|
||||
elseif ("${_headerFile}" MATCHES "\\.\\.|[_-]fixed" AND "${_headerFile}" MATCHES "\\.h$")
|
||||
# heuristic: ignore C 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"
|
||||
# with the error message "error: no include path in which to search for header.h"
|
||||
set (${_headerIsIgnoredVar} TRUE)
|
||||
else()
|
||||
set (${_headerIsIgnoredVar} FALSE)
|
||||
@@ -1092,11 +1068,12 @@ endmacro()
|
||||
|
||||
macro (cotire_parse_line _line _headerFileVar _headerDepthVar)
|
||||
if (MSVC)
|
||||
# cl.exe /showIncludes produces different output, depending on the language pack used, e.g.:
|
||||
# cl.exe /showIncludes output looks different 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()
|
||||
@@ -1254,19 +1231,11 @@ function (cotire_scan_includes _includesVar)
|
||||
set (${_includesVar} "" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
# 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()
|
||||
list (APPEND _cmd ${_existingSourceFiles})
|
||||
if (COTIRE_VERBOSE)
|
||||
message (STATUS "execute_process: ${_cmd}")
|
||||
endif()
|
||||
if (MSVC_IDE OR _option_COMPILER_ID MATCHES "MSVC")
|
||||
if (_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()
|
||||
@@ -1502,16 +1471,11 @@ function (cotire_generate_prefix_header _prefixFile)
|
||||
if (_unparsedLines)
|
||||
if (COTIRE_VERBOSE OR _scanResult OR NOT _selectedHeaders)
|
||||
list (LENGTH _unparsedLines _skippedLineCount)
|
||||
if (WIN32)
|
||||
file (TO_NATIVE_PATH "${_unparsedLinesFile}" _unparsedLinesLogPath)
|
||||
else()
|
||||
set (_unparsedLinesLogPath "${_unparsedLinesFile}")
|
||||
endif()
|
||||
message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesLogPath}")
|
||||
message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesFile}")
|
||||
endif()
|
||||
string (REPLACE ";" "\n" _unparsedLines "${_unparsedLines}")
|
||||
endif()
|
||||
file (WRITE "${_unparsedLinesFile}" "${_unparsedLines}\n")
|
||||
file (WRITE "${_unparsedLinesFile}" "${_unparsedLines}")
|
||||
endfunction()
|
||||
|
||||
function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flagsVar)
|
||||
@@ -1541,7 +1505,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
|
||||
@@ -1551,36 +1515,16 @@ function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flags
|
||||
endif()
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Clang")
|
||||
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()
|
||||
# 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")
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Intel")
|
||||
if (WIN32)
|
||||
@@ -1654,8 +1598,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")
|
||||
# GCC options used
|
||||
elseif (_compilerID MATCHES "GNU|Clang")
|
||||
# GCC / Clang options used
|
||||
# -x specify the source language
|
||||
# -c compile but do not link
|
||||
# -o place output in file
|
||||
@@ -1665,55 +1609,11 @@ 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)
|
||||
@@ -1755,28 +1655,20 @@ 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")
|
||||
if (NOT _pchSuppressMessages)
|
||||
list (APPEND _flags -Wpch-messages)
|
||||
endif()
|
||||
list (APPEND _flags "-Wpch-messages")
|
||||
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")
|
||||
if (NOT _pchSuppressMessages)
|
||||
set (_flags "${_flags} -Wpch-messages")
|
||||
endif()
|
||||
set (_flags "${_flags} -Wpch-messages")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -1827,48 +1719,23 @@ 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")
|
||||
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()
|
||||
# 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}\"")
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Intel")
|
||||
if (WIN32)
|
||||
@@ -1912,32 +1779,24 @@ 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")
|
||||
if (NOT _pchSuppressMessages)
|
||||
list (APPEND _flags -Wpch-messages)
|
||||
endif()
|
||||
list (APPEND _flags "-Wpch-messages")
|
||||
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")
|
||||
if (NOT _pchSuppressMessages)
|
||||
set (_flags "${_flags} -Wpch-messages")
|
||||
endif()
|
||||
set (_flags "${_flags} -Wpch-messages")
|
||||
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}\"")
|
||||
@@ -1975,17 +1834,9 @@ function (cotire_precompile_prefix_header _prefixFile _pchFile _hostFile)
|
||||
if (COTIRE_VERBOSE)
|
||||
message (STATUS "execute_process: ${_cmd}")
|
||||
endif()
|
||||
if (MSVC_IDE OR _option_COMPILER_ID MATCHES "MSVC")
|
||||
if (_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}
|
||||
@@ -2000,7 +1851,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")
|
||||
# PCH supported since Visual Studio C++ 6.0
|
||||
# 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")
|
||||
@@ -2011,16 +1862,8 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
|
||||
set (${_msgVar} "" PARENT_SCOPE)
|
||||
endif()
|
||||
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Clang")
|
||||
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()
|
||||
# all Clang versions have PCH support
|
||||
set (${_msgVar} "" PARENT_SCOPE)
|
||||
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")
|
||||
@@ -2031,38 +1874,29 @@ 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)
|
||||
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 (CMAKE_${_language}_COMPILER MATCHES "ccache" OR _launcher MATCHES "ccache")
|
||||
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 (_realCompilerExe MATCHES "ccache")
|
||||
set (_ccacheExe "${_realCompilerExe}")
|
||||
if (_launcher MATCHES "ccache")
|
||||
get_filename_component(_ccacheExe "${_launcher}" REALPATH)
|
||||
else()
|
||||
set (_ccacheExe "${_launcher}")
|
||||
get_filename_component(_ccacheExe "${CMAKE_${_language}_COMPILER}" REALPATH)
|
||||
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}" "-p"
|
||||
COMMAND "${_ccacheExe}" "--print-config"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
RESULT_VARIABLE _result
|
||||
OUTPUT_VARIABLE _ccacheConfig OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET)
|
||||
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")
|
||||
if (_result OR 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)
|
||||
@@ -2355,7 +2189,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_SEP_${_language}
|
||||
CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_${_language}_SEP
|
||||
CMAKE_INCLUDE_SYSTEM_FLAG_${_language}
|
||||
CMAKE_${_language}_FRAMEWORK_SEARCH_FLAG
|
||||
CMAKE_${_language}_SYSTEM_FRAMEWORK_SEARCH_FLAG
|
||||
@@ -2388,9 +2222,8 @@ endfunction()
|
||||
|
||||
function (cotire_setup_pch_file_compilation _language _target _targetScript _prefixFile _pchFile _hostFile)
|
||||
set (_sourceFiles ${ARGN})
|
||||
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
|
||||
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
# for Visual Studio and Intel, 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 "")
|
||||
@@ -2398,9 +2231,6 @@ 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}")
|
||||
@@ -2438,9 +2268,8 @@ 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" 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
|
||||
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
# for Visual Studio and Intel, 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)
|
||||
@@ -2452,9 +2281,6 @@ 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()
|
||||
@@ -2468,9 +2294,6 @@ 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()
|
||||
@@ -2488,9 +2311,6 @@ 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
|
||||
@@ -2580,7 +2400,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 explicity in cotire script mode when the pre-build action is run
|
||||
# we check dependencies explicitly in cotire script mode when the pre-build action is run
|
||||
add_custom_command(
|
||||
TARGET "${_target}"
|
||||
PRE_BUILD ${_cmds}
|
||||
@@ -2595,10 +2415,9 @@ 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 MSVC, Intel and clang-cl, precompiled header inclusion is always done on the source file level
|
||||
# for Visual Studio and Intel, 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" AND NOT
|
||||
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
|
||||
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER)
|
||||
if (_prefixFile)
|
||||
get_property(_pchFile TARGET ${_target} PROPERTY COTIRE_${_language}_PRECOMPILED_HEADER)
|
||||
@@ -2607,9 +2426,6 @@ 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()
|
||||
@@ -2636,8 +2452,7 @@ 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 cl.exe and Windows Intel
|
||||
# unity file compilation results in potentially huge object file, thus use /bigobj by default unter MSVC and Windows Intel
|
||||
set_property (SOURCE "${_unityFile}" APPEND_STRING PROPERTY COMPILE_FLAGS "/bigobj")
|
||||
endif()
|
||||
cotire_set_cmd_to_prologue(_unityCmd)
|
||||
@@ -2843,9 +2658,6 @@ 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}.")
|
||||
@@ -2935,20 +2747,6 @@ 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})
|
||||
@@ -2976,11 +2774,7 @@ 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]*)")
|
||||
if (DEFINED CMAKE_MATCH_2)
|
||||
set (_numberOfThreads "${CMAKE_MATCH_2}")
|
||||
else()
|
||||
set (_numberOfThreads "")
|
||||
endif()
|
||||
set (_numberOfThreads "${CMAKE_MATCH_2}")
|
||||
if (NOT _numberOfThreads)
|
||||
# use all available cores
|
||||
ProcessorCount(_numberOfThreads)
|
||||
@@ -3093,9 +2887,8 @@ 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" AND NOT
|
||||
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
|
||||
# MSVC, Intel and clang-cl only create precompiled header as a side effect
|
||||
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
# Visual Studio and Intel 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})
|
||||
@@ -3143,7 +2936,6 @@ 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})
|
||||
@@ -3188,6 +2980,21 @@ 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)
|
||||
@@ -3201,6 +3008,21 @@ 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>
|
||||
@@ -3212,8 +3034,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_properties("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties})
|
||||
cotire_resolve_config_properties("${_configurations}" _properties ${_outputDirProperties})
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties})
|
||||
cotire_resolve_config_properites("${_configurations}" _properties ${_outputDirProperties})
|
||||
foreach (_property ${_properties})
|
||||
get_property(_outputDir TARGET ${_target} PROPERTY ${_property})
|
||||
if (_outputDir)
|
||||
@@ -3233,11 +3055,11 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
RUNTIME_OUTPUT_DIRECTORY "${_outputDir}")
|
||||
endif()
|
||||
else()
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
${_outputDirProperties})
|
||||
endif()
|
||||
# copy output name
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
ARCHIVE_OUTPUT_NAME ARCHIVE_OUTPUT_NAME_<CONFIG>
|
||||
LIBRARY_OUTPUT_NAME LIBRARY_OUTPUT_NAME_<CONFIG>
|
||||
OUTPUT_NAME OUTPUT_NAME_<CONFIG>
|
||||
@@ -3245,7 +3067,7 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
PREFIX <CONFIG>_POSTFIX SUFFIX
|
||||
IMPORT_PREFIX IMPORT_SUFFIX)
|
||||
# copy compile stuff
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
COMPILE_DEFINITIONS COMPILE_DEFINITIONS_<CONFIG>
|
||||
COMPILE_FLAGS COMPILE_OPTIONS
|
||||
Fortran_FORMAT Fortran_MODULE_DIRECTORY
|
||||
@@ -3257,12 +3079,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_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_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_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_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
|
||||
@@ -3270,9 +3092,8 @@ 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_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
BUILD_WITH_INSTALL_RPATH BUILD_WITH_INSTALL_NAME_DIR
|
||||
INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
BUILD_WITH_INSTALL_RPATH 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>
|
||||
@@ -3280,18 +3101,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 BUILD_RPATH)
|
||||
LINK_WHAT_YOU_USE)
|
||||
# copy cmake stuff
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_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_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_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 XCODE_EXPLICIT_FILE_TYPE XCODE_PRODUCT_TYPE)
|
||||
IOS_INSTALL_COMBINED)
|
||||
# copy Windows platform specific stuff
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
GNUtoMS
|
||||
COMPILE_PDB_NAME COMPILE_PDB_NAME_<CONFIG>
|
||||
COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>
|
||||
@@ -3305,19 +3126,15 @@ 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_USER_PROPS VS_DEBUGGER_WORKING_DIRECTORY)
|
||||
VS_SDK_REFERENCES)
|
||||
# copy Android platform specific stuff
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_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)
|
||||
@@ -3331,13 +3148,6 @@ 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}")
|
||||
@@ -3496,13 +3306,6 @@ 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)
|
||||
@@ -3535,9 +3338,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)
|
||||
@@ -3799,7 +3602,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 "2" CACHE STRING
|
||||
set (COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES "3" 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)
|
||||
@@ -3898,7 +3701,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 2."
|
||||
"If not defined, defaults to 3."
|
||||
)
|
||||
|
||||
define_property(
|
||||
|
@@ -3,6 +3,10 @@
|
||||
|
||||
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()
|
||||
@@ -11,24 +15,14 @@ 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)
|
||||
set (3RDPARTY_DRACO_LIBRARY "" CACHE FILEPATH "Draco library")
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY OR NOT 3RDPARTY_DRACO_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
|
||||
set (3RDPARTY_DRACO_LIBRARY "" CACHE FILEPATH "Draco library" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DIR)
|
||||
set (3RDPARTY_DRACO_LIBRARY_DIR "" CACHE PATH "The directory containing Draco library")
|
||||
endif()
|
||||
|
||||
if (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)
|
||||
@@ -38,19 +32,20 @@ if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# header
|
||||
if (NOT 3RDPARTY_DRACO_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_DRACO_INCLUDE_DIR}")
|
||||
set (HEADER_NAMES draco)
|
||||
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()
|
||||
|
||||
# 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_INCLUDE_DIR)
|
||||
if (DRACO_INCLUDE_PATH AND EXISTS "${DRACO_INCLUDE_PATH}")
|
||||
set (3RDPARTY_DRACO_INCLUDE_DIR "${DRACO_INCLUDE_PATH}" CACHE FILEPATH "The directory containing headers of DRACO" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (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)
|
||||
if (NOT 3RDPARTY_DRACO_LIBRARY_DIR)
|
||||
if (DRACO_LIBRARY_PATH AND EXISTS "${DRACO_LIBRARY_PATH}")
|
||||
set (3RDPARTY_DRACO_LIBRARY_DIR "${DRACO_LIBRARY_PATH}" CACHE FILEPATH "The directory containing DRACO library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -62,11 +57,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 .a)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
|
||||
set (3RDPARTY_DRACO_LIBRARY "3RDPARTY_DRACO_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to Draco library" FORCE)
|
||||
|
||||
find_library (3RDPARTY_DRACO_LIBRARY NAMES ${CSF_Draco}
|
||||
PATHS "${3RDPARTY_DRACO_DIR}"
|
||||
PATHS "${3RDPARTY_DRACO_LIBRARY_DIR}"
|
||||
PATH_SUFFIXES lib
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
@@ -75,19 +70,27 @@ 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 (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 (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()
|
||||
|
||||
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()
|
||||
if (INSTALL_DRACO)
|
||||
get_filename_component(3RDPARTY_DRACO_LIBRARY_REALPATH ${3RDPARTY_DRACO_LIBRARY} REALPATH)
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR_LIB}")
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR_LIB}i")
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR_LIB}d")
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -26,7 +26,9 @@ if (3RDPARTY_DIR)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
find_package (FLEX 2.6.4)
|
||||
# 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)
|
||||
|
||||
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,19 +110,8 @@ 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})
|
||||
@@ -133,7 +122,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_RELEASE FILEPATH "freetype library")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -152,8 +141,8 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
if (FREETYPE_LIBRARY_RELEASE AND EXISTS "${FREETYPE_LIBRARY_RELEASE}")
|
||||
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY_RELEASE}" CACHE FILEPATH "The path to freetype library" FORCE)
|
||||
if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}")
|
||||
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY}" CACHE FILEPATH "The path to freetype library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -231,7 +220,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)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
|
||||
|
||||
set (FREETYPE_PATH_SUFFIXES lib)
|
||||
if (ANDROID)
|
||||
@@ -253,16 +242,6 @@ 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)
|
||||
@@ -371,7 +350,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_RELEASE)
|
||||
OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)
|
||||
|
@@ -12,7 +12,7 @@ endif()
|
||||
|
||||
# TBB
|
||||
if (USE_TBB)
|
||||
set (CSF_TBB "tbb tbbmalloc")
|
||||
set (CSF_TBB "tbb12 tbbmalloc")
|
||||
else()
|
||||
set (CSF_TBB)
|
||||
endif()
|
||||
|
@@ -130,6 +130,22 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPIL
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# 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)
|
||||
|
||||
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.
|
||||
|
@@ -160,8 +160,6 @@ 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}")
|
||||
|
@@ -106,12 +106,6 @@ 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})
|
||||
@@ -127,19 +121,6 @@ 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}"
|
||||
@@ -245,18 +226,6 @@ 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}")
|
||||
|
||||
@@ -266,18 +235,6 @@ 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")
|
||||
@@ -370,10 +327,6 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
|
||||
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})
|
||||
@@ -401,7 +354,7 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
if (NOT ${LIBRARY_FROM_CACHE} AND NOT "${CURRENT_CSF}" STREQUAL "")
|
||||
if (NOT ${LIBRARY_FROM_CACHE})
|
||||
# prepare a list from a string with whitespaces
|
||||
separate_arguments (CURRENT_CSF)
|
||||
list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${CURRENT_CSF})
|
||||
@@ -412,28 +365,6 @@ 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,240 +1,294 @@
|
||||
# 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()
|
||||
|
||||
if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
|
||||
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
|
||||
endif()
|
||||
# include occt macros. compiler_bitness, os_wiht_bit, compiler
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
# Initialize tbb directory.
|
||||
if (NOT DEFINED 3RDPARTY_TBB_DIR)
|
||||
set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
|
||||
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")
|
||||
|
||||
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}"))
|
||||
if (NOT 3RDPARTY_TBB_DIR 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()
|
||||
|
||||
# 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 (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
|
||||
endif()
|
||||
|
||||
# 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")
|
||||
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 tbb12 and tbbmalloc
|
||||
macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
|
||||
|
||||
string (TOUPPER ${PRODUCT_LIBRARY_NAME} upper_PRODUCT_LIBRARY_NAME)
|
||||
|
||||
# define required tbb12/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)
|
||||
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}")
|
||||
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)
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library")
|
||||
endif()
|
||||
|
||||
separate_arguments (CSF_TBB)
|
||||
foreach (LIB IN LISTS CSF_TBB)
|
||||
string(TOLOWER "${LIB}" LIB_LOWER)
|
||||
string(TOUPPER "${LIB}" LIB_UPPER)
|
||||
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")
|
||||
|
||||
# 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()
|
||||
# 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}")
|
||||
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()
|
||||
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
|
||||
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)")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library")
|
||||
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}")
|
||||
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()
|
||||
|
||||
# tbb12/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()
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${LIB_UPPER}_DLL_DIR)
|
||||
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME} lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER})
|
||||
endif()
|
||||
|
||||
# install *.dll (tbb & tbbmalloc)
|
||||
if (INSTALL_TBB)
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
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()
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
|
||||
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()
|
||||
|
||||
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()
|
||||
|
||||
# tbb12/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()
|
||||
else()
|
||||
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")
|
||||
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)
|
||||
endif()
|
||||
endif()
|
||||
mark_as_advanced (3RDPARTY_${LIB_UPPER}_LIBRARY 3RDPARTY_${LIB_UPPER}_DLL)
|
||||
endforeach()
|
||||
if (INSTALL_TBB)
|
||||
set (USED_3RDPARTY_TBB_DIR "")
|
||||
else()
|
||||
# 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.")
|
||||
|
||||
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}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR)
|
||||
endif()
|
||||
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)
|
||||
|
||||
# install tbb12/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()
|
||||
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()
|
||||
|
||||
separate_arguments (CSF_TBB)
|
||||
foreach (LIB IN LISTS CSF_TBB)
|
||||
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()
|
||||
get_filename_component (PRODUCT_LIBRARY_NAME ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY} NAME)
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} DESTINATION "${INSTALL_DIR_LIB}")
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
|
||||
DESTINATION "${INSTALL_DIR_LIB}"
|
||||
RENAME ${PRODUCT_LIBRARY_NAME}.2)
|
||||
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")
|
||||
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()
|
||||
|
||||
if (INSTALL_TBB)
|
||||
set (USED_3RDPARTY_TBB_DIR "")
|
||||
else()
|
||||
# the *.so* directory for using by the executable
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB12_DLL_DIR})
|
||||
else()
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB12_LIBRARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
#endif()
|
||||
|
@@ -775,7 +775,7 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
|
||||
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir/$aVcLib"
|
||||
}
|
||||
if { "$aTbbLibPath" == "" } {
|
||||
lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
|
||||
lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb12.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
|
||||
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
|
||||
}
|
||||
}
|
||||
|
179
adm/genproj.tcl
179
adm/genproj.tcl
@@ -1233,11 +1233,28 @@ proc osutils:convertModules { theModules theSrcDir theSourceDirOther theProjects
|
||||
lappend aProjectsInModule($aModule) $aToolKit
|
||||
lappend aDependencies [LibToLink $aToolKit $theSrcDir $theSourceDirOther]
|
||||
}
|
||||
# executables
|
||||
# executables, assume one project per cxx file...
|
||||
foreach aUnit [OS:executable ${aModule}] {
|
||||
lappend aProjects $aUnit
|
||||
lappend aProjectsInModule($aModule) $aUnit
|
||||
lappend aDependencies [LibToLink $aUnit $theSrcDir $theSourceDirOther]
|
||||
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 {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1420,7 +1437,7 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
|
||||
set aLibsMap(CSF_FFmpeg) "avcodec avformat swscale avutil"
|
||||
}
|
||||
if { "$::HAVE_TBB" == "true" } {
|
||||
set aLibsMap(CSF_TBB) "tbb tbbmalloc"
|
||||
set aLibsMap(CSF_TBB) "tbb12 tbbmalloc"
|
||||
}
|
||||
if { "$::HAVE_VTK" == "true" } {
|
||||
if { "$theOS" == "wnt" } {
|
||||
@@ -2093,106 +2110,98 @@ 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 {}
|
||||
set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
|
||||
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
|
||||
set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
|
||||
|
||||
set aProjName $theToolKit
|
||||
set l_compilable [osutils:compilable wnt]
|
||||
regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl
|
||||
set aProjName [file rootname [file tail $f]]
|
||||
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 { "$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
|
||||
if { ![info exists written([file tail $f])] } {
|
||||
set written([file tail $f]) 1
|
||||
|
||||
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
|
||||
append aFilesSection [osutils:vcxproj:cxxfile $f "" 3]
|
||||
if { ! [info exists aVcFilesCxx($theToolKit)] } { lappend aVcFilesCxx(units) $theToolKit }
|
||||
lappend aVcFilesCxx($theToolKit) $f
|
||||
} else {
|
||||
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
|
||||
}
|
||||
}
|
||||
} 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 "\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 ""]
|
||||
} else {
|
||||
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
|
||||
append aFilesSection "\t\t\t</Filter>"
|
||||
}
|
||||
} else {
|
||||
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
|
||||
}
|
||||
append aFilesSection "\t\t\t</Filter>"
|
||||
}
|
||||
#puts "$aProjTmpl $aFilesSection"
|
||||
set anIncPaths "..\\..\\..\\inc"
|
||||
regsub -all -- {__TKINC__} $aProjTmpl $anIncPaths aProjTmpl
|
||||
regsub -all -- {__FILES__} $aProjTmpl $aFilesSection aProjTmpl
|
||||
regsub -all -- {__CONF__} $aProjTmpl Application 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
|
||||
regsub -all -- {__XQTEXT__} $aProjTmpl "exe" aProjTmpl
|
||||
|
||||
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]
|
||||
set aFile [open [set aVcFilePath [file join $theOutDir ${aProjName}.[osutils:vcproj:ext $theVcVer]]] w]
|
||||
fconfigure $aFile -translation crlf
|
||||
puts $aFile $aCommonSettingsFileTmpl
|
||||
puts $aFile $aProjTmpl
|
||||
close $aFile
|
||||
|
||||
lappend aVcFiles "$aCommonSettingsFile"
|
||||
}
|
||||
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"
|
||||
}
|
||||
}
|
||||
return $aVcFiles
|
||||
}
|
||||
|
||||
|
@@ -23,7 +23,7 @@ CSF_TclLibs = -ltcl8.6
|
||||
CSF_TclTkLibs = -ltk8.6
|
||||
HAVE_FREEIMAGE { CSF_FreeImagePlus = -lfreeimage } else:win32 { CSF_FreeImagePlus = -lwindowscodecs -lole32 }
|
||||
HAVE_FFMPEG { CSF_FFmpeg = -lavcodec -lavformat -lswscale -lavutil }
|
||||
HAVE_TBB { CSF_TBB = -ltbb -ltbbmalloc }
|
||||
HAVE_TBB { CSF_TBB = -ltbb12 -ltbbmalloc }
|
||||
HAVE_ZLIB { CSF_ZLIB = -lzlib }
|
||||
HAVE_LIBLZMA { CSF_LIBLZMA = -lliblzma }
|
||||
HAVE_DRACO { CSF_Draco = -ldraco }
|
||||
|
@@ -11,7 +11,7 @@ if /I "%VCVER%" == "@COMPILER@" (
|
||||
set "FREEIMAGE_DIR=@3RDPARTY_FREEIMAGE_DLL_DIRS@"
|
||||
set "EGL_DIR=@3RDPARTY_EGL_DLL_DIRS@"
|
||||
set "GLES2_DIR=@3RDPARTY_GLES2_DLL_DIRS@"
|
||||
set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@"
|
||||
set "TBB_DIR=@3RDPARTY_TBB12_DLL_DIR@"
|
||||
set "VTK_DIR=@3RDPARTY_VTK_DLL_DIR@"
|
||||
set "FFMPEG_DIR=@3RDPARTY_FFMPEG_DLL_DIR@"
|
||||
set "OPENVR_DIR=@3RDPARTY_OPENVR_DLL_DIRS@"
|
||||
|
@@ -9,7 +9,7 @@ if [ "$1" == "@BIN_LETTER@" ]; then
|
||||
export TK_DIR="@3RDPARTY_TK_LIBRARY_DIR@"
|
||||
export FREETYPE_DIR="@3RDPARTY_FREETYPE_LIBRARY_DIR@"
|
||||
export FREEIMAGE_DIR="@3RDPARTY_FREEIMAGE_LIBRARY_DIRS@"
|
||||
export TBB_DIR="@3RDPARTY_TBB_LIBRARY_DIR@"
|
||||
export TBB_DIR="@3RDPARTY_TBB12_LIBRARY_DIR@"
|
||||
export VTK_DIR="@3RDPARTY_VTK_LIBRARY_DIR@"
|
||||
export FFMPEG_DIR="@3RDPARTY_FFMPEG_LIBRARY_DIR@"
|
||||
|
||||
|
@@ -341,7 +341,7 @@ The tables below describe the recommended software configurations for which OCCT
|
||||
|
||||
| OS | Compiler |
|
||||
| --------- | ----------- |
|
||||
| Windows | Microsoft Visual Studio: 2015 Update 3, 2017 <sup>1</sup>, 2019, 2022 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
|
||||
| Windows | Microsoft Visual Studio: 2013 Update 5, 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 |
|
||||
@@ -572,7 +572,8 @@ 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.
|
||||
Intel oneTBB 2021.5.0 is available under Apache 2.0 license (https://www.threadingbuildingblocks.org).
|
||||
oneTBB 2021.5.0 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).
|
||||
|
||||
**OpenGL** is an industry standard API for 3D graphics used by OCCT for
|
||||
implementation of 3D viewer. OpenGL specification is developed by the
|
||||
|
@@ -2338,8 +2338,3 @@ 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.
|
||||
|
@@ -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 12kB) and the allocator keeps track of the amount of occupied memory.
|
||||
Unlike *NCollection_BaseAllocator*, the memory is allocated in big blocks (about 20kB) 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,8 +326,7 @@ 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 an arbitrary 2D curve into a series of adjacent 2D circular arcs and 2D linear segments.
|
||||
* an algorithm which converts a 2D BSpline curve into a series of adjacent Bezier curves.
|
||||
|
||||
The <i>GeomConvert</i> package also provides the following:
|
||||
|
||||
|
@@ -91,6 +91,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
|
||||
@@ -121,6 +122,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
|
||||
@@ -145,6 +147,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
|
||||
@@ -172,6 +175,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
|
||||
|
@@ -92,6 +92,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>
|
||||
@@ -123,6 +124,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>
|
||||
@@ -147,6 +149,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>
|
||||
@@ -174,6 +177,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>
|
||||
|
@@ -51,7 +51,7 @@ unix {
|
||||
DEFINES += OCC_CONVERT_SIGNALS QT_NO_STL
|
||||
!macx | equals(MACOSX_USE_GLX, true): LIBS += -L$$QMAKE_LIBDIR_X11 $$QMAKE_LIBS_X11 -L$$QMAKE_LIBDIR_OPENGL $$QMAKE_LIBS_OPENGL $$QMAKE_LIBS_THREAD
|
||||
LIBS += -lfreeimageplus
|
||||
LIBS += -ltbb -ltbbmalloc
|
||||
LIBS += -ltbb12 -ltbbmalloc
|
||||
QMAKE_CXXFLAGS += -std=gnu++11
|
||||
}
|
||||
|
||||
|
@@ -221,7 +221,7 @@ Handle(TopTools_HSequenceOfShape) Translate::importModel( const int format, cons
|
||||
shapes = importSTEP( file );
|
||||
break;
|
||||
}
|
||||
} catch ( const Standard_Failure& ) {
|
||||
} catch ( 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 ( const Standard_Failure& ) {
|
||||
} catch ( 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;
|
||||
}
|
||||
|
@@ -251,9 +251,7 @@ 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())
|
||||
|
@@ -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,14 +1001,6 @@ 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);
|
||||
@@ -1018,7 +1010,10 @@ void AIS_InteractiveContext::RecomputeSelectionOnly (const Handle(AIS_Interactiv
|
||||
return;
|
||||
}
|
||||
|
||||
for (TColStd_ListIteratorOfListOfInteger aModesIter (aModes); aModesIter.More(); aModesIter.Next())
|
||||
TColStd_ListOfInteger aModes;
|
||||
ActivatedModes (theIO, aModes);
|
||||
TColStd_ListIteratorOfListOfInteger aModesIter (aModes);
|
||||
for (; aModesIter.More(); aModesIter.Next())
|
||||
{
|
||||
mgrSelector->Activate (theIO, aModesIter.Value());
|
||||
}
|
||||
|
@@ -15,13 +15,8 @@
|
||||
// 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>
|
||||
@@ -30,13 +25,10 @@
|
||||
#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>
|
||||
@@ -48,7 +40,6 @@
|
||||
#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>
|
||||
@@ -56,166 +47,6 @@
|
||||
#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,7 +21,6 @@
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
class TopoDS_Wire;
|
||||
class TopoDS_Edge;
|
||||
class TopoDS_Face;
|
||||
class TopoDS_Shape;
|
||||
|
||||
|
||||
@@ -44,28 +43,6 @@ 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,14 +42,12 @@
|
||||
#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_True;
|
||||
Standard_Boolean AffichLoop = Standard_False;
|
||||
Standard_Integer NbLoops = 0;
|
||||
Standard_Integer NbWires = 1;
|
||||
static char* name = new char[100];
|
||||
@@ -60,8 +58,7 @@ static char* name = new char[100];
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepAlgo_Loop::BRepAlgo_Loop():
|
||||
myTolConf (0.001)
|
||||
BRepAlgo_Loop::BRepAlgo_Loop()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -188,6 +185,7 @@ 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 );
|
||||
///////////////////////////////////////////////
|
||||
|
||||
@@ -429,12 +427,13 @@ static void StoreInMVE (const TopoDS_Face& F,
|
||||
TopoDS_Edge& E,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& MVE,
|
||||
Standard_Boolean& YaCouture,
|
||||
TopTools_DataMapOfShapeShape& VerticesForSubstitute,
|
||||
const Standard_Real theTolConf)
|
||||
TopTools_DataMapOfShapeShape& VerticesForSubstitute )
|
||||
{
|
||||
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++)
|
||||
@@ -450,7 +449,7 @@ static void StoreInMVE (const TopoDS_Face& F,
|
||||
{
|
||||
V1 = TopoDS::Vertex( itl.Value() );
|
||||
P1 = BRep_Tool::Pnt( V1 );
|
||||
if (P.IsEqual( P1, theTolConf ) && !V.IsSame(V1))
|
||||
if (P.IsEqual( P1, Tol ) && !V.IsSame(V1))
|
||||
{
|
||||
V.Orientation( V1.Orientation() );
|
||||
if (VerticesForSubstitute.IsBound( V1 ))
|
||||
@@ -575,7 +574,7 @@ void BRepAlgo_Loop::Perform()
|
||||
TopoDS_Edge& E = TopoDS::Edge(itl1.Value());
|
||||
if (!Emap.Add(E))
|
||||
continue;
|
||||
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute, myTolConf);
|
||||
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -587,7 +586,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, myTolConf);
|
||||
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute);
|
||||
}
|
||||
|
||||
#ifdef DRAW
|
||||
@@ -627,42 +626,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())
|
||||
@@ -673,41 +672,35 @@ 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))
|
||||
if (VF.IsSame(CV) && SamePnt2d(VF,EF,CE,myFace))
|
||||
{
|
||||
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
|
||||
}
|
||||
NW.Closed (Standard_True);
|
||||
myNewWires.Append (NW);
|
||||
}
|
||||
#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++);
|
||||
@@ -784,6 +777,8 @@ 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);
|
||||
@@ -818,9 +813,13 @@ 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);
|
||||
@@ -831,6 +830,8 @@ 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,17 +86,8 @@ 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:
|
||||
|
||||
@@ -117,7 +108,6 @@ private:
|
||||
TopTools_DataMapOfShapeListOfShape myCutEdges;
|
||||
TopTools_DataMapOfShapeShape myVerticesForSubstitute;
|
||||
BRepAlgo_Image myImageVV;
|
||||
Standard_Real myTolConf;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -197,12 +197,10 @@ Standard_Boolean CheckOn(IntRes2d_IntersectionPoint& thePntInter,
|
||||
if (aMinDist <= theTolZ) {
|
||||
IntRes2d_Transition aTrOnLin(IntRes2d_Head);
|
||||
IntRes2d_Position aPosOnCurve = IntRes2d_Middle;
|
||||
if ((Abs(aPar - theDeb) <= Precision::Confusion())
|
||||
|| (aPar < theDeb)) {
|
||||
if (Abs(aPar - theDeb) <= Precision::Confusion()) {
|
||||
aPosOnCurve = IntRes2d_Head;
|
||||
}
|
||||
else if ((Abs(aPar - theFin) <= Precision::Confusion())
|
||||
|| (aPar > theFin)) {
|
||||
else if (Abs(aPar - theFin) <= Precision::Confusion()) {
|
||||
aPosOnCurve = IntRes2d_End;
|
||||
}
|
||||
//
|
||||
@@ -383,16 +381,8 @@ void BRepClass_Intersector::Perform(const gp_Lin2d& L,
|
||||
{
|
||||
Standard_Boolean aStatusOn = Standard_False;
|
||||
IntRes2d_IntersectionPoint aPntInter;
|
||||
Standard_Real aDebTol = deb;
|
||||
Standard_Real aFinTol = fin;
|
||||
if (aTolZ > Precision::Confusion())
|
||||
{
|
||||
aDebTol = deb - aTolZ;
|
||||
aFinTol = fin + aTolZ;
|
||||
}
|
||||
Geom2dAdaptor_Curve aCurAdaptor(aC2D, aDebTol, aFinTol);
|
||||
|
||||
aStatusOn = CheckOn(aPntInter, F, L, aCurAdaptor, aTolZ, fin, deb);
|
||||
aStatusOn = CheckOn(aPntInter, F, L, C, aTolZ, fin, deb);
|
||||
if (aStatusOn)
|
||||
{
|
||||
Append(aPntInter);
|
||||
|
@@ -1,517 +0,0 @@
|
||||
// Created on: 2022-08-08
|
||||
// Created by: Kseniya NOSULKO
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BRepExtrema_ProximityDistTool.hxx>
|
||||
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Poly_Connect.hxx>
|
||||
#include <Standard_NullValue.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepExtrema_ProximityDistTool
|
||||
//purpose : Creates new unitialized tool
|
||||
//=======================================================================
|
||||
BRepExtrema_ProximityDistTool::BRepExtrema_ProximityDistTool()
|
||||
: myMinDistance (std::numeric_limits<Standard_Real>::max()),
|
||||
myProxDist (-1.),
|
||||
myPntStatus1 (ProxPnt_Status_UNKNOWN),
|
||||
myPntStatus2 (ProxPnt_Status_UNKNOWN),
|
||||
myNbSamples1 (0),
|
||||
myProxVtxIdx1 (-1)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepExtrema_ProximityDistTool
|
||||
//purpose : Creates new tool for the given element sets
|
||||
//=======================================================================
|
||||
BRepExtrema_ProximityDistTool::BRepExtrema_ProximityDistTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Standard_Integer theNbSamples1,
|
||||
const BVH_Array3d& theAddVertices1,
|
||||
const NCollection_Vector<ProxPnt_Status>& theAddStatus1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2,
|
||||
const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2)
|
||||
: myMinDistance (std::numeric_limits<Standard_Real>::max()),
|
||||
myProxDist (-1.),
|
||||
myPntStatus1 (ProxPnt_Status_UNKNOWN),
|
||||
myPntStatus2 (ProxPnt_Status_UNKNOWN),
|
||||
myNbSamples1 (theNbSamples1),
|
||||
myProxVtxIdx1 (-1)
|
||||
{
|
||||
LoadTriangleSets (theSet1, theSet2);
|
||||
LoadShapeLists (theShapeList1, theShapeList2);
|
||||
LoadAdditionalPointsFirstSet (theAddVertices1, theAddStatus1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LoadTriangleSets
|
||||
//purpose : Loads the given element sets into the tool
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityDistTool::LoadTriangleSets (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2)
|
||||
{
|
||||
mySet1 = theSet1;
|
||||
mySet2 = theSet2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LoadShapeLists
|
||||
//purpose : Loads the given list of subshapes into the proximity tool
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityDistTool::LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2)
|
||||
{
|
||||
myShapeList1 = theShapeList1;
|
||||
myShapeList2 = theShapeList2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LoadAdditionalPointsFirstSet
|
||||
//purpose : Loads given additional vertices and their statuses
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityDistTool::LoadAdditionalPointsFirstSet (const BVH_Array3d& theAddVertices1,
|
||||
const NCollection_Vector<ProxPnt_Status>& theAddStatus1)
|
||||
{
|
||||
myAddVertices1 = theAddVertices1;
|
||||
myAddStatus1 = theAddStatus1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : goThroughtSet1
|
||||
//purpose : Goes throught vertices from the 1st set
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityDistTool::goThroughtSet1 (const BVH_Array3d& theVertices1,
|
||||
const Standard_Boolean theIsAdditionalSet)
|
||||
{
|
||||
Standard_Integer aVtxSize = (Standard_Integer)theVertices1.size();
|
||||
Standard_Integer aVtxStep = Max (myNbSamples1 <= 0 ? 1 : aVtxSize / myNbSamples1, 1);
|
||||
for (Standard_Integer aVtxIdx = 0; aVtxIdx < aVtxSize; aVtxIdx += aVtxStep)
|
||||
{
|
||||
myDistance = std::numeric_limits<Standard_Real>::max();
|
||||
myMinDistance = std::numeric_limits<Standard_Real>::max();
|
||||
myIsDone = Standard_False;
|
||||
SetObject (theVertices1[aVtxIdx]);
|
||||
|
||||
ComputeDistance();
|
||||
|
||||
if (!IsDone() && myProxDist < 0.) return;
|
||||
|
||||
if (IsDone() && myDistance > myProxDist)
|
||||
{
|
||||
myPnt1 = theVertices1[aVtxIdx];
|
||||
myPnt2 = myExtremaPoint;
|
||||
myProxDist = myDistance;
|
||||
myProxVtxIdx1 = aVtxIdx;
|
||||
myIsProxVtx1FromAddSet = theIsAdditionalSet;
|
||||
myProxPrjState = myExtPrjState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose : Performs searching of the proximity distance
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityDistTool::Perform()
|
||||
{
|
||||
SetBVHSet (mySet2.get());
|
||||
goThroughtSet1 (mySet1->GetVertices(), Standard_False);
|
||||
goThroughtSet1 (myAddVertices1, Standard_True);
|
||||
|
||||
myIsDone = myProxDist > -1.;
|
||||
if (myIsDone)
|
||||
{
|
||||
DefineStatusProxPnt();
|
||||
}
|
||||
}
|
||||
|
||||
static Standard_Real pointBoxSquareMaxDistance (const BVH_Vec3d& thePoint,
|
||||
const BVH_Vec3d& theCMin,
|
||||
const BVH_Vec3d& theCMax)
|
||||
{
|
||||
Standard_Real aDist = 0;
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
if (thePoint[i] <= 0.5 * (theCMax[i] + theCMin[i])) { Standard_Real d = theCMax[i] - thePoint[i]; d *= d; aDist += d; }
|
||||
else { Standard_Real d = thePoint[i] - theCMin[i]; d *= d; aDist += d; }
|
||||
}
|
||||
return aDist;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Branch rejection
|
||||
//purpose : Defines the rules for node rejection by bounding box
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_ProximityDistTool::RejectNode (const BVH_Vec3d& theCornerMin,
|
||||
const BVH_Vec3d& theCornerMax,
|
||||
Standard_Real& theMetric) const
|
||||
{
|
||||
theMetric = sqrt (BVH_Tools<Standard_Real, 3>::PointBoxSquareDistance (myObject,
|
||||
theCornerMin,
|
||||
theCornerMax));
|
||||
|
||||
Standard_Real aMaxMetric = sqrt (pointBoxSquareMaxDistance (myObject,
|
||||
theCornerMin,
|
||||
theCornerMax));
|
||||
|
||||
return theMetric > myDistance || aMaxMetric < myProxDist;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Leaf acceptance
|
||||
//purpose : Defines the rules for leaf acceptance
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_ProximityDistTool::Accept (const Standard_Integer theTrgIdx,
|
||||
const Standard_Real&)
|
||||
{
|
||||
BVH_Vec3d aTrgVert1;
|
||||
BVH_Vec3d aTrgVert2;
|
||||
BVH_Vec3d aTrgVert3;
|
||||
|
||||
BVH_PrjState aBVH_PrjState;
|
||||
Standard_Integer aNumberOfFirstNode = -1;
|
||||
Standard_Integer aNumberOfLastNode = -1;
|
||||
|
||||
mySet2->GetVertices (theTrgIdx, aTrgVert1, aTrgVert2, aTrgVert3);
|
||||
|
||||
BVH_Vec3d aNearestPnt = BVH_Tools<Standard_Real, 3>::PointTriangleProjection (myObject,
|
||||
aTrgVert1, aTrgVert2, aTrgVert3,
|
||||
&aBVH_PrjState,
|
||||
&aNumberOfFirstNode, &aNumberOfLastNode);
|
||||
|
||||
PrjState aPrjState (theTrgIdx, aBVH_PrjState, aNumberOfFirstNode, aNumberOfLastNode);
|
||||
BVH_Vec3d aDirect = myObject - aNearestPnt;
|
||||
Standard_Real aSqDistance = aDirect.Dot(aDirect);
|
||||
|
||||
if (aSqDistance > Precision::SquareConfusion()) // point belongs to triangle
|
||||
{
|
||||
const BVH_Vec3d aAB = aTrgVert2 - aTrgVert1;
|
||||
|
||||
BVH_Vec3d aNorm;
|
||||
if (aTrgVert2.IsEqual (aTrgVert3)) // is this degenerate triangle (= segment)
|
||||
{
|
||||
const BVH_Vec3d aAP = myObject - aTrgVert1;
|
||||
aNorm = BVH_Vec3d::Cross (BVH_Vec3d::Cross (aAP, aAB), aAB);
|
||||
}
|
||||
else
|
||||
{
|
||||
const BVH_Vec3d aAC = aTrgVert3 - aTrgVert1;
|
||||
aNorm = BVH_Vec3d::Cross (aAB, aAC);
|
||||
}
|
||||
|
||||
Standard_Real aNormSqLen = aNorm.Dot (aNorm);
|
||||
|
||||
// check if the distance is under perpendicular
|
||||
const BVH_Vec3d aCrossCross = BVH_Vec3d::Cross (aDirect, aNorm);
|
||||
Standard_Real aCrossCrossSqLen = aCrossCross.Dot (aCrossCross);
|
||||
if (aCrossCrossSqLen > Precision::SquareConfusion() * aSqDistance * aNormSqLen)
|
||||
{
|
||||
// the distance is not under perpendicular
|
||||
if (myMinDistance - sqrt (aSqDistance) > Precision::Confusion())
|
||||
{
|
||||
myMinDistance = sqrt (aSqDistance);
|
||||
myMinDistPoint = aNearestPnt;
|
||||
myMinPrjState = aPrjState;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
// the distance is under perpendicular
|
||||
if (myDistance - sqrt (aSqDistance) > Precision::Confusion())
|
||||
{
|
||||
myDistance = sqrt (aSqDistance);
|
||||
myExtremaPoint = aNearestPnt;
|
||||
myExtPrjState = aPrjState;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeDistance
|
||||
//purpose : Computes the distance between object and BVH tree
|
||||
//=======================================================================
|
||||
Standard_Real BRepExtrema_ProximityDistTool::ComputeDistance()
|
||||
{
|
||||
myIsDone = this->Select() > 0;
|
||||
|
||||
if (!myIsDone)
|
||||
{
|
||||
if (myMinDistance < std::numeric_limits<Standard_Real>::max())
|
||||
{
|
||||
myExtremaPoint = myMinDistPoint;
|
||||
myExtPrjState = myMinPrjState;
|
||||
myIsDone = true;
|
||||
}
|
||||
|
||||
myDistance = myMinDistance;
|
||||
}
|
||||
|
||||
return myDistance;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsNodeOnBorder
|
||||
//purpose : Returns true if the node is on the boarder
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_ProximityDistTool::IsNodeOnBorder (const Standard_Integer theNodeIdx,
|
||||
const Handle(Poly_Triangulation)& theTr)
|
||||
{
|
||||
Poly_Connect aPolyConnect (theTr);
|
||||
|
||||
Standard_Integer aContTrg; //index of triangle containing exploring node
|
||||
for (aPolyConnect.Initialize (theNodeIdx); aPolyConnect.More(); aPolyConnect.Next())
|
||||
{
|
||||
aContTrg = aPolyConnect.Value();
|
||||
|
||||
Standard_Integer aContTrgNodes[3];
|
||||
theTr->Triangle (aContTrg).Get (aContTrgNodes[0], aContTrgNodes[1], aContTrgNodes[2]); //indices of nodes of the triangle
|
||||
|
||||
Standard_Integer aAdjTrg[3];
|
||||
aPolyConnect.Triangles (aContTrg, aAdjTrg[0], aAdjTrg[1], aAdjTrg[2]); //indices of adjacent triangles
|
||||
|
||||
for (Standard_Integer j = 0; j < 3; j++)
|
||||
{
|
||||
Standard_Integer k = (j + 1) % 3;
|
||||
if (aAdjTrg[j] == 0) //free segment of triangle
|
||||
{
|
||||
//aContTrgNodes[j], aContTrgNodes[k] are ends of free segment and it is a part of border
|
||||
if (aContTrgNodes[j] == theNodeIdx || aContTrgNodes[k] == theNodeIdx)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEdgeOnBorder
|
||||
//purpose : Returns true if the edge is on the boarder
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_ProximityDistTool::IsEdgeOnBorder (const Standard_Integer theTrgIdx,
|
||||
const Standard_Integer theFirstEdgeNodeIdx,
|
||||
const Standard_Integer theSecondEdgeNodeIdx,
|
||||
const Handle(Poly_Triangulation)& theTr)
|
||||
{
|
||||
Poly_Connect aPolyConnect (theTr);
|
||||
|
||||
Standard_Integer aAdjTrg[3];
|
||||
aPolyConnect.Triangles (theTrgIdx, aAdjTrg[0], aAdjTrg[1], aAdjTrg[2]); //indices of adjacent triangles
|
||||
|
||||
for (Standard_Integer j = 0; j < 3; j++)
|
||||
{
|
||||
Standard_Integer k = (j + 1) % 3;
|
||||
if (aAdjTrg[j] == 0) //free segment of triangle
|
||||
{
|
||||
//are ends of free segment and it is a part of border
|
||||
if (j == theFirstEdgeNodeIdx &&
|
||||
k == theSecondEdgeNodeIdx)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : defineStatusProxPnt1
|
||||
//purpose : Defines the status of proximity point from 1st BVH
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityDistTool::defineStatusProxPnt1()
|
||||
{
|
||||
if (myIsProxVtx1FromAddSet)
|
||||
{
|
||||
myPntStatus1 = myAddStatus1[myProxVtxIdx1];
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Integer aFaceID1 = mySet1->GetShapeIDOfVtx (myProxVtxIdx1);
|
||||
|
||||
if (myShapeList1 (aFaceID1).ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
const BVH_Array3d& aVertices1 = mySet1->GetVertices();
|
||||
Standard_Integer aVtxSize = (Standard_Integer)aVertices1.size();
|
||||
Standard_Integer aLastIdx = aVtxSize - 1;
|
||||
|
||||
if ((aVertices1[0] - aVertices1[aLastIdx]).Modulus() < Precision::Confusion()) // if closed
|
||||
{
|
||||
myPntStatus1 = ProxPnt_Status_MIDDLE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (myProxVtxIdx1 == 0 || myProxVtxIdx1 == aLastIdx)
|
||||
{
|
||||
myPntStatus1 = ProxPnt_Status_BORDER;
|
||||
}
|
||||
else
|
||||
{
|
||||
myPntStatus1 = ProxPnt_Status_MIDDLE;
|
||||
}
|
||||
}
|
||||
else if (myShapeList1 (aFaceID1).ShapeType() == TopAbs_FACE)
|
||||
{
|
||||
Standard_Integer aNodeIdx = mySet1->GetVtxIdxInShape (myProxVtxIdx1) + 1;
|
||||
|
||||
TopLoc_Location aLocation;
|
||||
const TopoDS_Face& aF = TopoDS::Face (myShapeList1 (aFaceID1));
|
||||
Handle(Poly_Triangulation) aTr = BRep_Tool::Triangulation (aF, aLocation);
|
||||
|
||||
if (IsNodeOnBorder (aNodeIdx, aTr))
|
||||
{
|
||||
myPntStatus1 = ProxPnt_Status_BORDER;
|
||||
}
|
||||
else
|
||||
{
|
||||
myPntStatus1 = ProxPnt_Status_MIDDLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : defineStatusProxPnt2
|
||||
//purpose : Defines the status of proximity point from 2nd BVH
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityDistTool::defineStatusProxPnt2()
|
||||
{
|
||||
Standard_Integer aTrgIdx = myProxPrjState.GetTrgIdx();
|
||||
Standard_Integer aFaceID2 = mySet2->GetFaceID (aTrgIdx);
|
||||
|
||||
if (myShapeList2 (aFaceID2).ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_INNER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
const BVH_Array3d& aVertices2 = mySet2->GetVertices();
|
||||
Standard_Integer aVtxSize = (Standard_Integer)aVertices2.size();
|
||||
Standard_Integer aLastIdx = aVtxSize - 1;
|
||||
|
||||
if ((aVertices2[0] - aVertices2[aLastIdx]).Modulus() < Precision::Confusion()) // if closed
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_MIDDLE;
|
||||
return;
|
||||
}
|
||||
|
||||
NCollection_Array1<Standard_Integer> aVtxIndicesOfTrg;
|
||||
mySet2->GetVtxIndices (aTrgIdx, aVtxIndicesOfTrg);
|
||||
|
||||
Standard_Integer aFirstNodeNum = myProxPrjState.GetNumberOfFirstNode();
|
||||
Standard_Integer aFirstVtxIdx = aVtxIndicesOfTrg[aFirstNodeNum];
|
||||
|
||||
if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_VERTEX)
|
||||
{
|
||||
if (aFirstVtxIdx == 0 || aFirstVtxIdx == aLastIdx)
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_BORDER;
|
||||
}
|
||||
else
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_MIDDLE;
|
||||
}
|
||||
}
|
||||
else if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_EDGE)
|
||||
{
|
||||
Standard_Integer aLastNodeNum = myProxPrjState.GetNumberOfLastNode();
|
||||
Standard_Integer aLastVtxIdx = aVtxIndicesOfTrg[aLastNodeNum];
|
||||
|
||||
// it could be border only in case projection is on a degenerated edge
|
||||
if (aFirstVtxIdx == aLastVtxIdx && (aFirstVtxIdx == 0 || aFirstVtxIdx == aLastIdx))
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_BORDER;
|
||||
}
|
||||
else
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_MIDDLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (myShapeList2 (aFaceID2).ShapeType() == TopAbs_FACE)
|
||||
{
|
||||
if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_INNER)
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_MIDDLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
TopLoc_Location aLocation;
|
||||
const TopoDS_Face& aF = TopoDS::Face (myShapeList2 (aFaceID2));
|
||||
Handle(Poly_Triangulation) aTr = BRep_Tool::Triangulation (aF, aLocation);
|
||||
|
||||
NCollection_Array1<Standard_Integer> aVtxIndicesOfTrg;
|
||||
mySet2->GetVtxIndices (aTrgIdx, aVtxIndicesOfTrg);
|
||||
|
||||
if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_VERTEX)
|
||||
{
|
||||
Standard_Integer aNodeNum = myProxPrjState.GetNumberOfFirstNode();
|
||||
Standard_Integer aNodeIdx = mySet2->GetVtxIdxInShape (aVtxIndicesOfTrg[aNodeNum]) + 1;
|
||||
|
||||
if (IsNodeOnBorder (aNodeIdx, aTr))
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_BORDER;
|
||||
}
|
||||
else
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_MIDDLE;
|
||||
}
|
||||
}
|
||||
else if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_EDGE)
|
||||
{
|
||||
Standard_Integer aTrgIdxInShape = mySet2->GetTrgIdxInShape (aTrgIdx) + 1;
|
||||
|
||||
if (IsEdgeOnBorder (aTrgIdxInShape,
|
||||
myProxPrjState.GetNumberOfFirstNode(),
|
||||
myProxPrjState.GetNumberOfLastNode(),
|
||||
aTr))
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_BORDER;
|
||||
}
|
||||
else
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_MIDDLE;
|
||||
}
|
||||
} //else if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_EDGE)
|
||||
}
|
||||
} //else if (myShapeList1 (aFaceID1).ShapeType() == TopAbs_FACE)
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DefineStatusProxPnt
|
||||
//purpose : Defines the status of proximity points
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityDistTool::DefineStatusProxPnt()
|
||||
{
|
||||
// define the status of proximity point from 1st BVH
|
||||
defineStatusProxPnt1();
|
||||
|
||||
// define the status of proximity point from 2nd BVH
|
||||
defineStatusProxPnt2();
|
||||
}
|
@@ -1,230 +0,0 @@
|
||||
// Created on: 2022-08-08
|
||||
// Created by: Kseniya NOSULKO
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _BRepExtrema_ProximityDistTool_HeaderFile
|
||||
#define _BRepExtrema_ProximityDistTool_HeaderFile
|
||||
|
||||
#include <BRepExtrema_ElementFilter.hxx>
|
||||
#include <BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx>
|
||||
#include <BRepExtrema_TriangleSet.hxx>
|
||||
#include <BVH_Distance.hxx>
|
||||
#include <BVH_Tools.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
|
||||
//! Tool class for computation the proximity distance from first
|
||||
//! primitive set to second one that is the maximal from minimum
|
||||
//! perpendicular distances. If no perpendicular distance is found, the
|
||||
//! minimum distance will be returned.
|
||||
//! This tool is not intended to be used independently, and is integrated
|
||||
//! in other classes, implementing algorithms based on shape tessellation
|
||||
//! (BRepExtrema_ProximityValueTool).
|
||||
//!
|
||||
//! Please note that algorithm results are approximate and depend greatly
|
||||
//! on the quality of input tessellation(s).
|
||||
class BRepExtrema_ProximityDistTool : public BVH_Distance <Standard_Real, 3, BVH_Vec3d,
|
||||
BRepExtrema_TriangleSet>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename BVH_Tools<Standard_Real, 3>::BVH_PrjStateInTriangle BVH_PrjState;
|
||||
|
||||
enum ProxPnt_Status
|
||||
{
|
||||
ProxPnt_Status_BORDER,
|
||||
ProxPnt_Status_MIDDLE,
|
||||
ProxPnt_Status_UNKNOWN
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
//! Struct with information about projection point state from 2nd BVH,
|
||||
//! providing proximity point of 2nd shape
|
||||
struct PrjState
|
||||
{
|
||||
PrjState()
|
||||
: myTrgIdx (0),
|
||||
myPrjState (BVH_PrjState::BVH_PrjStateInTriangle_INNER),
|
||||
myNumberOfFirstNode (0),
|
||||
myNumberOfLastNode (0)
|
||||
{}
|
||||
|
||||
PrjState (const Standard_Integer theTrgIdx,
|
||||
const BVH_PrjState thePrjState,
|
||||
const Standard_Integer theNumberOfFirstNode,
|
||||
const Standard_Integer theNumberOfLastNode)
|
||||
: myTrgIdx (theTrgIdx),
|
||||
myPrjState (thePrjState),
|
||||
myNumberOfFirstNode (theNumberOfFirstNode),
|
||||
myNumberOfLastNode (theNumberOfLastNode)
|
||||
{}
|
||||
|
||||
Standard_Integer GetTrgIdx() const { return myTrgIdx; }
|
||||
|
||||
BVH_PrjState GetPrjState() const { return myPrjState; }
|
||||
|
||||
Standard_Integer GetNumberOfFirstNode() const { return myNumberOfFirstNode; }
|
||||
|
||||
Standard_Integer GetNumberOfLastNode() const { return myNumberOfLastNode; }
|
||||
|
||||
private:
|
||||
|
||||
Standard_Integer myTrgIdx; //!< Index of triangle on which the projection is located
|
||||
BVH_PrjState myPrjState; //!< Position of a projection on the triangle (vertex, edge, inner)
|
||||
Standard_Integer myNumberOfFirstNode; //!< The 1st vtx of the triangle edge on which the projection is located
|
||||
Standard_Integer myNumberOfLastNode; //!< The 2nd vtx of the triangle edge on which the projection is located
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
//! Creates new unitialized tool.
|
||||
Standard_EXPORT BRepExtrema_ProximityDistTool();
|
||||
|
||||
//! Creates new tool for the given element sets.
|
||||
Standard_EXPORT BRepExtrema_ProximityDistTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Standard_Integer theNbSamples1,
|
||||
const BVH_Array3d& theAddVertices1,
|
||||
const NCollection_Vector<ProxPnt_Status>& theAddStatus1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2,
|
||||
const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2);
|
||||
|
||||
public:
|
||||
|
||||
//! Loads the given element sets into the tool.
|
||||
Standard_EXPORT void LoadTriangleSets (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2);
|
||||
|
||||
//! Loads the given list of subshapes into the tool.
|
||||
Standard_EXPORT void LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2);
|
||||
|
||||
//! Loads given additional vertices and their statuses.
|
||||
void LoadAdditionalPointsFirstSet (const BVH_Array3d& theAddVertices1,
|
||||
const NCollection_Vector<ProxPnt_Status>& theAddStatus1);
|
||||
|
||||
//! Performs searching of the proximity distance.
|
||||
Standard_EXPORT void Perform();
|
||||
|
||||
public: //! @name Reject/Accept implementations
|
||||
|
||||
//! Defines the rules for node rejection by bounding box.
|
||||
Standard_EXPORT virtual Standard_Boolean RejectNode (const BVH_Vec3d& theCornerMin,
|
||||
const BVH_Vec3d& theCornerMax,
|
||||
Standard_Real& theMetric) const Standard_OVERRIDE;
|
||||
|
||||
//! Defines the rules for leaf acceptance.
|
||||
Standard_EXPORT virtual Standard_Boolean Accept (const Standard_Integer theSgmIdx,
|
||||
const Standard_Real&) Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
//! Returns true if the node is on the boarder.
|
||||
Standard_EXPORT static Standard_Boolean IsNodeOnBorder (const Standard_Integer theNodeIdx,
|
||||
const Handle (Poly_Triangulation)& theTr);
|
||||
|
||||
//! Returns true if the edge is on the boarder.
|
||||
Standard_EXPORT static Standard_Boolean IsEdgeOnBorder (const Standard_Integer theTrgIdx,
|
||||
const Standard_Integer theFirstEdgeNodeIdx,
|
||||
const Standard_Integer theSecondEdgeNodeIdx,
|
||||
const Handle (Poly_Triangulation)& theTr);
|
||||
|
||||
public:
|
||||
|
||||
//! Returns points on triangles sets, which provide the proximity distance.
|
||||
void ProximityPoints (BVH_Vec3d& thePoint1, BVH_Vec3d& thePoint2) const
|
||||
{
|
||||
thePoint1 = myPnt1;
|
||||
thePoint2 = myPnt2;
|
||||
}
|
||||
|
||||
//! Returns status of points on triangles sets, which provide the proximity distance.
|
||||
void ProximityPointsStatus (ProxPnt_Status& thePointStatus1, ProxPnt_Status& thePointStatus2) const
|
||||
{
|
||||
thePointStatus1 = myPntStatus1;
|
||||
thePointStatus2 = myPntStatus2;
|
||||
}
|
||||
|
||||
//! Returns the computed distance
|
||||
Standard_Real ProximityDistance() const { return myProxDist; }
|
||||
|
||||
protected:
|
||||
|
||||
//! Computes the distance between object and BVH tree.
|
||||
Standard_EXPORT Standard_Real ComputeDistance();
|
||||
|
||||
//! Defines the status of proximity points.
|
||||
Standard_EXPORT void DefineStatusProxPnt();
|
||||
|
||||
private:
|
||||
|
||||
//! Goes throught vertices from the 1st set.
|
||||
void goThroughtSet1 (const BVH_Array3d& aVertices1,
|
||||
const Standard_Boolean theIsAdditionalSet);
|
||||
|
||||
//! Defines the status of proximity point from 1st BVH.
|
||||
void defineStatusProxPnt1();
|
||||
|
||||
//! Defines the status of proximity point from 2nd BVH.
|
||||
void defineStatusProxPnt2();
|
||||
|
||||
protected:
|
||||
|
||||
Standard_Real myMinDistance; //!< Minimal distance from point to BVH, could be not equal to myDistance
|
||||
BVH_Vec3d myMinDistPoint; //!< Point on BVH providing the minimal distance
|
||||
|
||||
BVH_Vec3d myExtremaPoint; //!< Point on BVH providing the extrema
|
||||
|
||||
Standard_Real myProxDist; //!< Proximity distance
|
||||
|
||||
//! Proximity points
|
||||
BVH_Vec3d myPnt1, myPnt2;
|
||||
|
||||
//! Proximity points' status
|
||||
ProxPnt_Status myPntStatus1, myPntStatus2;
|
||||
|
||||
private:
|
||||
|
||||
//! Set of all mesh elements (triangles) of the 1st shape.
|
||||
Handle(BRepExtrema_TriangleSet) mySet1;
|
||||
//! Set of all mesh elements (triangles) of the 2nd shape.
|
||||
Handle(BRepExtrema_TriangleSet) mySet2;
|
||||
|
||||
//! List of subshapes of the 1st shape.
|
||||
BRepExtrema_ShapeList myShapeList1;
|
||||
//! List of subshapes of the 2nd shape.
|
||||
BRepExtrema_ShapeList myShapeList2;
|
||||
|
||||
Standard_Integer myNbSamples1; //!< Number of samples points on the first shape
|
||||
|
||||
//! Is vertex corresponding to proximity point of 1st shape from additional set
|
||||
Standard_Integer myIsProxVtx1FromAddSet;
|
||||
BVH_Array3d myAddVertices1; //!< Additional vertices on the 1st shape
|
||||
NCollection_Vector<ProxPnt_Status> myAddStatus1; //!< Status of additional vertices on the 1st shape
|
||||
|
||||
//! Vertex index from 1st BVH corresponding to proximity point of 1st shape
|
||||
Standard_Integer myProxVtxIdx1;
|
||||
|
||||
//! Information of projection point state from 2nd BVH providing proximity point of 2nd shape
|
||||
PrjState myProxPrjState;
|
||||
|
||||
//! Information of projection point state from 2nd BVH providing the extrema
|
||||
PrjState myExtPrjState;
|
||||
|
||||
//! Information of projection point state from 2nd BVH providing the minimal distance
|
||||
PrjState myMinPrjState;
|
||||
|
||||
};
|
||||
|
||||
#endif // _BRepExtrema_ProximityDistTool_HeaderFile
|
@@ -1,587 +0,0 @@
|
||||
// Created on: 2022-08-08
|
||||
// Created by: Kseniya NOSULKO
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BRepExtrema_ProximityValueTool.hxx>
|
||||
#include <BRepExtrema_ProximityDistTool.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <GCPnts_QuasiUniformAbscissa.hxx>
|
||||
#include <GProp_GProps.hxx>
|
||||
#include <Poly_Connect.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepExtrema_ProximityValueTool
|
||||
//purpose : Creates new unitialized proximity tool
|
||||
//=======================================================================
|
||||
BRepExtrema_ProximityValueTool::BRepExtrema_ProximityValueTool()
|
||||
: myIsRefinementRequired1 (Standard_False),
|
||||
myIsRefinementRequired2 (Standard_False),
|
||||
myDistance (std::numeric_limits<Standard_Real>::max()),
|
||||
myIsDone (Standard_False),
|
||||
myNbSamples1(0),
|
||||
myNbSamples2(0)
|
||||
{
|
||||
// Should be initialized later
|
||||
myIsInitS1 = myIsInitS2 = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepExtrema_ProximityValueTool
|
||||
//purpose : Creates new proximity tool for the given element sets
|
||||
//=======================================================================
|
||||
BRepExtrema_ProximityValueTool::BRepExtrema_ProximityValueTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2,
|
||||
const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2)
|
||||
: myIsRefinementRequired1 (Standard_False),
|
||||
myIsRefinementRequired2 (Standard_False),
|
||||
myDistance (std::numeric_limits<Standard_Real>::max()),
|
||||
myIsDone (Standard_False),
|
||||
myNbSamples1 (0),
|
||||
myNbSamples2 (0)
|
||||
{
|
||||
LoadShapeLists (theShapeList1, theShapeList2);
|
||||
LoadTriangleSets (theSet1, theSet2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LoadTriangleSets
|
||||
//purpose : Loads the given element sets into the proximity tool
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityValueTool::LoadTriangleSets (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2)
|
||||
{
|
||||
mySet1 = theSet1;
|
||||
mySet2 = theSet2;
|
||||
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : calcEdgeRefinementStep
|
||||
//purpose : Calculates the edge refinement step
|
||||
//=======================================================================
|
||||
static Standard_Real calcEdgeRefinementStep (const TopoDS_Edge& theEdge,
|
||||
const Standard_Integer theNbNodes)
|
||||
{
|
||||
if (theNbNodes < 2)
|
||||
return 0;
|
||||
|
||||
BRepAdaptor_Curve aBAC (theEdge);
|
||||
Standard_Real aLen = GCPnts_AbscissaPoint::Length (aBAC);
|
||||
return aLen / (Standard_Real)(theNbNodes - 1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : calcFaceRefinementStep
|
||||
//purpose : Calculates the face refinement step as an approximate square
|
||||
// (Shape area / number triangles) * 2
|
||||
//=======================================================================
|
||||
static Standard_Real calcFaceRefinementStep (const TopoDS_Face& theFace,
|
||||
const Standard_Integer theNbTrg)
|
||||
{
|
||||
if (theNbTrg < 1)
|
||||
return 0;
|
||||
|
||||
GProp_GProps props;
|
||||
BRepGProp::SurfaceProperties (theFace, props);
|
||||
Standard_Real aArea = props.Mass();
|
||||
return 2 * (aArea / (Standard_Real)theNbTrg);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getInfoForRefinement
|
||||
//purpose : Gets shape data for further refinement
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_ProximityValueTool::getInfoForRefinement (const TopoDS_Shape& theShape,
|
||||
TopAbs_ShapeEnum& theShapeType,
|
||||
Standard_Integer& theNbNodes,
|
||||
Standard_Real& theStep)
|
||||
{
|
||||
if (theShape.ShapeType() == TopAbs_FACE)
|
||||
{
|
||||
theShapeType = TopAbs_FACE;
|
||||
TopoDS_Face aF = TopoDS::Face (theShape);
|
||||
|
||||
TopLoc_Location aLocation;
|
||||
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation (aF, aLocation);
|
||||
|
||||
if (aTriangulation.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
theNbNodes = aTriangulation->NbNodes();
|
||||
Standard_Integer aNbTrg = aTriangulation->NbTriangles();
|
||||
theStep = calcFaceRefinementStep (aF, aNbTrg);
|
||||
}
|
||||
else if (theShape.ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
theShapeType = TopAbs_EDGE;
|
||||
TopoDS_Edge aE = TopoDS::Edge (theShape);
|
||||
|
||||
TopLoc_Location aLocation;
|
||||
Handle(Poly_Polygon3D) aPolygon = BRep_Tool::Polygon3D (aE, aLocation);
|
||||
|
||||
if (aPolygon.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
theNbNodes = aPolygon->NbNodes();
|
||||
theStep = calcEdgeRefinementStep (aE, theNbNodes);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if (theStep < Precision::Confusion())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LoadTriangleSets
|
||||
//purpose : Loads the given list of subshapes into the proximity tool
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityValueTool::LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2)
|
||||
{
|
||||
myShapeList1 = theShapeList1;
|
||||
myShapeList2 = theShapeList2;
|
||||
|
||||
myShape1 = theShapeList1 (0);
|
||||
myIsInitS1 = getInfoForRefinement (myShape1, myShapeType1, myNbNodes1, myStep1);
|
||||
|
||||
myShape2 = theShapeList2 (0);
|
||||
myIsInitS2 = getInfoForRefinement (myShape2, myShapeType2, myNbNodes2, myStep2);
|
||||
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetNbSamplePoints
|
||||
//purpose : Sets number of sample points used for proximity calculation for each shape
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityValueTool::SetNbSamplePoints(const Standard_Integer theSamples1,
|
||||
const Standard_Integer theSamples2)
|
||||
{
|
||||
myNbSamples1 = theSamples1;
|
||||
myNbSamples2 = theSamples2;
|
||||
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : computeProximityValue
|
||||
//purpose : Returns the computed proximity value from first BVH to another one
|
||||
//=======================================================================
|
||||
Standard_Real BRepExtrema_ProximityValueTool::computeProximityDist (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Standard_Integer theNbSamples1,
|
||||
const BVH_Array3d& theAddVertices1,
|
||||
const NCollection_Vector<ProxPnt_Status>& theAddStatus1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2,
|
||||
const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2,
|
||||
BVH_Vec3d& thePoint1,
|
||||
BVH_Vec3d& thePoint2,
|
||||
ProxPnt_Status& thePointStatus1,
|
||||
ProxPnt_Status& thePointStatus2) const
|
||||
{
|
||||
BRepExtrema_ProximityDistTool aProxDistTool (theSet1, theNbSamples1, theAddVertices1, theAddStatus1,
|
||||
theSet2, theShapeList1, theShapeList2);
|
||||
aProxDistTool.Perform();
|
||||
|
||||
if (!aProxDistTool.IsDone())
|
||||
return -1.;
|
||||
|
||||
aProxDistTool.ProximityPoints (thePoint1, thePoint2);
|
||||
aProxDistTool.ProximityPointsStatus (thePointStatus1, thePointStatus2);
|
||||
|
||||
return aProxDistTool.ProximityDistance();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getEdgeAdditionalVertices
|
||||
//purpose : Gets additional vertices and their statuses on the edge with the input step
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_ProximityValueTool::getEdgeAdditionalVertices (
|
||||
const TopoDS_Edge& theEdge,
|
||||
const Standard_Real theStep,
|
||||
BVH_Array3d& theAddVertices,
|
||||
NCollection_Vector<ProxPnt_Status>& theAddStatuses)
|
||||
{
|
||||
BRepAdaptor_Curve aBAC (theEdge);
|
||||
|
||||
if (!aBAC.Is3DCurve() || theStep < Precision::Confusion())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Real aLen = GCPnts_AbscissaPoint::Length (aBAC);
|
||||
Standard_Integer aNbSamplePoints = (Standard_Integer) (aLen / theStep) + 1;
|
||||
|
||||
GCPnts_QuasiUniformAbscissa aGCPnts (aBAC, Max (3, aNbSamplePoints));
|
||||
|
||||
if (!aGCPnts.IsDone())
|
||||
return Standard_False;
|
||||
|
||||
Standard_Integer aNbNodes = aGCPnts.NbPoints();
|
||||
for (Standard_Integer aVertIdx = 2; aVertIdx < aNbNodes; ++aVertIdx) //don't add extreme points
|
||||
{
|
||||
Standard_Real aPar = aGCPnts.Parameter (aVertIdx);
|
||||
gp_Pnt aP = aBAC.Value (aPar);
|
||||
|
||||
theAddVertices.push_back (BVH_Vec3d (aP.X(), aP.Y(), aP.Z()));
|
||||
theAddStatuses.Append (ProxPnt_Status::ProxPnt_Status_MIDDLE);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : doRecurTrgSplit
|
||||
//purpose : Splits the triangle into two ones recursively, halving the longest side
|
||||
// untill the area of the current triangle > input step
|
||||
//! @param theTrg points of the triangle to be splitted
|
||||
//! @param theEdgesStatus status of triangle edges - on the border or middle of the face
|
||||
//! @param theTol telerance used in search of coincidence points
|
||||
//! @param theStep minimum area of the resulting triangle
|
||||
//! @param theAddVertices vertices obtained halving sides
|
||||
//! @param theAddStatuses status of obtained vertices - on the border or middle of the face,
|
||||
//! from triangulation of which the input triangle is
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityValueTool::doRecurTrgSplit (const gp_Pnt (&theTrg)[3],
|
||||
const ProxPnt_Status (&theEdgesStatus)[3],
|
||||
const Standard_Real theTol,
|
||||
const Standard_Real theStep,
|
||||
BVH_Array3d& theAddVertices,
|
||||
NCollection_Vector<ProxPnt_Status>& theAddStatuses)
|
||||
{
|
||||
gp_XYZ aTrgSide1 = theTrg[1].Coord() - theTrg[0].Coord();
|
||||
gp_XYZ aTrgSide2 = theTrg[2].Coord() - theTrg[0].Coord();
|
||||
Standard_Real aTrgArea = 0.5 * aTrgSide1.CrossMagnitude (aTrgSide2);
|
||||
|
||||
if (aTrgArea - theStep < Precision::SquareConfusion())
|
||||
return;
|
||||
|
||||
Standard_Real aD[3] { theTrg[0].Distance (theTrg[1]),
|
||||
theTrg[1].Distance (theTrg[2]),
|
||||
theTrg[2].Distance (theTrg[0]) };
|
||||
Standard_Integer aBisectedEdgeIdx = aD[0] > aD[1] ? (aD[0] > aD[2] ? 0 : 2) : (aD[1] > aD[2] ? 1 : 2);
|
||||
gp_Pnt aCenterOfMaxSide (theTrg[aBisectedEdgeIdx].Coord());
|
||||
aCenterOfMaxSide.BaryCenter (0.5, theTrg[(aBisectedEdgeIdx + 1) % 3], 0.5);
|
||||
|
||||
Bnd_Box aBox;
|
||||
aBox.Add (aCenterOfMaxSide);
|
||||
aBox.Enlarge (theTol);
|
||||
myInspector.SetCurrent (aCenterOfMaxSide.Coord());
|
||||
myCells.Inspect (aBox.CornerMin().XYZ(), aBox.CornerMax().XYZ(), myInspector);
|
||||
|
||||
if (myInspector.IsNeedAdd()) //is point aCenterOfMaxSide unique
|
||||
{
|
||||
BVH_Vec3d aBisectingPnt (aCenterOfMaxSide.X(), aCenterOfMaxSide.Y(), aCenterOfMaxSide.Z());
|
||||
theAddVertices.push_back (aBisectingPnt);
|
||||
theAddStatuses.Append (theEdgesStatus[aBisectedEdgeIdx]);
|
||||
myInspector.Add (aCenterOfMaxSide.Coord());
|
||||
myCells.Add (static_cast<BRepExtrema_VertexInspector::Target>(theAddVertices.size()),
|
||||
aBox.CornerMin().XYZ(), aBox.CornerMax().XYZ());
|
||||
}
|
||||
|
||||
gp_Pnt aTrg1[3] = { theTrg[0], theTrg[1], theTrg[2] };
|
||||
gp_Pnt aTrg2[3] = { theTrg[0], theTrg[1], theTrg[2] };
|
||||
ProxPnt_Status aEdgesStatus1[3] = { theEdgesStatus[0], theEdgesStatus[1], theEdgesStatus[2] };
|
||||
ProxPnt_Status aEdgesStatus2[3] = { theEdgesStatus[0], theEdgesStatus[1], theEdgesStatus[2] };
|
||||
switch (aBisectedEdgeIdx)
|
||||
{
|
||||
case 0:
|
||||
aTrg1[0] = aTrg2[1] = aCenterOfMaxSide;
|
||||
aEdgesStatus1[2] = aEdgesStatus2[1] = ProxPnt_Status::ProxPnt_Status_MIDDLE;
|
||||
break;
|
||||
case 1:
|
||||
aTrg1[1] = aTrg2[2] = aCenterOfMaxSide;
|
||||
aEdgesStatus1[0] = aEdgesStatus2[2] = ProxPnt_Status::ProxPnt_Status_MIDDLE;
|
||||
break;
|
||||
case 2:
|
||||
aTrg1[2] = aTrg2[0] = aCenterOfMaxSide;
|
||||
aEdgesStatus1[1] = aEdgesStatus2[0] = ProxPnt_Status::ProxPnt_Status_MIDDLE;
|
||||
break;
|
||||
}
|
||||
|
||||
doRecurTrgSplit (aTrg1, aEdgesStatus1, theTol, theStep, theAddVertices, theAddStatuses);
|
||||
doRecurTrgSplit (aTrg2, aEdgesStatus2, theTol, theStep, theAddVertices, theAddStatuses);
|
||||
}
|
||||
|
||||
static Standard_Real getModelRange (const TopLoc_Location& theLocation,
|
||||
const Handle(Poly_Triangulation)& theTr)
|
||||
{
|
||||
Bnd_Box aBox;
|
||||
theTr->MinMax (aBox, theLocation.Transformation());
|
||||
Standard_Real aXm = 0.0, aYm = 0.0, aZm = 0.0, aXM = 0.0, aYM = 0.0, aZM = 0.0;
|
||||
aBox.Get (aXm, aYm, aZm, aXM, aYM, aZM);
|
||||
Standard_Real aRange = aXM - aXm;
|
||||
aRange = Max (aRange, aYM - aYm);
|
||||
aRange = Max (aRange, aZM - aZm);
|
||||
|
||||
return aRange;
|
||||
}
|
||||
|
||||
static void getNodesOfTrg (const Standard_Integer theTriIdx,
|
||||
const TopLoc_Location& theLocation,
|
||||
const Handle (Poly_Triangulation)& theTr,
|
||||
gp_Pnt (&theTrg)[3])
|
||||
{
|
||||
Standard_Integer aVtxIdx1;
|
||||
Standard_Integer aVtxIdx2;
|
||||
Standard_Integer aVtxIdx3;
|
||||
|
||||
theTr->Triangle (theTriIdx).Get (aVtxIdx1, aVtxIdx2, aVtxIdx3);
|
||||
|
||||
gp_Pnt aVtx1 = theTr->Node (aVtxIdx1);
|
||||
aVtx1.Transform (theLocation);
|
||||
theTrg[0] = aVtx1;
|
||||
|
||||
gp_Pnt aVtx2 = theTr->Node (aVtxIdx2);
|
||||
aVtx2.Transform (theLocation);
|
||||
theTrg[1] = aVtx2;
|
||||
|
||||
gp_Pnt aVtx3 = theTr->Node (aVtxIdx3);
|
||||
aVtx3.Transform (theLocation);
|
||||
theTrg[2] = aVtx3;
|
||||
}
|
||||
|
||||
// Gets status of triangle edges - on the border or middle of the face
|
||||
static void getEdgesStatus(const Standard_Integer theTriIdx,
|
||||
const Handle(Poly_Triangulation)& theTr,
|
||||
ProxPnt_Status (&theEdgesStatus1)[3])
|
||||
{
|
||||
for (Standard_Integer j = 0; j < 3; j++)
|
||||
{
|
||||
Standard_Integer k = (j + 1) % 3;
|
||||
|
||||
if (BRepExtrema_ProximityDistTool::IsEdgeOnBorder (theTriIdx, j, k, theTr))
|
||||
{
|
||||
theEdgesStatus1[j] = ProxPnt_Status::ProxPnt_Status_BORDER;
|
||||
}
|
||||
else
|
||||
{
|
||||
theEdgesStatus1[j] = ProxPnt_Status::ProxPnt_Status_MIDDLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getFaceAdditionalVertices
|
||||
//purpose : Gets additional vertices and their statuses on the face with the input step (triangle square)
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_ProximityValueTool::getFaceAdditionalVertices (
|
||||
const TopoDS_Face& theFace,
|
||||
const Standard_Real theStep,
|
||||
BVH_Array3d& theAddVertices,
|
||||
NCollection_Vector<ProxPnt_Status>& theAddStatuses)
|
||||
{
|
||||
Standard_Real aTol = Precision::Confusion();
|
||||
|
||||
TopLoc_Location aLocation;
|
||||
Handle(Poly_Triangulation) aTr = BRep_Tool::Triangulation (theFace, aLocation);
|
||||
|
||||
if (aTr.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myCells.Reset (Max (aTol, getModelRange (aLocation, aTr) / IntegerLast()));
|
||||
|
||||
for (Standard_Integer aTriIdx = 1; aTriIdx <= aTr->NbTriangles(); ++aTriIdx)
|
||||
{
|
||||
gp_Pnt aTrg[3];
|
||||
ProxPnt_Status aEdgesStatus[3];
|
||||
getNodesOfTrg (aTriIdx, aLocation, aTr, aTrg);
|
||||
getEdgesStatus (aTriIdx, aTr, aEdgesStatus);
|
||||
doRecurTrgSplit (aTrg, aEdgesStatus, aTol, theStep, theAddVertices, theAddStatuses);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getShapesVertices
|
||||
//purpose : Gets additional vertices on shapes with refining a coarser one if it's needed
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_ProximityValueTool::getShapesAdditionalVertices()
|
||||
{
|
||||
// estimate the density of meshes of shapes to add points to a coarcer one
|
||||
// target steps for refinement
|
||||
Standard_Real aStep1 = myStep1;
|
||||
Standard_Real aStep2 = myStep2;
|
||||
|
||||
if ((myShapeType1 == TopAbs_EDGE) && (myShapeType2 == TopAbs_EDGE))
|
||||
{
|
||||
if (myNbSamples1 > myNbNodes1) // 1st edge needs refinement
|
||||
{
|
||||
aStep1 = calcEdgeRefinementStep (TopoDS::Edge (myShape1), myNbSamples1);
|
||||
myIsRefinementRequired1 = Standard_True;
|
||||
}
|
||||
|
||||
if (myNbSamples2 > myNbNodes2) // 2nd edge needs refinement
|
||||
{
|
||||
aStep2 = calcEdgeRefinementStep (TopoDS::Edge (myShape2), myNbSamples2);
|
||||
myIsRefinementRequired2 = Standard_True;
|
||||
}
|
||||
|
||||
if (aStep1 / aStep2 > 2.) // 1st edge needs refinement
|
||||
{
|
||||
myIsRefinementRequired1 = Standard_True;
|
||||
aStep1 = aStep2;
|
||||
}
|
||||
else if (aStep2 / aStep1 > 2.) // 2nd edge needs refinement
|
||||
{
|
||||
myIsRefinementRequired2 = Standard_True;
|
||||
aStep2 = aStep1;
|
||||
}
|
||||
|
||||
if (myIsRefinementRequired1)
|
||||
{
|
||||
if (!getEdgeAdditionalVertices (TopoDS::Edge (myShape1), aStep1, myAddVertices1, myAddStatus1))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
if (myIsRefinementRequired2)
|
||||
{
|
||||
if (!getEdgeAdditionalVertices (TopoDS::Edge (myShape2), aStep2, myAddVertices2, myAddStatus2))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((myShapeType1 == TopAbs_FACE) && (myShapeType2 == TopAbs_FACE))
|
||||
{
|
||||
if (aStep1 / aStep2 > 2) // 1st face needs refinement
|
||||
{
|
||||
myIsRefinementRequired1 = Standard_True;
|
||||
aStep1 = myStep2;
|
||||
}
|
||||
else if (aStep2 / aStep1 > 2.) // 2nd face needs refinement
|
||||
{
|
||||
myIsRefinementRequired2 = Standard_True;
|
||||
aStep2 = myStep1;
|
||||
}
|
||||
|
||||
if (myIsRefinementRequired1)
|
||||
{
|
||||
return getFaceAdditionalVertices (TopoDS::Face (myShape1), aStep1, myAddVertices1, myAddStatus1);
|
||||
}
|
||||
|
||||
if (myIsRefinementRequired2)
|
||||
{
|
||||
return getFaceAdditionalVertices (TopoDS::Face (myShape2), aStep2, myAddVertices2, myAddStatus2);
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose : Performs the computation of the proximity value
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityValueTool::Perform (Standard_Real& theTolerance)
|
||||
{
|
||||
if (!myIsInitS1 || !myIsInitS2 || (myShapeType1 != myShapeType2))
|
||||
return;
|
||||
|
||||
//get vertices on shapes with refining a coarser mesh if it's needed
|
||||
if (!getShapesAdditionalVertices())
|
||||
return;
|
||||
|
||||
// max(min) dist from the 1st shape to the 2nd one
|
||||
BVH_Vec3d aP1_1, aP1_2;
|
||||
ProxPnt_Status aPointStatus1_1 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
|
||||
ProxPnt_Status aPointStatus1_2 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
|
||||
|
||||
Standard_Real aProximityDist1 = computeProximityDist (mySet1, myNbSamples1, myAddVertices1, myAddStatus1,
|
||||
mySet2,
|
||||
myShapeList1, myShapeList2,
|
||||
aP1_1, aP1_2,
|
||||
aPointStatus1_1, aPointStatus1_2);
|
||||
|
||||
if (aProximityDist1 < 0.)
|
||||
return;
|
||||
|
||||
// max(min) dist from the 2nd shape to t he 1st one
|
||||
BVH_Vec3d aP2_1, aP2_2;
|
||||
ProxPnt_Status aPointStatus2_1 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
|
||||
ProxPnt_Status aPointStatus2_2 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
|
||||
|
||||
Standard_Real aProximityDist2 = computeProximityDist (mySet2, myNbSamples2, myAddVertices2, myAddStatus2,
|
||||
mySet1,
|
||||
myShapeList2, myShapeList1,
|
||||
aP2_2, aP2_1,
|
||||
aPointStatus2_2, aPointStatus2_1);
|
||||
|
||||
if (aProximityDist2 < 0.)
|
||||
return;
|
||||
|
||||
// min dist of the two max(min) dists
|
||||
if (aProximityDist1 < aProximityDist2)
|
||||
{
|
||||
myDistance = aProximityDist1;
|
||||
myPnt1.SetCoord(aP1_1.x(), aP1_1.y(), aP1_1.z());
|
||||
myPnt2.SetCoord(aP1_2.x(), aP1_2.y(), aP1_2.z());
|
||||
myPntStatus1 = aPointStatus1_1;
|
||||
myPntStatus2 = aPointStatus1_2;
|
||||
}
|
||||
else
|
||||
{
|
||||
myDistance = aProximityDist2;
|
||||
myPnt1.SetCoord(aP2_1.x(), aP2_1.y(), aP2_1.z());
|
||||
myPnt2.SetCoord(aP2_2.x(), aP2_2.y(), aP2_2.z());
|
||||
myPntStatus1 = aPointStatus2_1;
|
||||
myPntStatus2 = aPointStatus2_2;
|
||||
}
|
||||
|
||||
myIsDone = Standard_True;
|
||||
theTolerance = myDistance;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Inspect
|
||||
//purpose : Used for selection and storage of coinciding nodes
|
||||
//=======================================================================
|
||||
NCollection_CellFilter_Action BRepExtrema_VertexInspector::Inspect (const Standard_Integer theTarget)
|
||||
{
|
||||
myIsNeedAdd = Standard_True;
|
||||
|
||||
const gp_XYZ& aPnt = myPoints.Value (theTarget - 1);
|
||||
Standard_Real aDx, aDy, aDz;
|
||||
aDx = myCurrent.X() - aPnt.X();
|
||||
aDy = myCurrent.Y() - aPnt.Y();
|
||||
aDz = myCurrent.Z() - aPnt.Z();
|
||||
|
||||
if ((aDx * aDx <= myTol) && (aDy * aDy <= myTol) && (aDz * aDz <= myTol))
|
||||
myIsNeedAdd = Standard_False;
|
||||
|
||||
return CellFilter_Keep;
|
||||
}
|
@@ -1,242 +0,0 @@
|
||||
// Created on: 2022-08-08
|
||||
// Created by: Kseniya NOSULKO
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _BRepExtrema_ProximityValueTool_HeaderFile
|
||||
#define _BRepExtrema_ProximityValueTool_HeaderFile
|
||||
|
||||
#include <BRepExtrema_ProximityDistTool.hxx>
|
||||
#include <BRepExtrema_TriangleSet.hxx>
|
||||
#include <NCollection_CellFilter.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
typedef NCollection_Vector<gp_XYZ> VectorOfPoint;
|
||||
|
||||
//! Class BRepExtrema_VertexInspector
|
||||
//! derived from NCollection_CellFilter_InspectorXYZ
|
||||
//! This class define the Inspector interface for CellFilter algorithm,
|
||||
//! working with gp_XYZ points in 3d space.
|
||||
//! Used in search of coincidence points with a certain tolerance.
|
||||
class BRepExtrema_VertexInspector : public NCollection_CellFilter_InspectorXYZ
|
||||
{
|
||||
public:
|
||||
typedef Standard_Integer Target;
|
||||
|
||||
//! Constructor; remembers the tolerance
|
||||
BRepExtrema_VertexInspector()
|
||||
: myTol (Precision::SquareConfusion()),
|
||||
myIsNeedAdd (Standard_True)
|
||||
{}
|
||||
|
||||
//! Keep the points used for comparison
|
||||
void Add (const gp_XYZ& thePnt)
|
||||
{
|
||||
myPoints.Append (thePnt);
|
||||
}
|
||||
|
||||
//! Set tolerance for comparison of point coordinates
|
||||
void SetTol (const Standard_Real theTol)
|
||||
{
|
||||
myTol = theTol;
|
||||
}
|
||||
|
||||
//! Set current point to search for coincidence
|
||||
void SetCurrent (const gp_XYZ& theCurPnt)
|
||||
{
|
||||
myCurrent = theCurPnt;
|
||||
myIsNeedAdd = Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IsNeedAdd()
|
||||
{
|
||||
return myIsNeedAdd;
|
||||
}
|
||||
|
||||
//! Implementation of inspection method
|
||||
Standard_EXPORT NCollection_CellFilter_Action Inspect (const Standard_Integer theTarget);
|
||||
|
||||
private:
|
||||
Standard_Real myTol;
|
||||
Standard_Boolean myIsNeedAdd;
|
||||
VectorOfPoint myPoints;
|
||||
gp_XYZ myCurrent;
|
||||
};
|
||||
|
||||
typedef NCollection_CellFilter<BRepExtrema_VertexInspector> BRepExtrema_CellFilter;
|
||||
typedef typename BRepExtrema_ProximityDistTool::ProxPnt_Status ProxPnt_Status;
|
||||
|
||||
//! Tool class for computation of the proximity value from one BVH
|
||||
//! primitive set to another, solving max(min) problem.
|
||||
//! Handles only edge/edge or face/face cases.
|
||||
//! This tool is not intended to be used independently, and is integrated
|
||||
//! in other classes, implementing algorithms based on shape tessellation
|
||||
//! (BRepExtrema_ShapeProximity and BRepExtrema_SelfIntersection).
|
||||
//!
|
||||
//! Please note that algorithm results are approximate and depend greatly
|
||||
//! on the quality of input tessellation(s).
|
||||
class BRepExtrema_ProximityValueTool
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Creates new unitialized proximity tool.
|
||||
Standard_EXPORT BRepExtrema_ProximityValueTool();
|
||||
|
||||
//! Creates new proximity tool for the given element sets.
|
||||
Standard_EXPORT BRepExtrema_ProximityValueTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2,
|
||||
const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2);
|
||||
|
||||
public:
|
||||
|
||||
//! Loads the given element sets into the proximity tool.
|
||||
Standard_EXPORT void LoadTriangleSets (const Handle (BRepExtrema_TriangleSet)& theSet1,
|
||||
const Handle (BRepExtrema_TriangleSet)& theSet2);
|
||||
|
||||
//! Loads the given list of subshapes into the proximity tool.
|
||||
Standard_EXPORT void LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2);
|
||||
|
||||
//! Sets number of sample points used for proximity calculation for each shape.
|
||||
//! If number is less or equal zero, all triangulation nodes are used.
|
||||
Standard_EXPORT void SetNbSamplePoints (const Standard_Integer theSamples1 = 0,
|
||||
const Standard_Integer theSamples2 = 0);
|
||||
|
||||
//! Performs the computation of the proximity value.
|
||||
Standard_EXPORT void Perform (Standard_Real& theTolerance);
|
||||
|
||||
//! Is proximity test completed?
|
||||
Standard_Boolean IsDone() const { return myIsDone; }
|
||||
|
||||
//! Marks test results as outdated.
|
||||
void MarkDirty() { myIsDone = Standard_False; }
|
||||
|
||||
//! Returns the computed distance.
|
||||
Standard_Real Distance() const { return myDistance; }
|
||||
|
||||
//! Returns points on triangles sets, which provide the proximity distance.
|
||||
void ProximityPoints(gp_Pnt& thePoint1, gp_Pnt& thePoint2) const
|
||||
{
|
||||
thePoint1 = myPnt1;
|
||||
thePoint2 = myPnt2;
|
||||
}
|
||||
|
||||
//! Returns status of points on triangles sets, which provide the proximity distance.
|
||||
void ProximityPointsStatus (ProxPnt_Status& thePointStatus1, ProxPnt_Status& thePointStatus2) const
|
||||
{
|
||||
thePointStatus1 = myPntStatus1;
|
||||
thePointStatus2 = myPntStatus2;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! Gets shape data for further refinement.
|
||||
Standard_Boolean getInfoForRefinement (const TopoDS_Shape& theShapes,
|
||||
TopAbs_ShapeEnum& theShapeType,
|
||||
Standard_Integer& theNbNodes,
|
||||
Standard_Real& theStep);
|
||||
|
||||
//! Returns the computed proximity value from first BVH to another one.
|
||||
Standard_Real computeProximityDist (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Standard_Integer theNbSamples1,
|
||||
const BVH_Array3d& theAddVertices1,
|
||||
const NCollection_Vector<ProxPnt_Status>& theAddStatus1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2,
|
||||
const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2,
|
||||
BVH_Vec3d& thePoint1,
|
||||
BVH_Vec3d& thePoint2,
|
||||
ProxPnt_Status& thePointStatus1,
|
||||
ProxPnt_Status& thePointStatus2) const;
|
||||
|
||||
//! Gets additional vertices on shapes with refining a coarser one if it's needed.
|
||||
Standard_Boolean getShapesAdditionalVertices();
|
||||
|
||||
//! Gets additional vertices and their statuses on the edge with the input step.
|
||||
Standard_Boolean getEdgeAdditionalVertices (const TopoDS_Edge& theEdge,
|
||||
const Standard_Real theStep,
|
||||
BVH_Array3d& theAddVertices,
|
||||
NCollection_Vector<ProxPnt_Status>& theAddStatuses);
|
||||
|
||||
//! Gets additional vertices and their statuses on the face with the input step (triangle square).
|
||||
Standard_Boolean getFaceAdditionalVertices (const TopoDS_Face& theFace,
|
||||
const Standard_Real theStep,
|
||||
BVH_Array3d& theAddVertices,
|
||||
NCollection_Vector<ProxPnt_Status>& theAddStatuses);
|
||||
|
||||
//! Splits the triangle recursively, halving the longest side
|
||||
//! to the area of the current triangle > input step
|
||||
void doRecurTrgSplit (const gp_Pnt (&theTrg)[3],
|
||||
const ProxPnt_Status (&theEdgesStatus)[3],
|
||||
const Standard_Real theTol,
|
||||
const Standard_Real theStep,
|
||||
BVH_Array3d& theAddVertices,
|
||||
NCollection_Vector<ProxPnt_Status>& theAddStatuses);
|
||||
private:
|
||||
|
||||
//! Set of all mesh primitives of the 1st shape.
|
||||
Handle(BRepExtrema_TriangleSet) mySet1;
|
||||
//! Set of all mesh primitives of the 2nd shape.
|
||||
Handle(BRepExtrema_TriangleSet) mySet2;
|
||||
|
||||
//! List of subshapes of the 1st shape.
|
||||
BRepExtrema_ShapeList myShapeList1;
|
||||
//! List of subshapes of the 2nd shape.
|
||||
BRepExtrema_ShapeList myShapeList2;
|
||||
|
||||
//! The 1st shape.
|
||||
TopoDS_Shape myShape1;
|
||||
//! The 2nd shape.
|
||||
TopoDS_Shape myShape2;
|
||||
|
||||
BVH_Array3d myAddVertices1; //!< Additional vertices on the 1st shape if its mesh is coarser.
|
||||
BVH_Array3d myAddVertices2; //!< Additional vertices on the 2nd shape if its mesh is coarser.
|
||||
|
||||
NCollection_Vector<ProxPnt_Status> myAddStatus1; //!< Status of additional vertices on the 1st shape.
|
||||
NCollection_Vector<ProxPnt_Status> myAddStatus2; //!< Status of additional vertices on the 2nd shape.
|
||||
|
||||
Standard_Boolean myIsInitS1; //!< Is the 1st shape initialized?
|
||||
Standard_Boolean myIsInitS2; //!< Is the 2nd shape initialized?
|
||||
|
||||
Standard_Boolean myIsRefinementRequired1; //!< Flag about the need to refine the 1st shape.
|
||||
Standard_Boolean myIsRefinementRequired2; //!< Flag about the need to refine the 2nd shape.
|
||||
|
||||
Standard_Integer myNbNodes1; //!< Number of nodes in triangulation of the 1st shape.
|
||||
Standard_Integer myNbNodes2; //!< Number of nodes in triangulation of the 2nd shape.
|
||||
|
||||
Standard_Real myStep1; //!< Step for getting vertices on the 1st shape.
|
||||
Standard_Real myStep2; //!< Step for getting vertices on the 2nd shape.
|
||||
|
||||
BRepExtrema_CellFilter myCells;
|
||||
BRepExtrema_VertexInspector myInspector;
|
||||
|
||||
TopAbs_ShapeEnum myShapeType1; //!< 1st shape type.
|
||||
TopAbs_ShapeEnum myShapeType2; //!< 2nd shape type.
|
||||
|
||||
Standard_Real myDistance; //!< Distance
|
||||
Standard_Boolean myIsDone; //!< State of the algorithm
|
||||
|
||||
Standard_Integer myNbSamples1; //!< Number of samples points on the first shape
|
||||
Standard_Integer myNbSamples2; //!< Number of samples points on the second shape
|
||||
|
||||
//! Proximity points
|
||||
gp_Pnt myPnt1, myPnt2;
|
||||
|
||||
//! Proximity points' status
|
||||
ProxPnt_Status myPntStatus1, myPntStatus2;
|
||||
|
||||
};
|
||||
|
||||
#endif // _BRepExtrema_ProximityValueTool_HeaderFile
|
@@ -18,8 +18,6 @@
|
||||
|
||||
#include <BRepExtrema_OverlapTool.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
//! Tool class for detection of self-sections in the given shape.
|
||||
//! This class is based on BRepExtrema_OverlapTool and thus uses
|
||||
//! shape tessellation to detect incorrect mesh fragments (pairs
|
||||
@@ -78,7 +76,7 @@ public:
|
||||
//! Returns sub-shape from the shape for the given index (started from 0).
|
||||
const TopoDS_Face& GetSubShape (const Standard_Integer theID) const
|
||||
{
|
||||
return TopoDS::Face(myFaceList.Value(theID));
|
||||
return myFaceList.Value (theID);
|
||||
}
|
||||
|
||||
//! Returns set of all the face triangles of the shape.
|
||||
|
@@ -18,28 +18,6 @@
|
||||
#include <Precision.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
// Assign a map of sub-shapes (edges/faces) of a given shape
|
||||
static Standard_Boolean initSubShapes(const TopoDS_Shape& theShape,
|
||||
BRepExtrema_ShapeList& theSubshapesList,
|
||||
Handle(BRepExtrema_TriangleSet)& theTriangleSet)
|
||||
{
|
||||
theSubshapesList.Clear();
|
||||
|
||||
for (TopExp_Explorer anIter(theShape, TopAbs_FACE); anIter.More(); anIter.Next())
|
||||
{
|
||||
theSubshapesList.Append(anIter.Current());
|
||||
}
|
||||
|
||||
for (TopExp_Explorer anIter(theShape, TopAbs_EDGE); anIter.More(); anIter.Next())
|
||||
{
|
||||
theSubshapesList.Append(anIter.Current());
|
||||
}
|
||||
|
||||
if (theTriangleSet.IsNull())
|
||||
theTriangleSet = new BRepExtrema_TriangleSet;
|
||||
return theTriangleSet->Init(theSubshapesList);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepExtrema_ShapeProximity
|
||||
//purpose : Creates uninitialized proximity tool
|
||||
@@ -47,9 +25,7 @@ static Standard_Boolean initSubShapes(const TopoDS_Shape& theShape,
|
||||
BRepExtrema_ShapeProximity::BRepExtrema_ShapeProximity (const Standard_Real theTolerance)
|
||||
: myTolerance (theTolerance),
|
||||
myElementSet1 (new BRepExtrema_TriangleSet),
|
||||
myElementSet2 (new BRepExtrema_TriangleSet),
|
||||
myNbSamples1 (0),
|
||||
myNbSamples2 (0)
|
||||
myElementSet2 (new BRepExtrema_TriangleSet)
|
||||
{
|
||||
// Should be initialized later
|
||||
myIsInitS1 = myIsInitS2 = Standard_False;
|
||||
@@ -64,9 +40,7 @@ BRepExtrema_ShapeProximity::BRepExtrema_ShapeProximity (const TopoDS_Shape& theS
|
||||
const Standard_Real theTolerance)
|
||||
: myTolerance (theTolerance),
|
||||
myElementSet1 (new BRepExtrema_TriangleSet),
|
||||
myElementSet2 (new BRepExtrema_TriangleSet),
|
||||
myNbSamples1 (0),
|
||||
myNbSamples2 (0)
|
||||
myElementSet2 (new BRepExtrema_TriangleSet)
|
||||
{
|
||||
LoadShape1 (theShape1);
|
||||
LoadShape2 (theShape2);
|
||||
@@ -78,18 +52,16 @@ BRepExtrema_ShapeProximity::BRepExtrema_ShapeProximity (const TopoDS_Shape& theS
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_ShapeProximity::LoadShape1 (const TopoDS_Shape& theShape1)
|
||||
{
|
||||
myIsInitS1 = initSubShapes(theShape1, myShapeList1, myElementSet1);
|
||||
myFaceList1.Clear();
|
||||
|
||||
if (myTolerance == Precision::Infinite())
|
||||
for (TopExp_Explorer anIter (theShape1, TopAbs_FACE); anIter.More(); anIter.Next())
|
||||
{
|
||||
myProxValTool.MarkDirty();
|
||||
}
|
||||
else
|
||||
{
|
||||
myOverlapTool.MarkDirty();
|
||||
myFaceList1.Append (static_cast<const TopoDS_Face&> (anIter.Current()));
|
||||
}
|
||||
|
||||
return myIsInitS1;
|
||||
myOverlapTool.MarkDirty();
|
||||
|
||||
return myIsInitS1 = myElementSet1->Init (myFaceList1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -98,18 +70,16 @@ Standard_Boolean BRepExtrema_ShapeProximity::LoadShape1 (const TopoDS_Shape& the
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_ShapeProximity::LoadShape2 (const TopoDS_Shape& theShape2)
|
||||
{
|
||||
myIsInitS2 = initSubShapes(theShape2, myShapeList2, myElementSet2);
|
||||
myFaceList2.Clear();
|
||||
|
||||
if (myTolerance == Precision::Infinite())
|
||||
for (TopExp_Explorer anIter (theShape2, TopAbs_FACE); anIter.More(); anIter.Next())
|
||||
{
|
||||
myProxValTool.MarkDirty();
|
||||
}
|
||||
else
|
||||
{
|
||||
myOverlapTool.MarkDirty();
|
||||
myFaceList2.Append (static_cast<const TopoDS_Face&> (anIter.Current()));
|
||||
}
|
||||
|
||||
return myIsInitS2;
|
||||
myOverlapTool.MarkDirty();
|
||||
|
||||
return myIsInitS2 = myElementSet2->Init (myFaceList2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -118,33 +88,13 @@ Standard_Boolean BRepExtrema_ShapeProximity::LoadShape2 (const TopoDS_Shape& the
|
||||
//=======================================================================
|
||||
void BRepExtrema_ShapeProximity::Perform()
|
||||
{
|
||||
if (myTolerance == Precision::Infinite())
|
||||
if (!myIsInitS1 || !myIsInitS2 || myOverlapTool.IsDone())
|
||||
{
|
||||
if (!myIsInitS1 || !myIsInitS2 || myProxValTool.IsDone())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myProxValTool.LoadTriangleSets (myElementSet1,
|
||||
myElementSet2);
|
||||
myProxValTool.LoadShapeLists (myShapeList1,
|
||||
myShapeList2);
|
||||
myProxValTool.SetNbSamplePoints (myNbSamples1, myNbSamples2);
|
||||
|
||||
myProxValTool.Perform (myTolerance);
|
||||
myProxValTool.ProximityPoints(myProxPoint1, myProxPoint2);
|
||||
myProxValTool.ProximityPointsStatus (myProxPntStatus1, myProxPntStatus2);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!myIsInitS1 || !myIsInitS2 || myOverlapTool.IsDone())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myOverlapTool.LoadTriangleSets (myElementSet1,
|
||||
myElementSet2);
|
||||
myOverlapTool.LoadTriangleSets (myElementSet1,
|
||||
myElementSet2);
|
||||
|
||||
myOverlapTool.Perform (myTolerance);
|
||||
}
|
||||
myOverlapTool.Perform (myTolerance);
|
||||
}
|
||||
|
@@ -16,47 +16,31 @@
|
||||
#ifndef _BRepExtrema_ShapeProximity_HeaderFile
|
||||
#define _BRepExtrema_ShapeProximity_HeaderFile
|
||||
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TColStd_PackedMapOfInteger.hxx>
|
||||
|
||||
#include <BRepExtrema_ProximityValueTool.hxx>
|
||||
#include <BRepExtrema_TriangleSet.hxx>
|
||||
#include <BRepExtrema_OverlapTool.hxx>
|
||||
|
||||
//! @brief Tool class for shape proximity detection.
|
||||
//!
|
||||
//! First approach:
|
||||
//! Tool class for shape proximity detection.
|
||||
//! For two given shapes and given tolerance (offset from the mesh) the algorithm allows
|
||||
//! to determine whether or not they are overlapped. The algorithm input consists of any
|
||||
//! shapes which can be decomposed into individual faces (used as basic shape elements).
|
||||
//! High performance is achieved through the use of existing triangulation of faces. So
|
||||
//! poly triangulation (with the desired deflection) should already be built. Note that
|
||||
//! solution is approximate (and corresponds to the deflection used for triangulation).
|
||||
//!
|
||||
//! The algorithm can be run in two modes. If tolerance is set to zero, the algorithm
|
||||
//! will detect only intersecting faces (containing triangles with common points). If
|
||||
//! tolerance is set to positive value, the algorithm will also detect faces located
|
||||
//! on distance less than the given tolerance from each other.
|
||||
//!
|
||||
//! Second approach:
|
||||
//! Compute the proximity value between two shapes (handles only edge/edge or face/face cases)
|
||||
//! if the tolerance is not defined (Precision::Infinite()).
|
||||
//! In this case the proximity value is a minimal thickness of a layer containing both shapes.
|
||||
//!
|
||||
//! For the both approaches the high performance is achieved through the use of existing
|
||||
//! triangulation of faces. So, poly triangulation (with the desired deflection) should already
|
||||
//! be built. Note that solution is approximate (and corresponds to the deflection used for
|
||||
//! triangulation).
|
||||
class BRepExtrema_ShapeProximity
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Creates empty proximity tool.
|
||||
Standard_EXPORT BRepExtrema_ShapeProximity (const Standard_Real theTolerance = Precision::Infinite());
|
||||
Standard_EXPORT BRepExtrema_ShapeProximity (const Standard_Real theTolerance = 0.0);
|
||||
|
||||
//! Creates proximity tool for the given two shapes.
|
||||
Standard_EXPORT BRepExtrema_ShapeProximity (const TopoDS_Shape& theShape1,
|
||||
const TopoDS_Shape& theShape2,
|
||||
const Standard_Real theTolerance = Precision::Infinite());
|
||||
const Standard_Real theTolerance = 0.0);
|
||||
|
||||
public:
|
||||
|
||||
@@ -72,33 +56,19 @@ public:
|
||||
myTolerance = theTolerance;
|
||||
}
|
||||
|
||||
//! Returns proximity value calculated for the whole input shapes.
|
||||
Standard_Real Proximity() const
|
||||
{
|
||||
return Tolerance();
|
||||
}
|
||||
|
||||
//! Loads 1st shape into proximity tool.
|
||||
Standard_EXPORT Standard_Boolean LoadShape1 (const TopoDS_Shape& theShape1);
|
||||
|
||||
//! Loads 2nd shape into proximity tool.
|
||||
Standard_EXPORT Standard_Boolean LoadShape2 (const TopoDS_Shape& theShape2);
|
||||
|
||||
//! Set number of sample points on the 1st shape used to compute the proximity value.
|
||||
//! In case of 0, all triangulation nodes will be used.
|
||||
void SetNbSamples1(const Standard_Integer theNbSamples) { myNbSamples1 = theNbSamples; }
|
||||
|
||||
//! Set number of sample points on the 2nd shape used to compute the proximity value.
|
||||
//! In case of 0, all triangulation nodes will be used.
|
||||
void SetNbSamples2(const Standard_Integer theNbSamples) { myNbSamples2 = theNbSamples; }
|
||||
|
||||
//! Performs search of overlapped faces.
|
||||
Standard_EXPORT void Perform();
|
||||
|
||||
//! True if the search is completed.
|
||||
Standard_Boolean IsDone() const
|
||||
{
|
||||
return myOverlapTool.IsDone() || myProxValTool.IsDone();
|
||||
return myOverlapTool.IsDone();
|
||||
}
|
||||
|
||||
//! Returns set of IDs of overlapped faces of 1st shape (started from 0).
|
||||
@@ -114,15 +84,15 @@ public:
|
||||
}
|
||||
|
||||
//! Returns sub-shape from 1st shape with the given index (started from 0).
|
||||
const TopoDS_Shape& GetSubShape1 (const Standard_Integer theID) const
|
||||
const TopoDS_Face& GetSubShape1 (const Standard_Integer theID) const
|
||||
{
|
||||
return myShapeList1.Value (theID);
|
||||
return myFaceList1.Value (theID);
|
||||
}
|
||||
|
||||
//! Returns sub-shape from 1st shape with the given index (started from 0).
|
||||
const TopoDS_Shape& GetSubShape2 (const Standard_Integer theID) const
|
||||
const TopoDS_Face& GetSubShape2 (const Standard_Integer theID) const
|
||||
{
|
||||
return myShapeList2.Value (theID);
|
||||
return myFaceList2.Value (theID);
|
||||
}
|
||||
|
||||
//! Returns set of all the face triangles of the 1st shape.
|
||||
@@ -137,34 +107,6 @@ public:
|
||||
return myElementSet2;
|
||||
}
|
||||
|
||||
//! Returns the point on the 1st shape, which could be used as a reference point
|
||||
//! for the value of the proximity.
|
||||
const gp_Pnt& ProximityPoint1() const
|
||||
{
|
||||
return myProxPoint1;
|
||||
}
|
||||
|
||||
//! Returns the point on the 2nd shape, which could be used as a reference point
|
||||
//! for the value of the proximity.
|
||||
const gp_Pnt& ProximityPoint2() const
|
||||
{
|
||||
return myProxPoint2;
|
||||
}
|
||||
|
||||
//! Returns the status of point on the 1st shape, which could be used as a reference point
|
||||
//! for the value of the proximity.
|
||||
const ProxPnt_Status& ProxPntStatus1() const
|
||||
{
|
||||
return myProxPntStatus1;
|
||||
}
|
||||
|
||||
//! Returns the status of point on the 2nd shape, which could be used as a reference point
|
||||
//! for the value of the proximity.
|
||||
const ProxPnt_Status& ProxPntStatus2() const
|
||||
{
|
||||
return myProxPntStatus2;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! Maximum overlapping distance.
|
||||
@@ -175,39 +117,19 @@ private:
|
||||
//! Is the 2nd shape initialized?
|
||||
Standard_Boolean myIsInitS2;
|
||||
|
||||
//! List of subshapes of the 1st shape.
|
||||
BRepExtrema_ShapeList myShapeList1;
|
||||
//! List of subshapes of the 2nd shape.
|
||||
BRepExtrema_ShapeList myShapeList2;
|
||||
//! List of faces of the 1st shape.
|
||||
BRepExtrema_ShapeList myFaceList1;
|
||||
//! List of faces of the 2nd shape.
|
||||
BRepExtrema_ShapeList myFaceList2;
|
||||
|
||||
//! Set of all the face triangles of the 1st shape.
|
||||
Handle(BRepExtrema_TriangleSet) myElementSet1;
|
||||
//! Set of all the face triangles of the 2nd shape.
|
||||
Handle(BRepExtrema_TriangleSet) myElementSet2;
|
||||
|
||||
//! Number of sample points on the 1st shape used to compute the proximity value
|
||||
//! (if zero (default), all triangulation nodes will be used).
|
||||
Standard_Integer myNbSamples1;
|
||||
//! Number of sample points on the 2nd shape used to compute the proximity value
|
||||
//! (if zero (default), all triangulation nodes will be used).
|
||||
Standard_Integer myNbSamples2;
|
||||
|
||||
//! Reference point of the proximity value on the 1st shape.
|
||||
gp_Pnt myProxPoint1;
|
||||
//! Reference point of the proximity value on the 2st shape.
|
||||
gp_Pnt myProxPoint2;
|
||||
|
||||
//! Status of reference points of the proximity value.
|
||||
ProxPnt_Status myProxPntStatus1, myProxPntStatus2;
|
||||
|
||||
//! Overlap tool used for intersection/overlap test.
|
||||
BRepExtrema_OverlapTool myOverlapTool;
|
||||
|
||||
//! Shape-shape proximity tool used for computation of
|
||||
//! the minimal diameter of a tube containing both edges or
|
||||
//! the minimal thickness of a shell containing both faces.
|
||||
BRepExtrema_ProximityValueTool myProxValTool;
|
||||
|
||||
};
|
||||
|
||||
#endif // _BRepExtrema_ShapeProximity_HeaderFile
|
||||
|
@@ -18,7 +18,6 @@
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BVH_LinearBuilder.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepExtrema_TriangleSet, BVH_PrimitiveSet3d)
|
||||
|
||||
@@ -115,65 +114,17 @@ void BRepExtrema_TriangleSet::Swap (const Standard_Integer theIndex1, const Stan
|
||||
{
|
||||
std::swap (myTriangles[theIndex1],
|
||||
myTriangles[theIndex2]);
|
||||
|
||||
std::swap (myTrgIdxMap (theIndex1),
|
||||
myTrgIdxMap (theIndex2));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetFaceID
|
||||
//purpose : Returns face ID of the given vertex
|
||||
//purpose : Returns face ID of the given triangle
|
||||
//=======================================================================
|
||||
Standard_Integer BRepExtrema_TriangleSet::GetFaceID (const Standard_Integer theIndex) const
|
||||
{
|
||||
return myTriangles[theIndex].w();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetShapeIDOfVtx
|
||||
//purpose : Returns shape ID of the given vertex index
|
||||
//=======================================================================
|
||||
Standard_Integer BRepExtrema_TriangleSet::GetShapeIDOfVtx (const Standard_Integer theIndex) const
|
||||
{
|
||||
return myShapeIdxOfVtxVec.Value (theIndex);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetVtxIdxInShape
|
||||
//purpose : Returns vertex index in tringulation of the shape, which vertex belongs,
|
||||
// with the given vtx ID in whole set
|
||||
//=======================================================================
|
||||
Standard_Integer BRepExtrema_TriangleSet::GetVtxIdxInShape (const Standard_Integer theIndex) const
|
||||
{
|
||||
Standard_Integer aShID = myShapeIdxOfVtxVec.Value (theIndex);
|
||||
Standard_Integer aNumVertices = 0;
|
||||
|
||||
for (Standard_Integer aSIdx = 0; aSIdx < aShID; aSIdx++)
|
||||
{
|
||||
aNumVertices += myNumVtxInShapeVec.Value (aSIdx);
|
||||
}
|
||||
|
||||
return theIndex - aNumVertices;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTrgIdxInShape
|
||||
//purpose : Returns triangle index (before swapping) in tringulation of the shape, which triangle belongs,
|
||||
// with the given trg ID in whole set (after swapping)
|
||||
//=======================================================================
|
||||
Standard_Integer BRepExtrema_TriangleSet::GetTrgIdxInShape (const Standard_Integer theIndex) const
|
||||
{
|
||||
Standard_Integer aShID = GetFaceID (theIndex);
|
||||
Standard_Integer aNumTriangles = 0;
|
||||
|
||||
for (Standard_Integer aSIdx = 0; aSIdx < aShID; aSIdx++)
|
||||
{
|
||||
aNumTriangles += myNumTrgInShapeVec.Value (aSIdx);
|
||||
}
|
||||
|
||||
return myTrgIdxMap (theIndex) - aNumTriangles;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetVertices
|
||||
//purpose : Returns vertices of the given triangle
|
||||
@@ -190,21 +141,6 @@ void BRepExtrema_TriangleSet::GetVertices (const Standard_Integer theIndex,
|
||||
theVertex3 = myVertexArray[aTriangle.z()];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetVertices
|
||||
//purpose : Returns vertices of the given triangle
|
||||
//=======================================================================
|
||||
void BRepExtrema_TriangleSet::GetVtxIndices (const Standard_Integer theIndex,
|
||||
NCollection_Array1<Standard_Integer>& theVtxIndices) const
|
||||
{
|
||||
BVH_Vec4i aTriangle = myTriangles[theIndex];
|
||||
|
||||
theVtxIndices = NCollection_Array1<Standard_Integer> (0, 2);
|
||||
theVtxIndices.SetValue (0, aTriangle.x());
|
||||
theVtxIndices.SetValue (1, aTriangle.y());
|
||||
theVtxIndices.SetValue (2, aTriangle.z());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose : Clears triangle set data
|
||||
@@ -222,26 +158,41 @@ void BRepExtrema_TriangleSet::Clear()
|
||||
//function : Init
|
||||
//purpose : Initializes triangle set
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_TriangleSet::Init (const BRepExtrema_ShapeList& theShapes)
|
||||
Standard_Boolean BRepExtrema_TriangleSet::Init (const BRepExtrema_ShapeList& theFaces)
|
||||
{
|
||||
Clear();
|
||||
|
||||
Standard_Boolean isOK = Standard_True;
|
||||
for (Standard_Integer aShapeIdx = 0; aShapeIdx < theShapes.Size() && isOK; ++aShapeIdx)
|
||||
for (Standard_Integer aFaceIdx = 0; aFaceIdx < theFaces.Size(); ++aFaceIdx)
|
||||
{
|
||||
if (theShapes (aShapeIdx).ShapeType() == TopAbs_FACE)
|
||||
isOK = initFace (TopoDS::Face (theShapes(aShapeIdx)), aShapeIdx);
|
||||
else if (theShapes (aShapeIdx).ShapeType() == TopAbs_EDGE)
|
||||
isOK = initEdge (TopoDS::Edge (theShapes(aShapeIdx)), aShapeIdx);
|
||||
}
|
||||
TopLoc_Location aLocation;
|
||||
|
||||
Standard_Integer aNumTrg = static_cast<Standard_Integer> (myTriangles.size());
|
||||
myTrgIdxMap.Clear();
|
||||
myTrgIdxMap.ReSize (aNumTrg);
|
||||
Handle(Poly_Triangulation) aTriangulation =
|
||||
BRep_Tool::Triangulation (theFaces (aFaceIdx), aLocation);
|
||||
|
||||
for (Standard_Integer aTrgIdx = 0; aTrgIdx < aNumTrg; ++aTrgIdx)
|
||||
{
|
||||
myTrgIdxMap.Bind (aTrgIdx, aTrgIdx);
|
||||
if (aTriangulation.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const Standard_Integer aVertOffset =
|
||||
static_cast<Standard_Integer> (myVertexArray.size()) - 1;
|
||||
|
||||
for (Standard_Integer aVertIdx = 1; aVertIdx <= aTriangulation->NbNodes(); ++aVertIdx)
|
||||
{
|
||||
gp_Pnt aVertex = aTriangulation->Node (aVertIdx);
|
||||
aVertex.Transform (aLocation.Transformation());
|
||||
myVertexArray.push_back (BVH_Vec3d (aVertex.X(), aVertex.Y(), aVertex.Z()));
|
||||
}
|
||||
|
||||
for (Standard_Integer aTriIdx = 1; aTriIdx <= aTriangulation->NbTriangles(); ++aTriIdx)
|
||||
{
|
||||
Standard_Integer aVertex1, aVertex2, aVertex3;
|
||||
aTriangulation->Triangle (aTriIdx).Get (aVertex1, aVertex2, aVertex3);
|
||||
myTriangles.push_back (BVH_Vec4i (aVertex1 + aVertOffset,
|
||||
aVertex2 + aVertOffset,
|
||||
aVertex3 + aVertOffset,
|
||||
aFaceIdx));
|
||||
}
|
||||
}
|
||||
|
||||
MarkDirty(); // needs BVH rebuilding
|
||||
@@ -252,95 +203,3 @@ Standard_Boolean BRepExtrema_TriangleSet::Init (const BRepExtrema_ShapeList& the
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : initFace
|
||||
//purpose : Initializes triangle set
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_TriangleSet::initFace (const TopoDS_Face& theFace, const Standard_Integer theIndex)
|
||||
{
|
||||
TopLoc_Location aLocation;
|
||||
|
||||
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation (theFace, aLocation);
|
||||
if (aTriangulation.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const Standard_Integer aVertOffset =
|
||||
static_cast<Standard_Integer> (myVertexArray.size()) - 1;
|
||||
|
||||
initNodes (aTriangulation->MapNodeArray()->ChangeArray1(), aLocation.Transformation(), theIndex);
|
||||
|
||||
for (Standard_Integer aTriIdx = 1; aTriIdx <= aTriangulation->NbTriangles(); ++aTriIdx)
|
||||
{
|
||||
Standard_Integer aVertex1;
|
||||
Standard_Integer aVertex2;
|
||||
Standard_Integer aVertex3;
|
||||
|
||||
aTriangulation->Triangle (aTriIdx).Get (aVertex1,
|
||||
aVertex2,
|
||||
aVertex3);
|
||||
|
||||
myTriangles.push_back (BVH_Vec4i (aVertex1 + aVertOffset,
|
||||
aVertex2 + aVertOffset,
|
||||
aVertex3 + aVertOffset,
|
||||
theIndex));
|
||||
}
|
||||
|
||||
myNumTrgInShapeVec.SetValue (theIndex, aTriangulation->NbTriangles());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : initEdge
|
||||
//purpose : Initializes triangle set
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_TriangleSet::initEdge (const TopoDS_Edge& theEdge, const Standard_Integer theIndex)
|
||||
{
|
||||
TopLoc_Location aLocation;
|
||||
|
||||
Handle(Poly_Polygon3D) aPolygon = BRep_Tool::Polygon3D (theEdge, aLocation);
|
||||
if (aPolygon.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const Standard_Integer aVertOffset =
|
||||
static_cast<Standard_Integer> (myVertexArray.size()) - 1;
|
||||
|
||||
initNodes (aPolygon->Nodes(), aLocation.Transformation(), theIndex);
|
||||
|
||||
for (Standard_Integer aVertIdx = 1; aVertIdx < aPolygon->NbNodes(); ++aVertIdx)
|
||||
{
|
||||
// segment as degenerate triangle
|
||||
myTriangles.push_back (BVH_Vec4i (aVertIdx + aVertOffset,
|
||||
aVertIdx + aVertOffset + 1,
|
||||
aVertIdx + aVertOffset + 1,
|
||||
theIndex));
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : initNodes
|
||||
//purpose : Initializes nodes
|
||||
//=======================================================================
|
||||
void BRepExtrema_TriangleSet::initNodes (const TColgp_Array1OfPnt& theNodes,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Integer theIndex)
|
||||
{
|
||||
for (Standard_Integer aVertIdx = 1; aVertIdx <= theNodes.Size(); ++aVertIdx)
|
||||
{
|
||||
gp_Pnt aVertex = theNodes.Value (aVertIdx);
|
||||
|
||||
aVertex.Transform (theTrsf);
|
||||
|
||||
myVertexArray.push_back (BVH_Vec3d (aVertex.X(),
|
||||
aVertex.Y(),
|
||||
aVertex.Z()));
|
||||
myShapeIdxOfVtxVec.Append (theIndex);
|
||||
}
|
||||
|
||||
myNumVtxInShapeVec.SetValue (theIndex, theNodes.Size());
|
||||
}
|
||||
|
@@ -16,14 +16,11 @@
|
||||
#ifndef _BRepExtrema_TriangleSet_HeaderFile
|
||||
#define _BRepExtrema_TriangleSet_HeaderFile
|
||||
|
||||
#include <BVH_PrimitiveSet3d.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_DataMapOfIntegerInteger.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <BVH_PrimitiveSet3d.hxx>
|
||||
|
||||
//! List of shapes and their IDs for collision detection.
|
||||
typedef NCollection_Vector<TopoDS_Shape> BRepExtrema_ShapeList;
|
||||
typedef NCollection_Vector<TopoDS_Face> BRepExtrema_ShapeList;
|
||||
|
||||
//! Triangle set corresponding to specific face.
|
||||
class BRepExtrema_TriangleSet : public BVH_PrimitiveSet3d
|
||||
@@ -62,10 +59,7 @@ public:
|
||||
Standard_EXPORT void Clear();
|
||||
|
||||
//! Initializes triangle set.
|
||||
Standard_EXPORT Standard_Boolean Init (const BRepExtrema_ShapeList& theShapes);
|
||||
|
||||
//! Returns all vertices.
|
||||
Standard_EXPORT const BVH_Array3d& GetVertices() const { return myVertexArray; }
|
||||
Standard_EXPORT Standard_Boolean Init (const BRepExtrema_ShapeList& theFaces);
|
||||
|
||||
//! Returns vertices of the given triangle.
|
||||
Standard_EXPORT void GetVertices (const Standard_Integer theIndex,
|
||||
@@ -73,37 +67,9 @@ public:
|
||||
BVH_Vec3d& theVertex2,
|
||||
BVH_Vec3d& theVertex3) const;
|
||||
|
||||
//! Returns vertex indices of the given triangle.
|
||||
Standard_EXPORT void GetVtxIndices (const Standard_Integer theIndex,
|
||||
NCollection_Array1<Standard_Integer>& theVtxIndices) const;
|
||||
|
||||
//! Returns face ID of the given triangle.
|
||||
Standard_EXPORT Standard_Integer GetFaceID (const Standard_Integer theIndex) const;
|
||||
|
||||
//! Returns shape ID of the given vertex index.
|
||||
Standard_EXPORT Standard_Integer GetShapeIDOfVtx (const Standard_Integer theIndex) const;
|
||||
|
||||
//! Returns vertex index in tringulation of the shape, which vertex belongs,
|
||||
//! with the given vtx ID in whole set.
|
||||
Standard_EXPORT Standard_Integer GetVtxIdxInShape (const Standard_Integer theIndex) const;
|
||||
|
||||
//! Returns triangle index (before swapping) in tringulation of the shape, which triangle belongs,
|
||||
//! with the given trg ID in whole set (after swapping).
|
||||
Standard_EXPORT Standard_Integer GetTrgIdxInShape (const Standard_Integer theIndex) const;
|
||||
|
||||
private:
|
||||
|
||||
//! Initializes triangle set from the face
|
||||
Standard_Boolean initFace (const TopoDS_Face& theFace, const Standard_Integer theIndex);
|
||||
|
||||
//! Initializes polygon from the edge
|
||||
Standard_Boolean initEdge (const TopoDS_Edge& theEdge, const Standard_Integer theIndex);
|
||||
|
||||
//! Initializes nodes
|
||||
void initNodes (const TColgp_Array1OfPnt& theNodes,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Integer theIndex);
|
||||
|
||||
protected:
|
||||
|
||||
//! Array of vertex indices.
|
||||
@@ -112,19 +78,6 @@ protected:
|
||||
//! Array of vertex coordinates.
|
||||
BVH_Array3d myVertexArray;
|
||||
|
||||
//! Vector of shapes' indices where index of item corresponds to index of vertex,
|
||||
//! belonging to this shape.
|
||||
NCollection_Vector<Standard_Integer> myShapeIdxOfVtxVec;
|
||||
|
||||
//! Vector of vertexes' number belonging to shape which index corresponds item's index.
|
||||
NCollection_Vector<Standard_Integer> myNumVtxInShapeVec;
|
||||
|
||||
//! Vector of triangles' number belonging to shape which index corresponds item's index.
|
||||
NCollection_Vector<Standard_Integer> myNumTrgInShapeVec;
|
||||
|
||||
//! Map of triangles' indices after (key) and before (value) swapping.
|
||||
TColStd_DataMapOfIntegerInteger myTrgIdxMap;
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BRepExtrema_TriangleSet, BVH_PrimitiveSet3d)
|
||||
|
@@ -18,10 +18,6 @@ BRepExtrema_OverlapTool.cxx
|
||||
BRepExtrema_OverlapTool.hxx
|
||||
BRepExtrema_Poly.cxx
|
||||
BRepExtrema_Poly.hxx
|
||||
BRepExtrema_ProximityValueTool.cxx
|
||||
BRepExtrema_ProximityValueTool.hxx
|
||||
BRepExtrema_ProximityDistTool.cxx
|
||||
BRepExtrema_ProximityDistTool.hxx
|
||||
BRepExtrema_SelfIntersection.cxx
|
||||
BRepExtrema_SelfIntersection.hxx
|
||||
BRepExtrema_SeqOfSolution.hxx
|
||||
|
@@ -3002,7 +3002,7 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
|
||||
}
|
||||
}
|
||||
|
||||
if ((NbTrous > 0) ? (aNbFaces < NbLaw) : (aNbFaces == 0))
|
||||
if (aNbFaces == 0)
|
||||
{
|
||||
isDone = Standard_False;
|
||||
return;
|
||||
|
@@ -56,7 +56,6 @@
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
#include <BRepExtrema_ExtCC.hxx>
|
||||
#include <ShapeFix_Edge.hxx>
|
||||
|
||||
static TopoDS_Edge FindEdgeCloseToBisectorPlane(const TopoDS_Vertex& theVertex,
|
||||
TopoDS_Compound& theComp,
|
||||
@@ -535,26 +534,6 @@ BRepFill_TrimShellCorner::MakeFacesNonSec(const Standard_Integer
|
||||
|
||||
if(bHasNewEdge) {
|
||||
aNewEdge.Orientation(TopAbs_FORWARD);
|
||||
|
||||
// Refer to BrepFill_Sweep.cxx BuildEdge Construct an edge via an iso
|
||||
gp_Pnt P1, P2;
|
||||
Standard_Real p11, p12, p21, p22;
|
||||
P1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aNewEdge)));
|
||||
P2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aNewEdge)));
|
||||
|
||||
TopoDS_Edge aERef = TopoDS::Edge(fit == 1 ? aE1 : aE2);
|
||||
p11 = P1.Distance(BRep_Tool::Pnt(TopExp::FirstVertex(aERef)));
|
||||
p22 = P2.Distance(BRep_Tool::Pnt(TopExp::LastVertex(aERef)));
|
||||
p12 = P1.Distance(BRep_Tool::Pnt(TopExp::LastVertex(aERef)));
|
||||
p21 = P2.Distance(BRep_Tool::Pnt(TopExp::FirstVertex(aERef)));
|
||||
|
||||
if (p11 > p12 && p22 > p21) {
|
||||
aNewEdge.Reverse();
|
||||
}
|
||||
|
||||
// for nonPlane surface, we should add pCurve
|
||||
Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge();
|
||||
sfe->FixAddPCurve(aNewEdge, TopoDS::Face(aFace), Standard_False);
|
||||
}
|
||||
|
||||
TopTools_ListOfShape aOrderedList;
|
||||
|
@@ -802,7 +802,7 @@ static void GetEdgeTol(const TopoDS_Edge& theEdge,
|
||||
}
|
||||
if(temp > d2) d2 = temp;
|
||||
}
|
||||
d2 = 1.05*sqrt(d2);
|
||||
d2 = 1.5*sqrt(d2);
|
||||
theEdTol = d2;
|
||||
}
|
||||
|
||||
@@ -884,6 +884,10 @@ static void UpdShTol(const TopTools_DataMapOfShapeReal& theShToTol,
|
||||
case TopAbs_VERTEX:
|
||||
{
|
||||
const Handle(BRep_TVertex)& aTV = *((Handle(BRep_TVertex)*)&aNsh.TShape());
|
||||
//
|
||||
if(aTV->Locked())
|
||||
throw TopoDS_LockedShape("BRep_Builder::UpdateVertex");
|
||||
//
|
||||
if (theVForceUpdate)
|
||||
aTV->Tolerance(aTol);
|
||||
else
|
||||
@@ -1705,8 +1709,8 @@ static void InternalUpdateTolerances(const TopoDS_Shape& theOldShape,
|
||||
for (iCur=1; iCur<=nbV; iCur++) {
|
||||
tol=0;
|
||||
const TopoDS_Vertex& V = TopoDS::Vertex(parents.FindKey(iCur));
|
||||
gp_Pnt aPV = BRep_Tool::Pnt(V);
|
||||
Standard_Real aMaxDist = 0.;
|
||||
Bnd_Box box;
|
||||
box.Add(BRep_Tool::Pnt(V));
|
||||
gp_Pnt p3d;
|
||||
for (lConx.Initialize(parents(iCur)); lConx.More(); lConx.Next()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(lConx.Value());
|
||||
@@ -1728,10 +1732,8 @@ static void InternalUpdateTolerances(const TopoDS_Shape& theOldShape,
|
||||
if (!C.IsNull()) { // edge non degenerated
|
||||
p3d = C->Value(par);
|
||||
p3d.Transform(L.Transformation());
|
||||
Standard_Real aDist = p3d.SquareDistance(aPV);
|
||||
if (aDist > aMaxDist)
|
||||
aMaxDist = aDist;
|
||||
}
|
||||
box.Add(p3d);
|
||||
}
|
||||
}
|
||||
else if (cr->IsCurveOnSurface()) {
|
||||
const Handle(Geom_Surface)& Su = cr->Surface();
|
||||
@@ -1743,22 +1745,21 @@ static void InternalUpdateTolerances(const TopoDS_Shape& theOldShape,
|
||||
gp_Pnt2d p2d = PC->Value(par);
|
||||
p3d = Su->Value(p2d.X(),p2d.Y());
|
||||
p3d.Transform(L.Transformation());
|
||||
Standard_Real aDist = p3d.SquareDistance(aPV);
|
||||
if (aDist > aMaxDist)
|
||||
aMaxDist = aDist;
|
||||
box.Add(p3d);
|
||||
if (!PC2.IsNull()) {
|
||||
p2d = PC2->Value(par);
|
||||
p3d = Su->Value(p2d.X(),p2d.Y());
|
||||
p3d.Transform(L.Transformation());
|
||||
aDist = p3d.SquareDistance(aPV);
|
||||
if (aDist > aMaxDist)
|
||||
aMaxDist = aDist;
|
||||
box.Add(p3d);
|
||||
}
|
||||
}
|
||||
itcr.Next();
|
||||
}
|
||||
}
|
||||
tol = Max(tol, sqrt(aMaxDist));
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
||||
box.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
||||
aXmax -= aXmin; aYmax -= aYmin; aZmax -= aZmin;
|
||||
tol = Max(tol,sqrt(aXmax*aXmax+aYmax*aYmax+aZmax*aZmax));
|
||||
tol += 2.*Epsilon(tol);
|
||||
//
|
||||
Standard_Real aVTol = BRep_Tool::Tolerance(V);
|
||||
|
@@ -506,14 +506,7 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
|
||||
|
||||
if (!isSolved)
|
||||
return;
|
||||
//Removing very small values
|
||||
Standard_Real aMaxV = Max(Abs(aVec(1)), Max(Abs(aVec(2)), Abs(aVec(3))));
|
||||
Standard_Real eps = Epsilon(aMaxV);
|
||||
for (i = 1; i <= 3; ++i)
|
||||
{
|
||||
if (Abs(aVec(i)) <= eps)
|
||||
aVec(i) = 0.;
|
||||
}
|
||||
|
||||
gp_Vec aN (aVec (1), aVec (2), aVec (3));
|
||||
Handle(Geom_Plane) aPlane = new Geom_Plane (aBaryCenter, aN);
|
||||
myTolReached = Controle (aPoints, aPlane);
|
||||
|
@@ -41,13 +41,10 @@ std::pair<Standard_Real, Standard_Real> BRepMesh_ConeRangeSplitter::GetSplitStep
|
||||
|
||||
const Standard_Real aDiffU = aRangeU.second - aRangeU.first;
|
||||
const Standard_Real aDiffV = aRangeV.second - aRangeV.first;
|
||||
const Standard_Real aScale = (Du * aRadius);
|
||||
const Standard_Real aRatio = Max(1., Log(aDiffV / aScale));
|
||||
const Standard_Integer nbU = (Standard_Integer)(aDiffU / Du);
|
||||
const Standard_Integer nbV = (Standard_Integer)(aDiffV / aScale / aRatio);
|
||||
|
||||
Standard_Integer nbU = (Standard_Integer) (aDiffU / Du);
|
||||
Standard_Integer nbV = (Standard_Integer) (nbU * (aDiffV) / (aDiffU * aRadius));
|
||||
Du = aDiffU / (nbU + 1);
|
||||
Dv = aDiffV / (nbV + static_cast<Standard_Integer>(aRatio));
|
||||
Dv = aDiffV / (nbV + 1);
|
||||
|
||||
theStepsNb.first = nbU;
|
||||
theStepsNb.second = nbV;
|
||||
|
@@ -35,13 +35,11 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_CurveTessellator, IMeshTools_CurveTessellato
|
||||
//=======================================================================
|
||||
BRepMesh_CurveTessellator::BRepMesh_CurveTessellator(
|
||||
const IMeshData::IEdgeHandle& theEdge,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
: myDEdge(theEdge),
|
||||
myParameters(theParameters),
|
||||
myEdge(theEdge->GetEdge()),
|
||||
myCurve(myEdge),
|
||||
myMinPointsNb (theMinPointsNb)
|
||||
myCurve(myEdge)
|
||||
{
|
||||
init();
|
||||
}
|
||||
@@ -54,13 +52,11 @@ BRepMesh_CurveTessellator::BRepMesh_CurveTessellator (
|
||||
const IMeshData::IEdgeHandle& theEdge,
|
||||
const TopAbs_Orientation theOrientation,
|
||||
const IMeshData::IFaceHandle& theFace,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
: myDEdge(theEdge),
|
||||
myParameters(theParameters),
|
||||
myEdge(TopoDS::Edge(theEdge->GetEdge().Oriented(theOrientation))),
|
||||
myCurve(myEdge, theFace->GetFace()),
|
||||
myMinPointsNb (theMinPointsNb)
|
||||
myCurve(myEdge, theFace->GetFace())
|
||||
{
|
||||
init();
|
||||
}
|
||||
@@ -101,8 +97,7 @@ void BRepMesh_CurveTessellator::init()
|
||||
myEdgeSqTol = BRep_Tool::Tolerance (myEdge);
|
||||
myEdgeSqTol *= myEdgeSqTol;
|
||||
|
||||
const Standard_Integer aMinPntNb = Max(myMinPointsNb,
|
||||
(myCurve.GetType() == GeomAbs_Circle) ? 4 : 2); //OCC287
|
||||
const Standard_Integer aMinPntNb = (myCurve.GetType() == GeomAbs_Circle) ? 4 : 2; //OCC287
|
||||
|
||||
myDiscretTool.Initialize (myCurve,
|
||||
myCurve.FirstParameter(), myCurve.LastParameter(),
|
||||
|
@@ -34,16 +34,14 @@ public:
|
||||
//! Constructor.
|
||||
Standard_EXPORT BRepMesh_CurveTessellator(
|
||||
const IMeshData::IEdgeHandle& theEdge,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb = 2);
|
||||
const IMeshTools_Parameters& theParameters);
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT BRepMesh_CurveTessellator (
|
||||
const IMeshData::IEdgeHandle& theEdge,
|
||||
const TopAbs_Orientation theOrientation,
|
||||
const IMeshData::IFaceHandle& theFace,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb = 2);
|
||||
const IMeshTools_Parameters& theParameters);
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_CurveTessellator ();
|
||||
@@ -98,7 +96,6 @@ private:
|
||||
const IMeshTools_Parameters& myParameters;
|
||||
TopoDS_Edge myEdge;
|
||||
BRepAdaptor_Curve myCurve;
|
||||
Standard_Integer myMinPointsNb;
|
||||
GCPnts_TangentialDeflection myDiscretTool;
|
||||
TopoDS_Vertex myFirstVertex;
|
||||
TopoDS_Vertex myLastVertex;
|
||||
|
@@ -49,10 +49,9 @@ BRepMesh_EdgeDiscret::~BRepMesh_EdgeDiscret ()
|
||||
//=======================================================================
|
||||
Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellator(
|
||||
const IMeshData::IEdgeHandle& theDEdge,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
{
|
||||
return new BRepMesh_CurveTessellator(theDEdge, theParameters, theMinPointsNb);
|
||||
return new BRepMesh_CurveTessellator(theDEdge, theParameters);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -63,12 +62,11 @@ Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellator(
|
||||
const IMeshData::IEdgeHandle& theDEdge,
|
||||
const TopAbs_Orientation theOrientation,
|
||||
const IMeshData::IFaceHandle& theDFace,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
{
|
||||
return theDEdge->GetSameParam() ?
|
||||
new BRepMesh_CurveTessellator(theDEdge, theParameters, theMinPointsNb) :
|
||||
new BRepMesh_CurveTessellator(theDEdge, theOrientation, theDFace, theParameters, theMinPointsNb);
|
||||
new BRepMesh_CurveTessellator(theDEdge, theParameters) :
|
||||
new BRepMesh_CurveTessellator(theDEdge, theOrientation, theDFace, theParameters);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -38,16 +38,14 @@ public:
|
||||
//! Creates instance of free edge tessellator.
|
||||
Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellator(
|
||||
const IMeshData::IEdgeHandle& theDEdge,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb = 2);
|
||||
const IMeshTools_Parameters& theParameters);
|
||||
|
||||
//! Creates instance of edge tessellator.
|
||||
Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellator(
|
||||
const IMeshData::IEdgeHandle& theDEdge,
|
||||
const TopAbs_Orientation theOrientation,
|
||||
const IMeshData::IFaceHandle& theDFace,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb = 2);
|
||||
const IMeshTools_Parameters& theParameters);
|
||||
|
||||
//! Creates instance of tessellation extractor.
|
||||
Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellationExtractor(
|
||||
|
@@ -1,45 +0,0 @@
|
||||
// Created on: 2022-09-07
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// 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 <BRepMesh_ExtrusionRangeSplitter.hxx>
|
||||
|
||||
//=======================================================================
|
||||
// Function: getUndefinedIntervalNb
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_ExtrusionRangeSplitter::getUndefinedIntervalNb(
|
||||
const Handle(Adaptor3d_Surface)& theSurface,
|
||||
const Standard_Boolean /*isU*/,
|
||||
const GeomAbs_Shape theContinuity) const
|
||||
{
|
||||
// Here we need just a regular grid along dimension with no
|
||||
// geometrical data regarding intervals like extrusion surface.
|
||||
const Handle(Adaptor3d_Curve) aCurve = theSurface->BasisCurve();
|
||||
Standard_Integer aIntervalsNb = aCurve->NbIntervals(theContinuity);
|
||||
if (aIntervalsNb == 1)
|
||||
{
|
||||
const GeomAbs_CurveType aCurveType = aCurve->GetType();
|
||||
const Standard_Boolean isBSplineCurve =
|
||||
aCurveType == GeomAbs_BezierCurve ||
|
||||
aCurveType == GeomAbs_BSplineCurve;
|
||||
|
||||
if (isBSplineCurve)
|
||||
{
|
||||
aIntervalsNb = aCurve->NbPoles() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
return aIntervalsNb;
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
// Created on: 2022-09-07
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// 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 _BRepMesh_ExtrusionRangeSplitter_HeaderFile
|
||||
#define _BRepMesh_ExtrusionRangeSplitter_HeaderFile
|
||||
|
||||
#include <BRepMesh_NURBSRangeSplitter.hxx>
|
||||
|
||||
//! Auxiliary class analysing extrusion surface in order to generate internal nodes.
|
||||
class BRepMesh_ExtrusionRangeSplitter : public BRepMesh_NURBSRangeSplitter
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
BRepMesh_ExtrusionRangeSplitter()
|
||||
{
|
||||
}
|
||||
|
||||
//! Destructor.
|
||||
virtual ~BRepMesh_ExtrusionRangeSplitter()
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//! Returns number of intervals computed using available geometrical parameters.
|
||||
Standard_EXPORT virtual Standard_Integer getUndefinedIntervalNb(
|
||||
const Handle(Adaptor3d_Surface)& theSurface,
|
||||
const Standard_Boolean isU,
|
||||
const GeomAbs_Shape theContinuity) const Standard_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
@@ -21,8 +21,6 @@
|
||||
#include <BRepMesh_DelaunayBaseMeshAlgo.hxx>
|
||||
#include <BRepMesh_DelaunayDeflectionControlMeshAlgo.hxx>
|
||||
#include <BRepMesh_BoundaryParamsRangeSplitter.hxx>
|
||||
#include <BRepMesh_ExtrusionRangeSplitter.hxx>
|
||||
#include <BRepMesh_UndefinedRangeSplitter.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_MeshAlgoFactory, IMeshTools_MeshAlgoFactory)
|
||||
|
||||
@@ -73,55 +71,34 @@ Handle(IMeshTools_MeshAlgo) BRepMesh_MeshAlgoFactory::GetAlgo(
|
||||
switch (theSurfaceType)
|
||||
{
|
||||
case GeomAbs_Plane:
|
||||
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
|
||||
new DeflectionControlMeshAlgo<BRepMesh_DefaultRangeSplitter>::Type :
|
||||
(theParameters.InternalVerticesMode ?
|
||||
new NodeInsertionMeshAlgo<BRepMesh_DefaultRangeSplitter>::Type :
|
||||
new BaseMeshAlgo::Type);
|
||||
return theParameters.InternalVerticesMode ?
|
||||
new NodeInsertionMeshAlgo<BRepMesh_DefaultRangeSplitter>::Type :
|
||||
new BaseMeshAlgo::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_Sphere:
|
||||
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
|
||||
new DeflectionControlMeshAlgo<BRepMesh_SphereRangeSplitter>::Type :
|
||||
new NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type;
|
||||
return new NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_Cylinder:
|
||||
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
|
||||
new DeflectionControlMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
|
||||
(theParameters.InternalVerticesMode ?
|
||||
new NodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
|
||||
new BaseMeshAlgo::Type);
|
||||
return theParameters.InternalVerticesMode ?
|
||||
new NodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
|
||||
new BaseMeshAlgo::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_Cone:
|
||||
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
|
||||
new DeflectionControlMeshAlgo<BRepMesh_ConeRangeSplitter>::Type :
|
||||
new NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type;
|
||||
return new NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_Torus:
|
||||
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
|
||||
new DeflectionControlMeshAlgo<BRepMesh_TorusRangeSplitter>::Type :
|
||||
new NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type;
|
||||
return new NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_SurfaceOfRevolution:
|
||||
return new DeflectionControlMeshAlgo<BRepMesh_BoundaryParamsRangeSplitter>::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_SurfaceOfExtrusion:
|
||||
return new DeflectionControlMeshAlgo<BRepMesh_ExtrusionRangeSplitter>::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_BezierSurface:
|
||||
case GeomAbs_BSplineSurface:
|
||||
return new DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_OffsetSurface:
|
||||
case GeomAbs_OtherSurface:
|
||||
default:
|
||||
return new DeflectionControlMeshAlgo<BRepMesh_UndefinedRangeSplitter>::Type;
|
||||
return new DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type;
|
||||
}
|
||||
}
|
||||
|
@@ -50,32 +50,14 @@ namespace
|
||||
void operator()(const IMeshData::IEdgePtr& theDEdge) const
|
||||
{
|
||||
const IMeshData::IEdgeHandle aDEdge = theDEdge;
|
||||
|
||||
Standard_Integer aPointsNb = aDEdge->GetCurve()->ParametersNb();
|
||||
|
||||
aDEdge->Clear(Standard_True);
|
||||
aDEdge->SetDeflection(Max(aDEdge->GetDeflection() / 3., Precision::Confusion()));
|
||||
|
||||
for (Standard_Integer aPCurveIt = 0; aPCurveIt < aDEdge->PCurvesNb(); ++aPCurveIt)
|
||||
{
|
||||
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve(aPCurveIt);
|
||||
const IMeshData::IFaceHandle aDFace = aPCurve->GetFace();
|
||||
|
||||
// Check that outer wire contains 2 edges or less and add an additional point.
|
||||
const IMeshData::IWireHandle& aDWire = aDFace->GetWire(0);
|
||||
if (aDWire->EdgesNb() <= 2)
|
||||
{
|
||||
++aPointsNb;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve(0);
|
||||
const IMeshData::IFaceHandle aDFace = aPCurve->GetFace();
|
||||
Handle(IMeshTools_CurveTessellator) aTessellator =
|
||||
BRepMesh_EdgeDiscret::CreateEdgeTessellator(
|
||||
aDEdge, aPCurve->GetOrientation(), aDFace,
|
||||
myParameters, aPointsNb);
|
||||
aDEdge, aPCurve->GetOrientation(), aDFace, myParameters);
|
||||
|
||||
BRepMesh_EdgeDiscret::Tessellate3d(aDEdge, aTessellator, Standard_False);
|
||||
BRepMesh_EdgeDiscret::Tessellate2d(aDEdge, Standard_False);
|
||||
|
@@ -392,73 +392,27 @@ Handle(IMeshData::ListOfPnt2d) BRepMesh_NURBSRangeSplitter::GenerateSurfaceNodes
|
||||
return aNodes;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: getUndefinedIntervalNb
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_NURBSRangeSplitter::getUndefinedIntervalNb(
|
||||
const Handle(Adaptor3d_Surface)& theSurface,
|
||||
const Standard_Boolean isU,
|
||||
const GeomAbs_Shape /*theContinuity*/) const
|
||||
{
|
||||
return (isU ? theSurface->NbUPoles() : theSurface->NbVPoles()) - 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: getUndefinedInterval
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_NURBSRangeSplitter::getUndefinedInterval(
|
||||
const Handle(Adaptor3d_Surface)& theSurface,
|
||||
const Standard_Boolean isU,
|
||||
const GeomAbs_Shape theContinuity,
|
||||
const std::pair<Standard_Real, Standard_Real>& theRange,
|
||||
TColStd_Array1OfReal& theIntervals) const
|
||||
{
|
||||
Standard_Integer aIntervalsNb = isU ?
|
||||
theSurface->NbUIntervals(theContinuity) :
|
||||
theSurface->NbVIntervals(theContinuity);
|
||||
|
||||
if (aIntervalsNb == 1)
|
||||
{
|
||||
aIntervalsNb = getUndefinedIntervalNb(theSurface, isU, theContinuity);
|
||||
if (aIntervalsNb > 1)
|
||||
{
|
||||
theIntervals = TColStd_Array1OfReal(1, aIntervalsNb - 1);
|
||||
const Standard_Real aDiff = (theRange.second - theRange.first) / aIntervalsNb;
|
||||
for (Standard_Integer i = theIntervals.Lower(); i <= theIntervals.Upper(); ++i)
|
||||
{
|
||||
theIntervals.SetValue(i, theRange.first + i * aDiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (theIntervals.IsEmpty())
|
||||
{
|
||||
theIntervals = TColStd_Array1OfReal(1, aIntervalsNb + 1);
|
||||
if (isU)
|
||||
{
|
||||
theSurface->UIntervals(theIntervals, theContinuity);
|
||||
}
|
||||
else
|
||||
{
|
||||
theSurface->VIntervals(theIntervals, theContinuity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: initParameters
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_NURBSRangeSplitter::initParameters() const
|
||||
{
|
||||
const GeomAbs_Shape aContinuity = GeomAbs_CN;
|
||||
const Handle(BRepAdaptor_Surface)& aSurface = GetSurface();
|
||||
|
||||
TColStd_Array1OfReal aIntervals[2];
|
||||
getUndefinedInterval(aSurface, Standard_True, aContinuity, GetRangeU(), aIntervals[0]);
|
||||
getUndefinedInterval(aSurface, Standard_False, aContinuity, GetRangeV(), aIntervals[1]);
|
||||
const GeomAbs_Shape aContinuity = GeomAbs_CN;
|
||||
const std::pair<Standard_Integer, Standard_Integer> aIntervalsNb(
|
||||
aSurface->NbUIntervals(aContinuity),
|
||||
aSurface->NbVIntervals(aContinuity)
|
||||
);
|
||||
|
||||
TColStd_Array1OfReal aIntervals[2] = {
|
||||
TColStd_Array1OfReal(1, aIntervalsNb.first + 1),
|
||||
TColStd_Array1OfReal(1, aIntervalsNb.second + 1)
|
||||
};
|
||||
|
||||
aSurface->UIntervals(aIntervals[0], aContinuity);
|
||||
aSurface->VIntervals(aIntervals[1], aContinuity);
|
||||
|
||||
const Standard_Boolean isSplitIntervals = toSplitIntervals (aSurface->Surface().Surface(), aIntervals);
|
||||
|
||||
@@ -553,17 +507,12 @@ Handle(IMeshData::SequenceOfReal) BRepMesh_NURBSRangeSplitter::computeGrainAndFi
|
||||
aMinDiff /= theDelta;
|
||||
}
|
||||
|
||||
const Handle(BRepAdaptor_Surface)& aSurface = GetSurface();
|
||||
const Standard_Real aMinSize2d = Max(
|
||||
aSurface->UResolution(theParameters.MinSize),
|
||||
aSurface->VResolution(theParameters.MinSize));
|
||||
|
||||
aMinDiff = Max(aMinSize2d, aMinDiff);
|
||||
aMinDiff = Max(theParameters.MinSize, aMinDiff);
|
||||
|
||||
const Standard_Real aDiffMaxLim = 0.1 * theRangeDiff;
|
||||
const Standard_Real aDiffMinLim = Max(0.005 * theRangeDiff,
|
||||
2. * theTol2d);
|
||||
const Standard_Real aDiff = Max(aMinSize2d,
|
||||
const Standard_Real aDiff = Max(theParameters.MinSize,
|
||||
Min(aDiffMaxLim, aDiffMinLim));
|
||||
return filterParameters(theSourceParams, aMinDiff, aDiff, theAllocator);
|
||||
}
|
||||
|
@@ -49,21 +49,7 @@ protected:
|
||||
//! Initializes U and V parameters lists using CN continuity intervals.
|
||||
Standard_EXPORT virtual Standard_Boolean initParameters() const;
|
||||
|
||||
//! Returns number of intervals computed using available geometrical parameters.
|
||||
Standard_EXPORT virtual Standard_Integer getUndefinedIntervalNb(
|
||||
const Handle(Adaptor3d_Surface)& theSurface,
|
||||
const Standard_Boolean isU,
|
||||
const GeomAbs_Shape theContinuity) const;
|
||||
|
||||
private:
|
||||
//! Tries to compute intervals even for cases with no intervals
|
||||
//! at all using available geometrical parameters.
|
||||
void getUndefinedInterval(
|
||||
const Handle(Adaptor3d_Surface)& theSurface,
|
||||
const Standard_Boolean isU,
|
||||
const GeomAbs_Shape theContinuity,
|
||||
const std::pair<Standard_Real, Standard_Real>& theRange,
|
||||
TColStd_Array1OfReal& theIntervals) const;
|
||||
|
||||
//! Computes parameters of filter and applies it to the source parameters.
|
||||
Handle(IMeshData::SequenceOfReal) computeGrainAndFilterParameters(
|
||||
|
@@ -1,28 +0,0 @@
|
||||
// Created on: 2022-09-07
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// 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 <BRepMesh_UndefinedRangeSplitter.hxx>
|
||||
|
||||
//=======================================================================
|
||||
// Function: getUndefinedIntervalNb
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_UndefinedRangeSplitter::getUndefinedIntervalNb(
|
||||
const Handle(Adaptor3d_Surface)& /*theSurface*/,
|
||||
const Standard_Boolean /*isU*/,
|
||||
const GeomAbs_Shape /*theContinuity*/) const
|
||||
{
|
||||
return 1;
|
||||
}
|
@@ -1,46 +0,0 @@
|
||||
// Created on: 2022-09-07
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// 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 _BRepMesh_UndefinedRangeSplitter_HeaderFile
|
||||
#define _BRepMesh_UndefinedRangeSplitter_HeaderFile
|
||||
|
||||
#include <BRepMesh_NURBSRangeSplitter.hxx>
|
||||
|
||||
//! Auxiliary class provides safe value for surfaces that looks like NURBS
|
||||
//! but has no poles or other characteristics.
|
||||
class BRepMesh_UndefinedRangeSplitter : public BRepMesh_NURBSRangeSplitter
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
BRepMesh_UndefinedRangeSplitter()
|
||||
{
|
||||
}
|
||||
|
||||
//! Destructor.
|
||||
virtual ~BRepMesh_UndefinedRangeSplitter()
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//! Returns number of intervals computed using available geometrical parameters.
|
||||
Standard_EXPORT virtual Standard_Integer getUndefinedIntervalNb(
|
||||
const Handle(Adaptor3d_Surface)& theSurface,
|
||||
const Standard_Boolean isU,
|
||||
const GeomAbs_Shape theContinuity) const Standard_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
@@ -40,8 +40,6 @@ BRepMesh_EdgeDiscret.hxx
|
||||
BRepMesh_EdgeParameterProvider.hxx
|
||||
BRepMesh_EdgeTessellationExtractor.cxx
|
||||
BRepMesh_EdgeTessellationExtractor.hxx
|
||||
BRepMesh_ExtrusionRangeSplitter.cxx
|
||||
BRepMesh_ExtrusionRangeSplitter.hxx
|
||||
BRepMesh_FaceChecker.cxx
|
||||
BRepMesh_FaceChecker.hxx
|
||||
BRepMesh_FaceDiscret.cxx
|
||||
@@ -82,8 +80,6 @@ BRepMesh_SphereRangeSplitter.hxx
|
||||
BRepMesh_TorusRangeSplitter.cxx
|
||||
BRepMesh_TorusRangeSplitter.hxx
|
||||
BRepMesh_Triangle.hxx
|
||||
BRepMesh_UndefinedRangeSplitter.cxx
|
||||
BRepMesh_UndefinedRangeSplitter.hxx
|
||||
BRepMesh_UVParamRangeSplitter.hxx
|
||||
BRepMesh_Vertex.hxx
|
||||
BRepMesh_VertexInspector.hxx
|
||||
|
@@ -336,10 +336,8 @@ static BRepOffset_Error checkSinglePoint(const Standard_Real theUParam,
|
||||
const NCollection_Vector<gp_Pnt>& theBadPoints);
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
static void UpdateTolerance ( TopoDS_Shape& theShape,
|
||||
const TopTools_IndexedMapOfShape& theFaces,
|
||||
const TopoDS_Shape& theInitShape);
|
||||
|
||||
static void UpdateTolerance ( TopoDS_Shape& myShape,
|
||||
const TopTools_IndexedMapOfShape& myFaces);
|
||||
static Standard_Real ComputeMaxDist(const gp_Pln& thePlane,
|
||||
const Handle(Geom_Curve)& theCrv,
|
||||
const Standard_Real theFirst,
|
||||
@@ -1038,16 +1036,8 @@ void BRepOffset_MakeOffset::MakeOffsetShape(const Message_ProgressRange& theRang
|
||||
// MAJ Tolerance edge and Vertex
|
||||
// ----------------------------
|
||||
if (!myOffsetShape.IsNull()) {
|
||||
if (myThickening)
|
||||
{
|
||||
UpdateTolerance(myOffsetShape, myFaces, myShape);
|
||||
}
|
||||
else
|
||||
{
|
||||
TopoDS_Shape aDummy;
|
||||
UpdateTolerance(myOffsetShape, myFaces, aDummy);
|
||||
}
|
||||
BRepLib::UpdateTolerances(myOffsetShape);
|
||||
UpdateTolerance (myOffsetShape,myFaces);
|
||||
BRepLib::UpdateTolerances( myOffsetShape );
|
||||
}
|
||||
|
||||
CorrectConicalFaces();
|
||||
@@ -3175,38 +3165,13 @@ void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRa
|
||||
} //if both edges are arcs of circles
|
||||
if (NewFace.IsNull())
|
||||
{
|
||||
Standard_Real anEdgeTol = BRep_Tool::Tolerance(anEdge);
|
||||
//Tolerances of input shape should not be increased by BRepLib_MakeFace
|
||||
BRepLib_FindSurface aFindPlane(theWire, anEdgeTol, Standard_True); //only plane
|
||||
IsPlanar = Standard_False;
|
||||
if(aFindPlane.Found() && aFindPlane.ToleranceReached() <= anEdgeTol)
|
||||
BRepLib_MakeFace MF(theWire, Standard_True); //Only plane
|
||||
if (MF.Error() == BRepLib_FaceDone)
|
||||
{
|
||||
Standard_Real f, l;
|
||||
Handle(Geom_Curve) aGC = BRep_Tool::Curve(anEdge, f, l);
|
||||
Handle(Geom_Plane) aPln = Handle(Geom_Plane)::DownCast(aFindPlane.Surface());
|
||||
Standard_Real aMaxDist = ComputeMaxDist(aPln->Pln(), aGC, f, l);
|
||||
if (aMaxDist <= anEdgeTol)
|
||||
{
|
||||
BRepLib_MakeFace MF(aPln->Pln(), theWire);
|
||||
if (MF.IsDone())
|
||||
{
|
||||
NewFace = MF.Face();
|
||||
TopoDS_Iterator anItE(theWire);
|
||||
for (; anItE.More(); anItE.Next())
|
||||
{
|
||||
const TopoDS_Edge& anE = TopoDS::Edge(anItE.Value());
|
||||
if (anE.IsSame(anEdge))
|
||||
continue;
|
||||
aGC = BRep_Tool::Curve(anE, f, l);
|
||||
aMaxDist = ComputeMaxDist(aPln->Pln(), aGC, f, l);
|
||||
BB.UpdateEdge(anE, aMaxDist);
|
||||
}
|
||||
IsPlanar = Standard_True;
|
||||
}
|
||||
}
|
||||
NewFace = MF.Face();
|
||||
IsPlanar = Standard_True;
|
||||
}
|
||||
//
|
||||
if(!IsPlanar) //Extrusion (by thrusections)
|
||||
else //Extrusion (by thrusections)
|
||||
{
|
||||
Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(anEdge, fpar, lpar);
|
||||
Handle(Geom_TrimmedCurve) TrEdgeCurve =
|
||||
@@ -3220,6 +3185,7 @@ void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRa
|
||||
ThrusecGenerator.AddCurve( TrOffsetCurve );
|
||||
ThrusecGenerator.Perform( Precision::PConfusion() );
|
||||
theSurf = ThrusecGenerator.Surface();
|
||||
//theSurf = new Geom_SurfaceOfLinearExtrusion( TrOffsetCurve, OffsetDir );
|
||||
Standard_Real Uf, Ul, Vf, Vl;
|
||||
theSurf->Bounds(Uf, Ul, Vf, Vl);
|
||||
TopLoc_Location Loc;
|
||||
@@ -3306,14 +3272,8 @@ void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRa
|
||||
BB.Range( anE3, FirstPar, LastPar );
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsPlanar)
|
||||
{
|
||||
// For planar faces these operations are useless,
|
||||
// because there are no curves on surface
|
||||
BRepLib::SameParameter(NewFace);
|
||||
BRepTools::Update(NewFace);
|
||||
}
|
||||
BRepLib::SameParameter(NewFace);
|
||||
BRepTools::Update(NewFace);
|
||||
//Check orientation
|
||||
TopAbs_Orientation anOr = OrientationOfEdgeInFace(anEdge, aFaceOfEdge);
|
||||
TopAbs_Orientation OrInNewFace = OrientationOfEdgeInFace(anEdge, NewFace);
|
||||
@@ -3821,7 +3781,6 @@ void BRepOffset_MakeOffset::EncodeRegularity ()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeMaxDist
|
||||
//purpose :
|
||||
@@ -3848,15 +3807,13 @@ Standard_Real ComputeMaxDist(const gp_Pln& thePlane,
|
||||
}
|
||||
return sqrt(aMaxDist)*1.05;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateTolerance
|
||||
//function : UpDateTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void UpdateTolerance (TopoDS_Shape& S,
|
||||
const TopTools_IndexedMapOfShape& Faces,
|
||||
const TopoDS_Shape& theInitShape)
|
||||
const TopTools_IndexedMapOfShape& Faces)
|
||||
{
|
||||
BRep_Builder B;
|
||||
TopTools_MapOfShape View;
|
||||
@@ -3872,31 +3829,12 @@ void UpdateTolerance (TopoDS_Shape& S,
|
||||
}
|
||||
}
|
||||
|
||||
// The edges of initial shape are not modified
|
||||
TopTools_MapOfShape aMapInitF;
|
||||
if (!theInitShape.IsNull())
|
||||
{
|
||||
TopExp_Explorer anExpF(theInitShape, TopAbs_FACE);
|
||||
for (; anExpF.More(); anExpF.Next()) {
|
||||
aMapInitF.Add(anExpF.Current());
|
||||
TopExp_Explorer anExpE;
|
||||
for (anExpE.Init(anExpF.Current(), TopAbs_EDGE); anExpE.More(); anExpE.Next()) {
|
||||
View.Add(anExpE.Current());
|
||||
TopoDS_Iterator anItV(anExpE.Current());
|
||||
for (; anItV.More(); anItV.Next())
|
||||
{
|
||||
View.Add(anItV.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real Tol;
|
||||
TopExp_Explorer anExpF(S, TopAbs_FACE);
|
||||
for (; anExpF.More(); anExpF.Next())
|
||||
TopExp_Explorer ExpF;
|
||||
for (ExpF.Init(S, TopAbs_FACE); ExpF.More(); ExpF.Next())
|
||||
{
|
||||
const TopoDS_Shape& F = anExpF.Current();
|
||||
if (Faces.Contains(F) || aMapInitF.Contains(F))
|
||||
const TopoDS_Shape& F = ExpF.Current();
|
||||
if (Faces.Contains(F))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -3905,7 +3843,6 @@ void UpdateTolerance (TopoDS_Shape& S,
|
||||
for (Exp.Init(F, TopAbs_EDGE); Exp.More(); Exp.Next()) {
|
||||
TopoDS_Edge E = TopoDS::Edge(Exp.Current());
|
||||
Standard_Boolean isUpdated = Standard_False;
|
||||
Standard_Real aCurrTol = BRep_Tool::Tolerance(E);
|
||||
if (aBAS.GetType() == GeomAbs_Plane)
|
||||
{
|
||||
//Edge does not seem to have pcurve on plane,
|
||||
@@ -3913,22 +3850,17 @@ void UpdateTolerance (TopoDS_Shape& S,
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom_Curve) aCrv = BRep_Tool::Curve(E, aFirst, aLast);
|
||||
Standard_Real aMaxDist = ComputeMaxDist(aBAS.Plane(), aCrv, aFirst, aLast);
|
||||
if (aMaxDist > aCurrTol)
|
||||
{
|
||||
B.UpdateEdge(E, aMaxDist);
|
||||
isUpdated = Standard_True;
|
||||
}
|
||||
E.Locked (Standard_False);
|
||||
B.UpdateEdge(E, aMaxDist);
|
||||
isUpdated = Standard_True;
|
||||
}
|
||||
if (View.Add(E))
|
||||
{
|
||||
E.Locked(Standard_False);
|
||||
|
||||
BRepCheck_Edge EdgeCorrector(E);
|
||||
Tol = EdgeCorrector.Tolerance();
|
||||
if (Tol > aCurrTol)
|
||||
{
|
||||
B.UpdateEdge(E, Tol);
|
||||
isUpdated = Standard_True;
|
||||
}
|
||||
B.UpdateEdge(E, Tol);
|
||||
isUpdated = Standard_True;
|
||||
}
|
||||
if (isUpdated)
|
||||
{
|
||||
@@ -3937,11 +3869,11 @@ void UpdateTolerance (TopoDS_Shape& S,
|
||||
TopExp::Vertices(E, V[0], V[1]);
|
||||
|
||||
for (Standard_Integer i = 0; i <= 1; i++) {
|
||||
V[i].Locked(Standard_False);
|
||||
if (View.Add(V[i])) {
|
||||
Handle(BRep_TVertex) TV = Handle(BRep_TVertex)::DownCast(V[i].TShape());
|
||||
TV->Tolerance(0.);
|
||||
BRepCheck_Vertex VertexCorrector(V[i]);
|
||||
V[i].Locked (Standard_False);
|
||||
B.UpdateVertex(V[i], VertexCorrector.Tolerance());
|
||||
// use the occasion to clean the vertices.
|
||||
(TV->ChangePoints()).Clear();
|
||||
@@ -5021,53 +4953,6 @@ Standard_Boolean BRepOffset_MakeOffset::IsPlanar()
|
||||
if (aPlanarityChecker.IsPlanar())
|
||||
{
|
||||
gp_Pln aPln = aPlanarityChecker.Plan();
|
||||
Standard_Real u1, u2, v1, v2, um, vm;
|
||||
aSurf->Bounds(u1, u2, v1, v2);
|
||||
Standard_Boolean isInf1 = Precision::IsInfinite(u1), isInf2 = Precision::IsInfinite(u2);
|
||||
if (!isInf1 && !isInf2)
|
||||
{
|
||||
um = (u1 + u2) / 2.;
|
||||
}
|
||||
else if(isInf1 && !isInf2)
|
||||
{
|
||||
um = u2 - 1.;
|
||||
}
|
||||
else if(!isInf1 && isInf2)
|
||||
{
|
||||
um = u1 + 1.;
|
||||
}
|
||||
else //isInf1 && isInf2
|
||||
{
|
||||
um = 0.;
|
||||
}
|
||||
isInf1 = Precision::IsInfinite(v1), isInf2 = Precision::IsInfinite(v2);
|
||||
if (!isInf1 && !isInf2)
|
||||
{
|
||||
vm = (v1 + v2) / 2.;
|
||||
}
|
||||
else if (isInf1 && !isInf2)
|
||||
{
|
||||
vm = v2 - 1.;
|
||||
}
|
||||
else if(!isInf1 && isInf2)
|
||||
{
|
||||
vm = v1 + 1.;
|
||||
}
|
||||
else //isInf1 && isInf2
|
||||
{
|
||||
vm = 0.;
|
||||
}
|
||||
gp_Pnt aP;
|
||||
gp_Vec aD1, aD2;
|
||||
aBAS.D1(um, vm, aP, aD1, aD2);
|
||||
gp_Vec aNorm = aD1.Crossed(aD2);
|
||||
gp_Dir aPlnNorm = aPln.Position().Direction();
|
||||
if (aNorm.Dot(aPlnNorm) < 0.)
|
||||
{
|
||||
aPlnNorm.Reverse();
|
||||
gp_Ax1 anAx(aPln.Position().Location(), aPlnNorm);
|
||||
aPln.SetAxis(anAx);
|
||||
}
|
||||
Handle(Geom_Plane) aPlane = new Geom_Plane(aPln);
|
||||
TopoDS_Face aPlanarFace;
|
||||
aBB.MakeFace(aPlanarFace, aPlane, aTolForFace);
|
||||
|
@@ -17,12 +17,9 @@
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepAlgo.hxx>
|
||||
#include <BRepAlgo_FaceRestrictor.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
#include <BRepOffsetAPI_MakeOffset.hxx>
|
||||
#include <BRepTopAdaptor_FClass2d.hxx>
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
@@ -44,50 +41,6 @@
|
||||
static Standard_Boolean AffichSpine = Standard_False;
|
||||
#endif
|
||||
|
||||
static Standard_Boolean NeedsConvertion (const TopoDS_Wire& theWire)
|
||||
{
|
||||
TopoDS_Iterator anIter (theWire);
|
||||
for (; anIter.More(); anIter.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (anIter.Value());
|
||||
BRepAdaptor_Curve aBAcurve (anEdge);
|
||||
GeomAbs_CurveType aType = aBAcurve.GetType();
|
||||
if (aType != GeomAbs_Line &&
|
||||
aType != GeomAbs_Circle)
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopoDS_Face BRepOffsetAPI_MakeOffset::ConvertFace (const TopoDS_Face& theFace,
|
||||
const Standard_Real theAngleTolerance)
|
||||
{
|
||||
TopAbs_Orientation anOr = theFace.Orientation();
|
||||
TopoDS_Face aFace = theFace;
|
||||
aFace.Orientation (TopAbs_FORWARD);
|
||||
|
||||
TopoDS_Face aNewFace = TopoDS::Face (aFace.EmptyCopied());
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Iterator anIter (aFace);
|
||||
for (; anIter.More(); anIter.Next())
|
||||
{
|
||||
TopoDS_Wire aWire = TopoDS::Wire (anIter.Value());
|
||||
if (NeedsConvertion (aWire))
|
||||
{
|
||||
TopAbs_Orientation anOrOfWire = aWire.Orientation();
|
||||
aWire.Orientation (TopAbs_FORWARD);
|
||||
aWire = BRepAlgo::ConvertWire (aWire, theAngleTolerance, aFace);
|
||||
BRepLib::BuildCurves3d (aWire);
|
||||
aWire.Orientation (anOrOfWire);
|
||||
}
|
||||
aBB.Add (aNewFace, aWire);
|
||||
}
|
||||
aNewFace.Orientation (anOr);
|
||||
|
||||
return aNewFace;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepOffsetAPI_MakeOffset
|
||||
//purpose :
|
||||
@@ -96,8 +49,7 @@ TopoDS_Face BRepOffsetAPI_MakeOffset::ConvertFace (const TopoDS_Face& theFace,
|
||||
BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset()
|
||||
: myIsInitialized( Standard_False),
|
||||
myJoin(GeomAbs_Arc),
|
||||
myIsOpenResult(Standard_False),
|
||||
myIsToApprox(Standard_False)
|
||||
myIsOpenResult(Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -128,7 +80,6 @@ void BRepOffsetAPI_MakeOffset::Init(const TopoDS_Face& Spine,
|
||||
myIsInitialized = Standard_True;
|
||||
myJoin = Join;
|
||||
myIsOpenResult = IsOpenResult;
|
||||
myIsToApprox = Standard_False;
|
||||
TopExp_Explorer exp;
|
||||
for (exp.Init(myFace,TopAbs_WIRE); exp.More();exp.Next()) {
|
||||
myWires.Append(exp.Current());
|
||||
@@ -148,7 +99,6 @@ BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Wire& Spine,
|
||||
myIsInitialized = Standard_True;
|
||||
myJoin = Join;
|
||||
myIsOpenResult = IsOpenResult;
|
||||
myIsToApprox = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -163,18 +113,6 @@ void BRepOffsetAPI_MakeOffset::Init(const GeomAbs_JoinType Join,
|
||||
myIsOpenResult = IsOpenResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetApprox
|
||||
//purpose : Set approximation flag
|
||||
// for convertion input contours into ones consisting of
|
||||
// 2D circular arcs and 2D linear segments only
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffsetAPI_MakeOffset::SetApprox(const Standard_Boolean ToApprox)
|
||||
{
|
||||
myIsToApprox = ToApprox;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepOffsetAPI_MakeOffset
|
||||
//purpose :
|
||||
@@ -351,46 +289,6 @@ void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset,
|
||||
|
||||
try
|
||||
{
|
||||
if (myIsToApprox)
|
||||
{
|
||||
Standard_Real aTol = 0.1;
|
||||
if (myFace.IsNull())
|
||||
{
|
||||
TopoDS_Face aFace;
|
||||
Standard_Boolean OnlyPlane = Standard_True;
|
||||
TopTools_ListIteratorOfListOfShape anItl (myWires);
|
||||
for (; anItl.More(); anItl.Next())
|
||||
{
|
||||
BRepBuilderAPI_MakeFace aFaceMaker (TopoDS::Wire(anItl.Value()), OnlyPlane);
|
||||
if (aFaceMaker.Error() == BRepBuilderAPI_FaceDone)
|
||||
{
|
||||
aFace = aFaceMaker.Face();
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (anItl.Initialize(myWires); anItl.More(); anItl.Next())
|
||||
{
|
||||
const TopoDS_Wire& aWire = TopoDS::Wire(anItl.Value());
|
||||
if (NeedsConvertion (aWire))
|
||||
{
|
||||
TopoDS_Wire aNewWire = BRepAlgo::ConvertWire (aWire, aTol, aFace);
|
||||
BRepLib::BuildCurves3d (aNewWire);
|
||||
aNewWire.Orientation (aWire.Orientation());
|
||||
anItl.ChangeValue() = aNewWire;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myFace = ConvertFace (myFace, aTol);
|
||||
BRepLib::BuildCurves3d (myFace);
|
||||
myWires.Clear();
|
||||
TopoDS_Iterator anIter (myFace);
|
||||
for (; anIter.More(); anIter.Next())
|
||||
myWires.Append (anIter.Value());
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer i = 1;
|
||||
BRepFill_ListIteratorOfListOfOffsetWire itOW;
|
||||
TopoDS_Compound Res;
|
||||
|
@@ -63,11 +63,6 @@ public:
|
||||
//! Initialize the evaluation of Offsetting.
|
||||
Standard_EXPORT void Init (const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean IsOpenResult = Standard_False);
|
||||
|
||||
//! Set approximation flag
|
||||
//! for convertion input contours into ones consisting of
|
||||
//! 2D circular arcs and 2D linear segments only.
|
||||
Standard_EXPORT void SetApprox (const Standard_Boolean ToApprox);
|
||||
|
||||
//! Initializes the algorithm to construct parallels to the wire Spine.
|
||||
Standard_EXPORT void AddWire (const TopoDS_Wire& Spine);
|
||||
|
||||
@@ -84,10 +79,7 @@ public:
|
||||
//! from the shape <S>.
|
||||
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
|
||||
|
||||
//! Converts each wire of the face into contour consisting only of
|
||||
//! arcs and segments. New 3D curves are built too.
|
||||
Standard_EXPORT static TopoDS_Face ConvertFace (const TopoDS_Face& theFace,
|
||||
const Standard_Real theAngleTolerance);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
@@ -104,7 +96,6 @@ private:
|
||||
Standard_Boolean myLastIsLeft;
|
||||
GeomAbs_JoinType myJoin;
|
||||
Standard_Boolean myIsOpenResult;
|
||||
Standard_Boolean myIsToApprox;
|
||||
TopoDS_Face myFace;
|
||||
TopTools_ListOfShape myWires;
|
||||
BRepFill_ListOfOffsetWire myLeft;
|
||||
|
@@ -1530,23 +1530,10 @@ Standard_Integer mkoffset(Draw_Interpretor& di,
|
||||
char name[100];
|
||||
|
||||
BRepOffsetAPI_MakeOffset Paral;
|
||||
|
||||
Standard_Boolean ToApprox = Standard_False;
|
||||
GeomAbs_JoinType theJoinType = GeomAbs_Arc;
|
||||
|
||||
Standard_Integer anIndArg = 6;
|
||||
if (n >= 6)
|
||||
{
|
||||
if (strcmp(a[5], "-approx") == 0)
|
||||
{
|
||||
ToApprox = Standard_True;
|
||||
anIndArg++;
|
||||
}
|
||||
|
||||
if (n >= anIndArg && strcmp(a[anIndArg-1], "i") == 0)
|
||||
theJoinType = GeomAbs_Intersection;
|
||||
}
|
||||
|
||||
if (n >= 6 && strcmp(a[5], "i") == 0)
|
||||
theJoinType = GeomAbs_Intersection;
|
||||
Paral.Init(theJoinType);
|
||||
TopoDS_Shape Base = DBRep::Get(a[2],TopAbs_FACE);
|
||||
|
||||
if ( Base.IsNull())
|
||||
@@ -1566,7 +1553,6 @@ Standard_Integer mkoffset(Draw_Interpretor& di,
|
||||
Base.Orientation(TopAbs_FORWARD);
|
||||
Paral.Init(TopoDS::Face(Base), theJoinType);
|
||||
}
|
||||
Paral.SetApprox (ToApprox);
|
||||
|
||||
Standard_Real U, dU;
|
||||
Standard_Integer Nb;
|
||||
@@ -1574,8 +1560,8 @@ Standard_Integer mkoffset(Draw_Interpretor& di,
|
||||
Nb = Draw::Atoi(a[3]);
|
||||
|
||||
Standard_Real Alt = 0.;
|
||||
if (n > anIndArg)
|
||||
Alt = Draw::Atof(a[anIndArg]);
|
||||
if ( n == 7)
|
||||
Alt = Draw::Atof(a[6]);
|
||||
|
||||
Standard_Integer Compt = 1;
|
||||
|
||||
@@ -1612,30 +1598,16 @@ Standard_Integer openoffset(Draw_Interpretor& di,
|
||||
char name[100];
|
||||
|
||||
BRepOffsetAPI_MakeOffset Paral;
|
||||
|
||||
Standard_Boolean ToApprox = Standard_False;
|
||||
GeomAbs_JoinType theJoinType = GeomAbs_Arc;
|
||||
|
||||
Standard_Integer anIndArg = 6;
|
||||
if (n >= 6)
|
||||
{
|
||||
if (strcmp(a[5], "-approx") == 0)
|
||||
{
|
||||
ToApprox = Standard_True;
|
||||
anIndArg++;
|
||||
}
|
||||
|
||||
if (n >= anIndArg && strcmp(a[anIndArg-1], "i") == 0)
|
||||
theJoinType = GeomAbs_Intersection;
|
||||
}
|
||||
|
||||
if (n == 6 && strcmp(a[5], "i") == 0)
|
||||
theJoinType = GeomAbs_Intersection;
|
||||
Paral.Init(theJoinType, Standard_True);
|
||||
TopoDS_Shape Base = DBRep::Get(a[2] ,TopAbs_FACE);
|
||||
|
||||
if ( Base.IsNull())
|
||||
{
|
||||
Base = DBRep::Get(a[2], TopAbs_WIRE);
|
||||
if (Base.IsNull()) return 1;
|
||||
Paral.Init(theJoinType, Standard_True);
|
||||
Paral.AddWire(TopoDS::Wire(Base));
|
||||
}
|
||||
else
|
||||
@@ -1643,7 +1615,6 @@ Standard_Integer openoffset(Draw_Interpretor& di,
|
||||
Base.Orientation(TopAbs_FORWARD);
|
||||
Paral.Init(TopoDS::Face(Base), theJoinType, Standard_True);
|
||||
}
|
||||
Paral.SetApprox (ToApprox);
|
||||
|
||||
Standard_Real U, dU;
|
||||
Standard_Integer Nb;
|
||||
@@ -1784,72 +1755,6 @@ Standard_Integer edgeintersector(Draw_Interpretor& di,
|
||||
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
//function : arclinconvert
|
||||
//purpose : Convert a single face to a face with contour made of arcs and segments
|
||||
//=================================================================================
|
||||
|
||||
static Standard_Integer arclinconvert (Draw_Interpretor& /*dout*/, Standard_Integer n, const char** a)
|
||||
{
|
||||
// Check the command arguments
|
||||
if (n < 3) {
|
||||
std::cout<<"Error: "<<a[0]<<" - invalid number of arguments"<<std::endl;
|
||||
std::cout<<"Usage: type help "<<a[0]<<std::endl;
|
||||
return 1; //TCL_ERROR
|
||||
}
|
||||
|
||||
//read shape
|
||||
const TopoDS_Shape aShape = DBRep::Get(a[2]);
|
||||
if (aShape.IsNull()) {
|
||||
std::cout<<"Error: "<<a[2]<<" is null"<<std::endl;
|
||||
return 1; //TCL_ERROR
|
||||
}
|
||||
|
||||
TopAbs_ShapeEnum aType = aShape.ShapeType();
|
||||
if (aType != TopAbs_WIRE &&
|
||||
aType != TopAbs_FACE)
|
||||
{
|
||||
std::cout<<"Error: "<<a[2]<<" is neither wire no face"<<std::endl;
|
||||
return 1; //TCL_ERROR
|
||||
}
|
||||
|
||||
//read tolerance
|
||||
Standard_Real aTol = 0.01;
|
||||
if (n > 3)
|
||||
aTol = Draw::Atof(a[3]);
|
||||
std::cout<<"Info: tolerance is set to "<<aTol<<std::endl;
|
||||
|
||||
TopoDS_Shape aResult;
|
||||
|
||||
if (aType == TopAbs_WIRE)
|
||||
{
|
||||
Standard_Boolean OnlyPlane = Standard_False;
|
||||
BRepBuilderAPI_MakeFace aFaceMaker (TopoDS::Wire(aShape), OnlyPlane);
|
||||
if (aFaceMaker.Error() != BRepBuilderAPI_FaceDone)
|
||||
{
|
||||
std::cout<<"Error: failed to find a face for the wire "<<a[2]<<std::endl;
|
||||
return 1; //TCL_ERROR
|
||||
}
|
||||
TopoDS_Face aFace = aFaceMaker.Face();
|
||||
TopoDS_Iterator anIter (aFace);
|
||||
TopoDS_Wire aWire = TopoDS::Wire (anIter.Value());
|
||||
aResult = BRepAlgo::ConvertWire (aWire, aTol, aFace);
|
||||
}
|
||||
else if (aType == TopAbs_FACE)
|
||||
{
|
||||
TopoDS_Face aFace = TopoDS::Face(aShape);
|
||||
aResult = BRepAlgo::ConvertFace (aFace, aTol);
|
||||
}
|
||||
|
||||
if (aResult.IsNull()) {
|
||||
std::cout<<"Error: could not convert "<<a[2]<<std::endl;
|
||||
return 1; //TCL_ERROR
|
||||
}
|
||||
|
||||
DBRep::Set(a[1], aResult);
|
||||
return 0; //TCL_OK
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : concatC0wire
|
||||
//purpose :
|
||||
@@ -2003,11 +1908,11 @@ void BRepTest::CurveCommands(Draw_Interpretor& theCommands)
|
||||
profile2d,g);
|
||||
|
||||
theCommands.Add("mkoffset",
|
||||
"mkoffset result face/compound of wires nboffset stepoffset [-approx] [jointype(a/i) [alt]]",__FILE__,
|
||||
"mkoffset result face/compound of wires nboffset stepoffset [jointype(a/i) [alt]]",__FILE__,
|
||||
mkoffset,g);
|
||||
|
||||
theCommands.Add("openoffset",
|
||||
"openoffset result face/wire nboffset stepoffset [-approx] [jointype(a/i)]",__FILE__,
|
||||
"openoffset result face/wire nboffset stepoffset [jointype(a/i)]",__FILE__,
|
||||
openoffset,g);
|
||||
|
||||
theCommands.Add("mkedge",
|
||||
@@ -2063,12 +1968,6 @@ void BRepTest::CurveCommands(Draw_Interpretor& theCommands)
|
||||
"reducepcurves shape1 shape2 ...",__FILE__,
|
||||
reducepcurves, g);
|
||||
|
||||
theCommands.Add("arclinconvert",
|
||||
"arclinconvert result wire/face [tol]",
|
||||
__FILE__,
|
||||
arclinconvert,
|
||||
g);
|
||||
|
||||
theCommands.Add("concatC0wire",
|
||||
"concatC0wire result wire",
|
||||
__FILE__,
|
||||
|
@@ -173,7 +173,7 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
|
||||
{
|
||||
if (theNbArgs < 3 || theNbArgs > 6)
|
||||
{
|
||||
Message::SendFail() << "Usage: " << theArgs[0] << " Shape1 Shape2 [-tol <value> | -value] [-profile]";
|
||||
Message::SendFail() << "Usage: " << theArgs[0] << " Shape1 Shape2 [-tol <value>] [-profile]";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -186,11 +186,9 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
|
||||
return 1;
|
||||
}
|
||||
|
||||
BRepExtrema_ShapeProximity aTool(0.0);
|
||||
BRepExtrema_ShapeProximity aTool;
|
||||
|
||||
Standard_Boolean aProfile = Standard_False;
|
||||
Standard_Boolean isTolerance = Standard_False;
|
||||
Standard_Boolean isValue = Standard_False;
|
||||
|
||||
for (Standard_Integer anArgIdx = 3; anArgIdx < theNbArgs; ++anArgIdx)
|
||||
{
|
||||
@@ -199,7 +197,6 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
|
||||
|
||||
if (aFlag == "-tol")
|
||||
{
|
||||
isTolerance = Standard_True;
|
||||
if (++anArgIdx >= theNbArgs)
|
||||
{
|
||||
Message::SendFail() << "Error: wrong syntax at argument '" << aFlag;
|
||||
@@ -217,23 +214,13 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
|
||||
aTool.SetTolerance (aTolerance);
|
||||
}
|
||||
}
|
||||
else if (aFlag == "-value")
|
||||
{
|
||||
isValue = Standard_True;
|
||||
aTool.SetTolerance(Precision::Infinite());
|
||||
}
|
||||
else if (aFlag == "-profile")
|
||||
|
||||
if (aFlag == "-profile")
|
||||
{
|
||||
aProfile = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
if (isTolerance && isValue)
|
||||
{
|
||||
Message::SendFail() << "Error: Proximity value could not be computed if the tolerance is set";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Real aInitTime = 0.0;
|
||||
Standard_Real aWorkTime = 0.0;
|
||||
|
||||
@@ -277,74 +264,39 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
|
||||
theDI << "Executing proximity test: " << aWorkTime << "\n";
|
||||
}
|
||||
|
||||
if (isValue)
|
||||
TopoDS_Builder aCompBuilder;
|
||||
|
||||
TopoDS_Compound aFaceCompound1;
|
||||
aCompBuilder.MakeCompound (aFaceCompound1);
|
||||
|
||||
for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt1 (aTool.OverlapSubShapes1()); anIt1.More(); anIt1.Next())
|
||||
{
|
||||
theDI << "Proximity value: " << aTool.Proximity() << "\n";
|
||||
TCollection_AsciiString aStr = TCollection_AsciiString (theArgs[1]) + "_" + (anIt1.Key() + 1);
|
||||
|
||||
// proximity points
|
||||
TopoDS_Vertex aProxVtx1 = BRepLib_MakeVertex (aTool.ProximityPoint1());
|
||||
TopoDS_Vertex aProxVtx2 = BRepLib_MakeVertex (aTool.ProximityPoint2());
|
||||
const TopoDS_Face& aFace = aTool.GetSubShape1 (anIt1.Key());
|
||||
aCompBuilder.Add (aFaceCompound1, aFace);
|
||||
DBRep::Set (aStr.ToCString(), aFace);
|
||||
|
||||
DBRep::Set ("ProxPnt1", aProxVtx1);
|
||||
DBRep::Set ("ProxPnt2", aProxVtx2);
|
||||
|
||||
// proximity points' status
|
||||
TCollection_AsciiString ProxPntStatus1;
|
||||
TCollection_AsciiString ProxPntStatus2;
|
||||
|
||||
switch (aTool.ProxPntStatus1())
|
||||
{
|
||||
case 0: ProxPntStatus1 = "Border"; break;
|
||||
case 1: ProxPntStatus1 = "Middle"; break;
|
||||
default: ProxPntStatus1 = "Unknown";
|
||||
}
|
||||
|
||||
switch (aTool.ProxPntStatus2())
|
||||
{
|
||||
case 0: ProxPntStatus2 = "Border"; break;
|
||||
case 1: ProxPntStatus2 = "Middle"; break;
|
||||
default: ProxPntStatus2 = "Unknown";
|
||||
}
|
||||
|
||||
theDI << " Status of ProxPnt1 on " << theArgs[1] << " : " << ProxPntStatus1 << "\n";
|
||||
theDI << " Status of ProxPnt2 on " << theArgs[2] << " : " << ProxPntStatus2 << "\n";
|
||||
theDI << aStr << " \n";
|
||||
}
|
||||
else
|
||||
|
||||
TopoDS_Compound aFaceCompound2;
|
||||
aCompBuilder.MakeCompound (aFaceCompound2);
|
||||
|
||||
for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt2 (aTool.OverlapSubShapes2()); anIt2.More(); anIt2.Next())
|
||||
{
|
||||
TopoDS_Builder aCompBuilder;
|
||||
TCollection_AsciiString aStr = TCollection_AsciiString (theArgs[2]) + "_" + (anIt2.Key() + 1);
|
||||
|
||||
TopoDS_Compound aFaceCompound1;
|
||||
aCompBuilder.MakeCompound(aFaceCompound1);
|
||||
const TopoDS_Face& aFace = aTool.GetSubShape2 (anIt2.Key());
|
||||
aCompBuilder.Add (aFaceCompound2, aFace);
|
||||
DBRep::Set (aStr.ToCString(), aFace);
|
||||
|
||||
for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt1(aTool.OverlapSubShapes1()); anIt1.More(); anIt1.Next())
|
||||
{
|
||||
TCollection_AsciiString aStr = TCollection_AsciiString(theArgs[1]) + "_" + (anIt1.Key() + 1);
|
||||
|
||||
const TopoDS_Shape& aShape = aTool.GetSubShape1(anIt1.Key());
|
||||
aCompBuilder.Add(aFaceCompound1, aShape);
|
||||
DBRep::Set(aStr.ToCString(), aShape);
|
||||
|
||||
theDI << aStr << " \n";
|
||||
}
|
||||
|
||||
TopoDS_Compound aFaceCompound2;
|
||||
aCompBuilder.MakeCompound(aFaceCompound2);
|
||||
|
||||
for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt2(aTool.OverlapSubShapes2()); anIt2.More(); anIt2.Next())
|
||||
{
|
||||
TCollection_AsciiString aStr = TCollection_AsciiString(theArgs[2]) + "_" + (anIt2.Key() + 1);
|
||||
|
||||
const TopoDS_Shape& aShape = aTool.GetSubShape2(anIt2.Key());
|
||||
aCompBuilder.Add(aFaceCompound2, aShape);
|
||||
DBRep::Set(aStr.ToCString(), aShape);
|
||||
|
||||
theDI << aStr << " \n";
|
||||
}
|
||||
|
||||
DBRep::Set((TCollection_AsciiString(theArgs[1]) + "_" + "overlapped").ToCString(), aFaceCompound1);
|
||||
DBRep::Set((TCollection_AsciiString(theArgs[2]) + "_" + "overlapped").ToCString(), aFaceCompound2);
|
||||
theDI << aStr << " \n";
|
||||
}
|
||||
|
||||
DBRep::Set ((TCollection_AsciiString (theArgs[1]) + "_" + "overlapped").ToCString(), aFaceCompound1);
|
||||
DBRep::Set ((TCollection_AsciiString (theArgs[2]) + "_" + "overlapped").ToCString(), aFaceCompound2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -493,14 +445,12 @@ void BRepTest::ExtremaCommands (Draw_Interpretor& theCommands)
|
||||
aGroup);
|
||||
|
||||
theCommands.Add ("proximity",
|
||||
"proximity Shape1 Shape2 [-tol <value> | -value] [-profile]"
|
||||
"proximity Shape1 Shape2 [-tol <value>] [-profile]"
|
||||
"\n\t\t: Searches for pairs of overlapping faces of the given shapes."
|
||||
"\n\t\t: The options are:"
|
||||
"\n\t\t: -tol : non-negative tolerance value used for overlapping"
|
||||
"\n\t\t: test (for zero tolerance, the strict intersection"
|
||||
"\n\t\t: test will be performed)"
|
||||
"\n\t\t: -value : compute the proximity value (minimal value which"
|
||||
"\n\t\t: shows both shapes fully overlapped)"
|
||||
"\n\t\t: -profile : outputs execution time for main algorithm stages",
|
||||
__FILE__,
|
||||
ShapeProximity,
|
||||
|
@@ -35,7 +35,6 @@
|
||||
#include <Bisector_BisecAna.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <BRepOffsetAPI_MakeOffset.hxx>
|
||||
#include <BRepMAT2d_Explorer.hxx>
|
||||
#include <BRepMAT2d_BisectingLocus.hxx>
|
||||
#include <BRepMAT2d_LinkTopoBilo.hxx>
|
||||
@@ -45,7 +44,6 @@
|
||||
|
||||
#include <DBRep.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
|
||||
#ifdef _WIN32
|
||||
Standard_IMPORT Draw_Viewer dout;
|
||||
@@ -72,16 +70,7 @@ static Standard_Integer topoload (Draw_Interpretor& , Standard_Integer argc, con
|
||||
|
||||
if (C1.IsNull()) return 1;
|
||||
|
||||
TopoDS_Face aFace = TopoDS::Face(C1);
|
||||
|
||||
if (argc >= 3 &&
|
||||
(strcmp(argv[2], "-approx") == 0))
|
||||
{
|
||||
Standard_Real aTol = 0.1;
|
||||
aFace = BRepOffsetAPI_MakeOffset::ConvertFace (aFace, aTol);
|
||||
}
|
||||
|
||||
anExplo.Perform (aFace);
|
||||
anExplo.Perform (TopoDS::Face(C1));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -278,7 +267,7 @@ void DrawCurve(const Handle(Geom2d_Curve)& aCurve,
|
||||
|
||||
void BRepTest::MatCommands (Draw_Interpretor& theCommands)
|
||||
{
|
||||
theCommands.Add("topoload","load face: topoload face [-approx]",__FILE__,topoload);
|
||||
theCommands.Add("topoload","load face",__FILE__,topoload);
|
||||
theCommands.Add("drawcont","display current contour",__FILE__,drawcont);
|
||||
theCommands.Add("mat","computes the mat: mat [a/i [o]]",__FILE__,mat);
|
||||
theCommands.Add("side","side left/right",__FILE__,side);
|
||||
|
@@ -4234,133 +4234,6 @@ void BSplCLib::Resolution( Standard_Real& Poles,
|
||||
UTolerance = Tolerance3D / RealSmall();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Intervals
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BSplCLib::Intervals (const TColStd_Array1OfReal& theKnots,
|
||||
const TColStd_Array1OfInteger& theMults,
|
||||
Standard_Integer theDegree,
|
||||
Standard_Boolean isPeriodic,
|
||||
Standard_Integer theContinuity,
|
||||
Standard_Real theFirst,
|
||||
Standard_Real theLast,
|
||||
Standard_Real theTolerance,
|
||||
TColStd_Array1OfReal* theIntervals)
|
||||
{
|
||||
// remove all knots with multiplicity less or equal than (degree - continuity) except first and last
|
||||
Standard_Integer aFirstIndex = isPeriodic ? 1 : FirstUKnotIndex (theDegree, theMults);
|
||||
Standard_Integer aLastIndex = isPeriodic ? theKnots.Size() : LastUKnotIndex (theDegree, theMults);
|
||||
TColStd_Array1OfReal aNewKnots (1, aLastIndex - aFirstIndex + 1);
|
||||
Standard_Integer aNbNewKnots = 0;
|
||||
for (Standard_Integer anIndex = aFirstIndex; anIndex <= aLastIndex; anIndex++)
|
||||
{
|
||||
if (theMults(anIndex) > (theDegree - theContinuity) ||
|
||||
anIndex == aFirstIndex ||
|
||||
anIndex == aLastIndex)
|
||||
{
|
||||
aNbNewKnots++;
|
||||
aNewKnots(aNbNewKnots) = theKnots[anIndex];
|
||||
}
|
||||
}
|
||||
aNewKnots.Resize (1, aNbNewKnots, Standard_True);
|
||||
|
||||
// the range boundaries
|
||||
Standard_Real aCurFirst = theFirst;
|
||||
Standard_Real aCurLast = theLast;
|
||||
Standard_Real aPeriod = 0.0;
|
||||
Standard_Integer aFirstPeriod = 0;
|
||||
Standard_Integer aLastPeriod = 0;
|
||||
// move boundaries into period
|
||||
if (isPeriodic)
|
||||
{
|
||||
Standard_Real aLower = theKnots.First();
|
||||
Standard_Real anUpper = theKnots.Last();
|
||||
aPeriod = anUpper - aLower;
|
||||
|
||||
while (aCurFirst < aLower)
|
||||
{
|
||||
aCurFirst += aPeriod;
|
||||
aFirstPeriod--;
|
||||
}
|
||||
while (aCurLast < aLower)
|
||||
{
|
||||
aCurLast += aPeriod;
|
||||
aLastPeriod--;
|
||||
}
|
||||
while (aCurFirst >= anUpper)
|
||||
{
|
||||
aCurFirst -= aPeriod;
|
||||
aFirstPeriod += 1;
|
||||
}
|
||||
while (aCurLast >= anUpper)
|
||||
{
|
||||
aCurLast -= aPeriod;
|
||||
aLastPeriod += 1;
|
||||
}
|
||||
}
|
||||
// locate the left and nearest knot for boundaries
|
||||
Standard_Integer anIndex1 = 0;
|
||||
Standard_Integer anIndex2 = 0;
|
||||
Standard_Real aDummyDouble;
|
||||
// we use version of LocateParameter that doesn't need multiplicities
|
||||
LocateParameter(theDegree, aNewKnots, TColStd_Array1OfInteger(), aCurFirst, Standard_False, 1, aNbNewKnots, anIndex1, aDummyDouble);
|
||||
LocateParameter(theDegree, aNewKnots, TColStd_Array1OfInteger(), aCurLast, Standard_False, 1, aNbNewKnots, anIndex2, aDummyDouble);
|
||||
// the case when the beginning of the range coincides with the next knot
|
||||
if (anIndex1 < aNbNewKnots && Abs(aNewKnots[anIndex1 + 1] - aCurFirst) < theTolerance)
|
||||
{
|
||||
anIndex1 += 1;
|
||||
}
|
||||
// the case when the ending of the range coincides with the current knot
|
||||
if (aNbNewKnots && Abs(aNewKnots[anIndex2] - aCurLast) < theTolerance)
|
||||
{
|
||||
anIndex2 -= 1;
|
||||
}
|
||||
Standard_Integer aNbIntervals = anIndex2 - anIndex1 + 1 + (aLastPeriod - aFirstPeriod) * (aNbNewKnots - 1);
|
||||
|
||||
// fill the interval array
|
||||
if (theIntervals)
|
||||
{
|
||||
theIntervals->Resize (1, aNbIntervals + 1, Standard_False);
|
||||
if (isPeriodic && aLastPeriod != aFirstPeriod)
|
||||
{
|
||||
Standard_Integer anIndex = 1;
|
||||
// part from the begging of range to the end of the first period
|
||||
for (Standard_Integer i = anIndex1; i < aNewKnots.Size(); i++, anIndex++)
|
||||
{
|
||||
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aFirstPeriod * aPeriod;
|
||||
}
|
||||
// full periods
|
||||
for (Standard_Integer aPeriodNum = aFirstPeriod + 1; aPeriodNum < aLastPeriod; aPeriodNum++)
|
||||
{
|
||||
for (Standard_Integer i = 1; i < aNewKnots.Size(); i++, anIndex++)
|
||||
{
|
||||
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aPeriodNum * aPeriod;
|
||||
}
|
||||
}
|
||||
// part from the begging of the last period to the end of range
|
||||
for (Standard_Integer i = 1; i <= anIndex2; i++, anIndex++)
|
||||
{
|
||||
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aLastPeriod * aPeriod;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Integer anIndex = 1;
|
||||
for (Standard_Integer i = anIndex1; i <= anIndex2; i++, anIndex++)
|
||||
{
|
||||
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aFirstPeriod * aPeriod;
|
||||
}
|
||||
}
|
||||
// update the first position (the begging of range doesn't coincide with the knot at anIndex1 in general)
|
||||
theIntervals->ChangeValue(1) = theFirst;
|
||||
// write the ending of the range (we didn't write it at all)
|
||||
theIntervals->ChangeValue(aNbIntervals + 1) = theLast;
|
||||
}
|
||||
|
||||
return aNbIntervals;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: FlatBezierKnots
|
||||
// purpose :
|
||||
|
@@ -1456,26 +1456,8 @@ public:
|
||||
//! we have |f (u1) - f (u0)| < Tolerance3D
|
||||
Standard_EXPORT static void Resolution (const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const Standard_Integer NumPoles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer Degree, const Standard_Real Tolerance3D, Standard_Real& UTolerance);
|
||||
|
||||
//! Splits the given range to BSpline intervals of given continuity
|
||||
//! @param[in] theKnots the knots of BSpline
|
||||
//! @param[in] theMults the knots' multiplicities
|
||||
//! @param[in] theDegree the degree of BSpline
|
||||
//! @param[in] isPeriodic the periodicity of BSpline
|
||||
//! @param[in] theContinuity the target interval's continuity
|
||||
//! @param[in] theFirst the begin of the target range
|
||||
//! @param[in] theLast the end of the target range
|
||||
//! @param[in] theTolerance the tolerance
|
||||
//! @param[in,out] theIntervals the array to store intervals if isn't nullptr
|
||||
//! @return the number of intervals
|
||||
Standard_EXPORT static Standard_Integer Intervals (const TColStd_Array1OfReal& theKnots,
|
||||
const TColStd_Array1OfInteger& theMults,
|
||||
Standard_Integer theDegree,
|
||||
Standard_Boolean isPeriodic,
|
||||
Standard_Integer theContinuity,
|
||||
Standard_Real theFirst,
|
||||
Standard_Real theLast,
|
||||
Standard_Real theTolerance,
|
||||
TColStd_Array1OfReal* theIntervals);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -1157,97 +1157,82 @@ void BSplCLib::MergeBSplineKnots
|
||||
index,
|
||||
num_knots ;
|
||||
if (StartValue < EndValue - Tolerance) {
|
||||
TColStd_Array1OfReal knots1(1, Knots1.Length());
|
||||
TColStd_Array1OfReal knots2(1, Knots2.Length());
|
||||
degree = Degree1 + Degree2;
|
||||
index = 1;
|
||||
TColStd_Array1OfReal knots1(1,Knots1.Length()) ;
|
||||
TColStd_Array1OfReal knots2(1,Knots2.Length()) ;
|
||||
degree = Degree1 + Degree2 ;
|
||||
index = 1 ;
|
||||
|
||||
for (ii = Knots1.Lower(); ii <= Knots1.Upper(); ii++) {
|
||||
knots1(index) = Knots1(ii);
|
||||
index += 1;
|
||||
for (ii = Knots1.Lower() ; ii <= Knots1.Upper() ; ii++) {
|
||||
knots1(index) = Knots1(ii) ;
|
||||
index += 1 ;
|
||||
}
|
||||
index = 1;
|
||||
index = 1 ;
|
||||
|
||||
for (ii = Knots2.Lower(); ii <= Knots2.Upper(); ii++) {
|
||||
knots2(index) = Knots2(ii);
|
||||
index += 1;
|
||||
for (ii = Knots2.Lower() ; ii <= Knots2.Upper() ; ii++) {
|
||||
knots2(index) = Knots2(ii) ;
|
||||
index += 1 ;
|
||||
}
|
||||
BSplCLib::Reparametrize(StartValue,
|
||||
EndValue,
|
||||
knots1);
|
||||
|
||||
EndValue,
|
||||
knots1) ;
|
||||
|
||||
BSplCLib::Reparametrize(StartValue,
|
||||
EndValue,
|
||||
knots2);
|
||||
num_knots = 0;
|
||||
jj = 1;
|
||||
EndValue,
|
||||
knots2) ;
|
||||
num_knots = 0 ;
|
||||
jj = 1 ;
|
||||
|
||||
for (ii = 1; ii <= knots1.Length(); ii++) {
|
||||
for (ii = 1 ; ii <= knots1.Length() ; ii++) {
|
||||
|
||||
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) - Tolerance) {
|
||||
jj += 1;
|
||||
num_knots += 1;
|
||||
jj += 1 ;
|
||||
num_knots += 1 ;
|
||||
}
|
||||
|
||||
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) + Tolerance) {
|
||||
jj += 1;
|
||||
jj += 1 ;
|
||||
}
|
||||
num_knots += 1;
|
||||
num_knots += 1 ;
|
||||
}
|
||||
NewKnots =
|
||||
new TColStd_HArray1OfReal(1, num_knots);
|
||||
NewKnots =
|
||||
new TColStd_HArray1OfReal(1,num_knots) ;
|
||||
NewMults =
|
||||
new TColStd_HArray1OfInteger(1, num_knots);
|
||||
num_knots = 1;
|
||||
jj = 1;
|
||||
new TColStd_HArray1OfInteger(1,num_knots) ;
|
||||
num_knots = 1 ;
|
||||
jj = 1 ;
|
||||
|
||||
for (ii = 1; ii <= knots1.Length(); ii++) {
|
||||
for (ii = 1 ; ii <= knots1.Length() ; ii++) {
|
||||
|
||||
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) - Tolerance) {
|
||||
NewKnots->ChangeArray1()(num_knots) = knots2(jj);
|
||||
NewMults->ChangeArray1()(num_knots) = Mults2(jj) + Degree1;
|
||||
jj += 1;
|
||||
num_knots += 1;
|
||||
NewKnots->ChangeArray1()(num_knots) = knots2(jj) ;
|
||||
NewMults->ChangeArray1()(num_knots) = Mults2(jj) + Degree1 ;
|
||||
jj += 1 ;
|
||||
num_knots += 1 ;
|
||||
}
|
||||
set_mults_flag = 0;
|
||||
set_mults_flag = 0 ;
|
||||
|
||||
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) + Tolerance) {
|
||||
continuity = Min(Degree1 - Mults1(ii), Degree2 - Mults2(jj));
|
||||
set_mults_flag = 1;
|
||||
NewMults->ChangeArray1()(num_knots) = degree - continuity;
|
||||
jj += 1;
|
||||
continuity = Min(Degree1 - Mults1(ii), Degree2 - Mults2(jj)) ;
|
||||
set_mults_flag = 1 ;
|
||||
NewMults->ChangeArray1()(num_knots) = degree - continuity ;
|
||||
jj += 1 ;
|
||||
}
|
||||
|
||||
NewKnots->ChangeArray1()(num_knots) = knots1(ii);
|
||||
if (!set_mults_flag) {
|
||||
NewMults->ChangeArray1()(num_knots) = Mults1(ii) + Degree2;
|
||||
NewKnots->ChangeArray1()(num_knots) = knots1(ii) ;
|
||||
if (! set_mults_flag) {
|
||||
NewMults->ChangeArray1()(num_knots) = Mults1(ii) + Degree2 ;
|
||||
}
|
||||
num_knots += 1;
|
||||
num_knots += 1 ;
|
||||
}
|
||||
num_knots -= 1;
|
||||
NewMults->ChangeArray1()(1) = degree + 1;
|
||||
NewMults->ChangeArray1()(num_knots) = degree + 1;
|
||||
index = 0;
|
||||
num_knots -= 1 ;
|
||||
NewMults->ChangeArray1()(1) = degree + 1 ;
|
||||
NewMults->ChangeArray1()(num_knots) = degree + 1 ;
|
||||
index = 0 ;
|
||||
|
||||
for (ii = 1; ii <= num_knots; ii++) {
|
||||
index += NewMults->Value(ii);
|
||||
for (ii = 1 ; ii <= num_knots ; ii++) {
|
||||
index += NewMults->Value(ii) ;
|
||||
}
|
||||
NumPoles = index - degree - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
degree = Degree1 + Degree2;
|
||||
num_knots = 2;
|
||||
NewKnots =
|
||||
new TColStd_HArray1OfReal(1, num_knots);
|
||||
NewKnots->ChangeArray1()(1) = StartValue;
|
||||
NewKnots->ChangeArray1()(num_knots) = EndValue;
|
||||
|
||||
NewMults =
|
||||
new TColStd_HArray1OfInteger(1, num_knots);
|
||||
NewMults->ChangeArray1()(1) = degree + 1;
|
||||
NewMults->ChangeArray1()(num_knots) = degree + 1;
|
||||
NumPoles = BSplCLib::NbPoles(degree, Standard_False, NewMults->Array1());
|
||||
NumPoles = index - degree - 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -64,18 +64,19 @@ public:
|
||||
//! given transformation to this box.
|
||||
BVH_Box<T, 3> Transformed (const NCollection_Mat4<T>& theTransform) const
|
||||
{
|
||||
const BVH_Box<T, 3> *aThis = static_cast<const BVH_Box<T, 3>*>(this);
|
||||
BVH_Box<T, 3> aResultBox;
|
||||
|
||||
if (theTransform.IsIdentity())
|
||||
{
|
||||
return *aThis;
|
||||
return aResultBox;
|
||||
}
|
||||
|
||||
const BVH_Box<T, 3> *aThis = static_cast<const BVH_Box<T, 3>*>(this);
|
||||
if (!aThis->IsValid())
|
||||
{
|
||||
return *aThis;
|
||||
return aResultBox;
|
||||
}
|
||||
|
||||
BVH_Box<T, 3> aResultBox;
|
||||
for (size_t aX = 0; aX <= 1; ++aX)
|
||||
{
|
||||
for (size_t aY = 0; aY <= 1; ++aY)
|
||||
|
@@ -30,15 +30,6 @@ public: //! @name public types
|
||||
|
||||
typedef typename BVH::VectorType<T, N>::Type BVH_VecNt;
|
||||
|
||||
public:
|
||||
|
||||
enum BVH_PrjStateInTriangle
|
||||
{
|
||||
BVH_PrjStateInTriangle_VERTEX,
|
||||
BVH_PrjStateInTriangle_EDGE,
|
||||
BVH_PrjStateInTriangle_INNER
|
||||
};
|
||||
|
||||
public: //! @name Box-Box Square distance
|
||||
|
||||
//! Computes Square distance between Axis aligned bounding boxes
|
||||
@@ -122,14 +113,11 @@ public: //! @name Point-Box projection
|
||||
|
||||
public: //! @name Point-Triangle Square distance
|
||||
|
||||
//! Find nearest point on a triangle for the given point
|
||||
static BVH_VecNt PointTriangleProjection (const BVH_VecNt& thePoint,
|
||||
const BVH_VecNt& theNode0,
|
||||
const BVH_VecNt& theNode1,
|
||||
const BVH_VecNt& theNode2,
|
||||
BVH_PrjStateInTriangle* thePrjState = nullptr,
|
||||
Standard_Integer* theNumberOfFirstNode = nullptr,
|
||||
Standard_Integer* theNumberOfLastNode = nullptr)
|
||||
//! Computes square distance between point and triangle
|
||||
static T PointTriangleSquareDistance (const BVH_VecNt& thePoint,
|
||||
const BVH_VecNt& theNode0,
|
||||
const BVH_VecNt& theNode1,
|
||||
const BVH_VecNt& theNode2)
|
||||
{
|
||||
const BVH_VecNt aAB = theNode1 - theNode0;
|
||||
const BVH_VecNt aAC = theNode2 - theNode0;
|
||||
@@ -140,110 +128,68 @@ public: //! @name Point-Triangle Square distance
|
||||
|
||||
if (aABdotAP <= 0. && aACdotAP <= 0.)
|
||||
{
|
||||
if (thePrjState != nullptr)
|
||||
{
|
||||
*thePrjState = BVH_PrjStateInTriangle_VERTEX;
|
||||
*theNumberOfFirstNode = 0;
|
||||
*theNumberOfLastNode = 0;
|
||||
}
|
||||
return theNode0;
|
||||
return aAP.Dot(aAP);
|
||||
}
|
||||
|
||||
|
||||
const BVH_VecNt aBC = theNode2 - theNode1;
|
||||
const BVH_VecNt aBP = thePoint - theNode1;
|
||||
|
||||
T aBAdotBP = -(aAB.Dot (aBP));
|
||||
T aBCdotBP = (aBC.Dot (aBP));
|
||||
|
||||
|
||||
T aBAdotBP = -(aAB.Dot(aBP));
|
||||
T aBCdotBP = (aBC.Dot(aBP));
|
||||
|
||||
if (aBAdotBP <= 0. && aBCdotBP <= 0.)
|
||||
{
|
||||
if (thePrjState != nullptr)
|
||||
{
|
||||
*thePrjState = BVH_PrjStateInTriangle_VERTEX;
|
||||
*theNumberOfFirstNode = 1;
|
||||
*theNumberOfLastNode = 1;
|
||||
}
|
||||
return theNode1;
|
||||
return (aBP.Dot(aBP));
|
||||
}
|
||||
|
||||
|
||||
const BVH_VecNt aCP = thePoint - theNode2;
|
||||
|
||||
T aCBdotCP = -(aBC.Dot (aCP));
|
||||
T aCAdotCP = -(aAC.Dot (aCP));
|
||||
|
||||
|
||||
T aCBdotCP = -(aBC.Dot(aCP));
|
||||
T aCAdotCP = -(aAC.Dot(aCP));
|
||||
|
||||
if (aCAdotCP <= 0. && aCBdotCP <= 0.)
|
||||
{
|
||||
if (thePrjState != nullptr)
|
||||
{
|
||||
*thePrjState = BVH_PrjStateInTriangle_VERTEX;
|
||||
*theNumberOfFirstNode = 2;
|
||||
*theNumberOfLastNode = 2;
|
||||
}
|
||||
return theNode2;
|
||||
return (aCP.Dot(aCP));
|
||||
}
|
||||
|
||||
T aACdotBP = (aAC.Dot (aBP));
|
||||
|
||||
|
||||
T aACdotBP = (aAC.Dot(aBP));
|
||||
|
||||
T aVC = aABdotAP * aACdotBP + aBAdotBP * aACdotAP;
|
||||
|
||||
|
||||
if (aVC <= 0. && aABdotAP > 0. && aBAdotBP > 0.)
|
||||
{
|
||||
if (thePrjState != nullptr)
|
||||
{
|
||||
*thePrjState = BVH_PrjStateInTriangle_EDGE;
|
||||
*theNumberOfFirstNode = 0;
|
||||
*theNumberOfLastNode = 1;
|
||||
}
|
||||
return theNode0 + aAB * (aABdotAP / (aABdotAP + aBAdotBP));
|
||||
const BVH_VecNt aDirect = aAP - aAB * (aABdotAP / (aABdotAP + aBAdotBP));
|
||||
|
||||
return (aDirect.Dot(aDirect));
|
||||
}
|
||||
|
||||
T aABdotCP = (aAB.Dot (aCP));
|
||||
|
||||
|
||||
T aABdotCP = (aAB.Dot(aCP));
|
||||
|
||||
T aVA = aBAdotBP * aCAdotCP - aABdotCP * aACdotBP;
|
||||
|
||||
|
||||
if (aVA <= 0. && aBCdotBP > 0. && aCBdotCP > 0.)
|
||||
{
|
||||
if (thePrjState != nullptr)
|
||||
{
|
||||
*thePrjState = BVH_PrjStateInTriangle_EDGE;
|
||||
*theNumberOfFirstNode = 1;
|
||||
*theNumberOfLastNode = 2;
|
||||
}
|
||||
return theNode1 + aBC * (aBCdotBP / (aBCdotBP + aCBdotCP));
|
||||
const BVH_VecNt aDirect = aBP - aBC * (aBCdotBP / (aBCdotBP + aCBdotCP));
|
||||
|
||||
return (aDirect.Dot(aDirect));
|
||||
}
|
||||
|
||||
|
||||
T aVB = aABdotCP * aACdotAP + aABdotAP * aCAdotCP;
|
||||
|
||||
|
||||
if (aVB <= 0. && aACdotAP > 0. && aCAdotCP > 0.)
|
||||
{
|
||||
if (thePrjState != nullptr)
|
||||
{
|
||||
*thePrjState = BVH_PrjStateInTriangle_EDGE;
|
||||
*theNumberOfFirstNode = 2;
|
||||
*theNumberOfLastNode = 0;
|
||||
}
|
||||
return theNode0 + aAC * (aACdotAP / (aACdotAP + aCAdotCP));
|
||||
const BVH_VecNt aDirect = aAP - aAC * (aACdotAP / (aACdotAP + aCAdotCP));
|
||||
|
||||
return (aDirect.Dot(aDirect));
|
||||
}
|
||||
|
||||
|
||||
T aNorm = aVA + aVB + aVC;
|
||||
|
||||
if (thePrjState != nullptr)
|
||||
{
|
||||
*thePrjState = BVH_PrjStateInTriangle_INNER;
|
||||
}
|
||||
|
||||
return (theNode0 * aVA + theNode1 * aVB + theNode2 * aVC) / aNorm;
|
||||
}
|
||||
|
||||
//! Computes square distance between point and triangle
|
||||
static T PointTriangleSquareDistance (const BVH_VecNt& thePoint,
|
||||
const BVH_VecNt& theNode0,
|
||||
const BVH_VecNt& theNode1,
|
||||
const BVH_VecNt& theNode2)
|
||||
{
|
||||
const BVH_VecNt aProj = PointTriangleProjection(thePoint, theNode0, theNode1, theNode2);
|
||||
const BVH_VecNt aPP = aProj - thePoint;
|
||||
return aPP.Dot(aPP);
|
||||
|
||||
const BVH_VecNt& aDirect = thePoint - (theNode0 * aVA +
|
||||
theNode1 * aVB +
|
||||
theNode2 * aVC) / aNorm;
|
||||
|
||||
return (aDirect.Dot(aDirect));
|
||||
}
|
||||
|
||||
public: //! @name Ray-Box Intersection
|
||||
|
@@ -1221,105 +1221,6 @@ static void ComputeSphere (const gp_Sphere& Sphere,
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : computeDegeneratedTorus
|
||||
//purpose : compute bounding box for degenerated torus
|
||||
//=======================================================================
|
||||
|
||||
static void computeDegeneratedTorus (const gp_Torus& theTorus,
|
||||
const Standard_Real theUMin, const Standard_Real theUMax,
|
||||
const Standard_Real theVMin, const Standard_Real theVMax,
|
||||
Bnd_Box& theB)
|
||||
{
|
||||
gp_Pnt aP = theTorus.Location();
|
||||
Standard_Real aRa = theTorus.MajorRadius();
|
||||
Standard_Real aRi = theTorus.MinorRadius();
|
||||
Standard_Real aXmin,anYmin,aZmin,aXmax,anYmax,aZmax;
|
||||
aXmin = aP.X() - aRa - aRi;
|
||||
aXmax = aP.X() + aRa + aRi;
|
||||
anYmin = aP.Y() - aRa - aRi;
|
||||
anYmax = aP.Y() + aRa + aRi;
|
||||
aZmin = aP.Z() - aRi;
|
||||
aZmax = aP.Z() + aRi;
|
||||
|
||||
Standard_Real aPhi = ACos (-aRa / aRi);
|
||||
|
||||
Standard_Real anUper = 2. * M_PI - Precision::PConfusion();
|
||||
Standard_Real aVper = 2. * aPhi - Precision::PConfusion();
|
||||
if (theUMax - theUMin >= anUper && theVMax - theVMin >= aVper)
|
||||
{
|
||||
// a whole torus
|
||||
theB.Update(aXmin, anYmin, aZmin, aXmax, anYmax, aZmax);
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Real anU,aV;
|
||||
Standard_Real anUmax = theUMin + 2. * M_PI;
|
||||
const gp_Ax3& aPos = theTorus.Position();
|
||||
gp_Pnt aPExt = aP;
|
||||
aPExt.SetX(aXmin);
|
||||
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
|
||||
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
|
||||
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
|
||||
{
|
||||
theB.Add(aPExt);
|
||||
}
|
||||
//
|
||||
aPExt.SetX(aXmax);
|
||||
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
|
||||
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
|
||||
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
|
||||
{
|
||||
theB.Add(aPExt);
|
||||
}
|
||||
aPExt.SetX(aP.X());
|
||||
//
|
||||
aPExt.SetY(anYmin);
|
||||
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
|
||||
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
|
||||
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
|
||||
{
|
||||
theB.Add(aPExt);
|
||||
}
|
||||
//
|
||||
aPExt.SetY(anYmax);
|
||||
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
|
||||
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
|
||||
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
|
||||
{
|
||||
theB.Add(aPExt);
|
||||
}
|
||||
aPExt.SetY(aP.Y());
|
||||
//
|
||||
aPExt.SetZ(aZmin);
|
||||
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
|
||||
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
|
||||
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
|
||||
{
|
||||
theB.Add(aPExt);
|
||||
}
|
||||
//
|
||||
aPExt.SetZ(aZmax);
|
||||
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
|
||||
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
|
||||
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
|
||||
{
|
||||
theB.Add(aPExt);
|
||||
}
|
||||
//
|
||||
// Add boundaries of patch
|
||||
// UMin, UMax
|
||||
gp_Circ aC = ElSLib::TorusUIso(aPos,aRa,aRi,theUMin);
|
||||
BndLib::Add(aC,theVMin,theVMax,0.,theB);
|
||||
aC = ElSLib::TorusUIso(aPos,aRa,aRi,theUMax);
|
||||
BndLib::Add(aC,theVMin,theVMax,0.,theB);
|
||||
// VMin, VMax
|
||||
aC = ElSLib::TorusVIso(aPos,aRa,aRi,theVMin);
|
||||
BndLib::Add(aC,theUMin,theUMax,0.,theB);
|
||||
aC = ElSLib::TorusVIso(aPos,aRa,aRi,theVMax);
|
||||
BndLib::Add(aC,theUMin,theUMax,0.,theB);
|
||||
}
|
||||
|
||||
void BndLib::Add(const gp_Sphere& S,const Standard_Real UMin,
|
||||
const Standard_Real UMax,const Standard_Real VMin,
|
||||
const Standard_Real VMax,const Standard_Real Tol, Bnd_Box& B)
|
||||
@@ -1364,13 +1265,6 @@ void BndLib::Add(const gp_Torus& S,const Standard_Real UMin,
|
||||
|
||||
if (Fi2<Fi1) return;
|
||||
|
||||
if (Ra<Ri)
|
||||
{
|
||||
computeDegeneratedTorus(S,UMin,UMax,VMin,VMax,B);
|
||||
B.Enlarge(Tol);
|
||||
return;
|
||||
}
|
||||
|
||||
#define SC 0.71
|
||||
#define addP0 (Compute(UMin,UMax,Ra+Ri,Ra+Ri,gp_Pnt(S.XAxis().Direction().XYZ()),gp_Pnt(S.YAxis().Direction().XYZ()),S.Location(),B))
|
||||
#define addP1 (Compute(UMin,UMax,Ra+Ri*SC,Ra+Ri*SC,gp_Pnt(S.XAxis().Direction().XYZ()),gp_Pnt(S.YAxis().Direction().XYZ()),gp_Pnt(S.Location().XYZ()+(Ri*SC)*S.Axis().Direction().XYZ()),B))
|
||||
|
@@ -37,7 +37,9 @@ Draft_FaceInfo::Draft_FaceInfo (const Handle(Geom_Surface)& S,\
|
||||
const Standard_Boolean HasNewGeometry):
|
||||
myNewGeom(HasNewGeometry)
|
||||
{
|
||||
myGeom = S;
|
||||
Handle(Geom_RectangularTrimmedSurface) T = Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
|
||||
if (!T.IsNull()) myGeom = T->BasisSurface();
|
||||
else myGeom = S;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -481,7 +481,7 @@ Standard_Boolean Draft_Modification::Propagate ()
|
||||
Handle(Geom_Surface)::DownCast(S->Transformed(L.Transformation()));
|
||||
|
||||
const Handle(Standard_Type)& typs = S->DynamicType();
|
||||
if (/*typs == STANDARD_TYPE(Geom_CylindricalSurface) ||*/
|
||||
if (typs == STANDARD_TYPE(Geom_CylindricalSurface) ||
|
||||
typs == STANDARD_TYPE(Geom_ConicalSurface)) {
|
||||
Standard_Real umin,umax,vmin,vmax;
|
||||
BRepTools::UVBounds(F,umin,umax,vmin,vmax);
|
||||
@@ -1062,11 +1062,7 @@ void Draft_Modification::Perform ()
|
||||
//Find the first curve to glue
|
||||
TColGeom_SequenceOfCurve Candidates;
|
||||
if (S1->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface) ||
|
||||
S1->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface) ||
|
||||
S1->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface) &&
|
||||
Handle(Geom_RectangularTrimmedSurface)::DownCast(S1)->BasisSurface()->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface) ||
|
||||
S1->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface) &&
|
||||
Handle(Geom_RectangularTrimmedSurface)::DownCast(S1)->BasisSurface()->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface))
|
||||
S1->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface))
|
||||
{
|
||||
for (i = 1; i <= i2s.NbLines(); i++)
|
||||
{
|
||||
|
@@ -27,7 +27,7 @@
|
||||
// intended for use from debugger prompt (Command Window in Visual Studio)
|
||||
|
||||
//! Save geometric object identified by pointer to handle
|
||||
Standard_EXPORT const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr)
|
||||
const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr)
|
||||
{
|
||||
if (theNameStr == 0 || theHandlePtr == 0)
|
||||
{
|
||||
@@ -57,7 +57,7 @@ Standard_EXPORT const char* DrawTrSurf_Set (const char* theNameStr, void* theHan
|
||||
}
|
||||
|
||||
//! Set point to DRAW variable
|
||||
Standard_EXPORT const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr)
|
||||
const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr)
|
||||
{
|
||||
if (theNameStr == 0 || thePntPtr == 0)
|
||||
{
|
||||
@@ -77,7 +77,7 @@ Standard_EXPORT const char* DrawTrSurf_SetPnt (const char* theNameStr, void* the
|
||||
}
|
||||
|
||||
//! Set 2d point to DRAW variable
|
||||
Standard_EXPORT const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* thePnt2dPtr)
|
||||
const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* thePnt2dPtr)
|
||||
{
|
||||
if (theNameStr == 0 || thePnt2dPtr == 0)
|
||||
{
|
||||
@@ -102,17 +102,17 @@ Standard_EXPORT const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* t
|
||||
// work with them (DBX could, on SUN Solaris).
|
||||
#ifndef _MSC_VER
|
||||
|
||||
Standard_EXPORT const char* DrawTrSurf_Set (const char* name, const Handle(Standard_Transient)& G)
|
||||
const char* DrawTrSurf_Set (const char* name, const Handle(Standard_Transient)& G)
|
||||
{
|
||||
return DrawTrSurf_Set (name, (void*)&G);
|
||||
}
|
||||
|
||||
Standard_EXPORT const char* DrawTrSurf_Set (const char* theName, const gp_Pnt& thePnt)
|
||||
const char* DrawTrSurf_Set (const char* theName, const gp_Pnt& thePnt)
|
||||
{
|
||||
return DrawTrSurf_SetPnt (theName, (void*)&thePnt);
|
||||
}
|
||||
|
||||
Standard_EXPORT const char* DrawTrSurf_Set (const char* theName, const gp_Pnt2d& thePnt2d)
|
||||
const char* DrawTrSurf_Set (const char* theName, const gp_Pnt2d& thePnt2d)
|
||||
{
|
||||
return DrawTrSurf_SetPnt2d (theName, (void*)&thePnt2d);
|
||||
}
|
||||
|
@@ -1,5 +0,0 @@
|
||||
project(ExpToCasExe)
|
||||
|
||||
set (EXECUTABLE_PROJECT ON)
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
unset (EXECUTABLE_PROJECT)
|
@@ -1,2 +0,0 @@
|
||||
TKernel
|
||||
TKExpress
|
@@ -1,395 +0,0 @@
|
||||
// Created: Mon Nov 1 12:50:27 1999
|
||||
// Author: Andrey BETENEV
|
||||
// Copyright (c) 1999-2020 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 <cstring>
|
||||
#include <Express_Item.hxx>
|
||||
#include <Express_Schema.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <OSD_File.hxx>
|
||||
#include <OSD_FileSystem.hxx>
|
||||
#include <OSD_OpenFile.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include "exptocas.tab.hxx"
|
||||
|
||||
//=======================================================================
|
||||
// function : GetSchema
|
||||
// purpose : interface to parser
|
||||
//=======================================================================
|
||||
Handle(Express_Schema) GetSchema (const char* theFileName)
|
||||
{
|
||||
std::ifstream aFileStream;
|
||||
OSD_OpenStream(aFileStream, theFileName, std::ios_base::in | std::ios_base::binary);
|
||||
exptocas::scanner aScanner(&aFileStream);
|
||||
aScanner.yyrestart(&aFileStream);
|
||||
// uncomment next string for debug of parser
|
||||
//aScanner.set_debug(1);
|
||||
exptocas::parser aParser(&aScanner);
|
||||
aParser.parse();
|
||||
return Express::Schema();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : LoadList
|
||||
// purpose : Load list of (class name, package name) from the file
|
||||
// Package names and optional mark flag are set to items in the schema
|
||||
//=======================================================================
|
||||
static Standard_Boolean LoadList (const char *theFileName,
|
||||
const Handle(Express_Schema)& theSchema,
|
||||
const Standard_Boolean theMark)
|
||||
{
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::istream> aStreamPtr = aFileSystem->OpenIStream (theFileName, std::ios::in);
|
||||
Standard_IStream& anIS = *aStreamPtr;
|
||||
|
||||
if (aStreamPtr == nullptr)
|
||||
{
|
||||
Message::SendFail() << "Error: cannot open " << theFileName;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Message::SendInfo() << "Loading " << theFileName << "...";
|
||||
char aBuf[512];
|
||||
Standard_Integer aLineNum = 0;
|
||||
// a line entry in file has the next format:
|
||||
// item_name package_name [shortname [check_flag(0 or 1) [fillshared_flag(0 or 1) [category]]]]
|
||||
while (anIS.getline (aBuf, 512))
|
||||
{
|
||||
char* aCurPos = aBuf;
|
||||
char* anItemName;
|
||||
char* aPackageName;
|
||||
char* aShortName;
|
||||
char* aCheckFlag;
|
||||
char* aFillSharedFlag;
|
||||
char* aCategoryName;
|
||||
Standard_Size aSepIdx = 0;
|
||||
aLineNum += 1;
|
||||
// -------------------------------------------------------------
|
||||
// first word is an item name
|
||||
// -------------------------------------------------------------
|
||||
// skip any whitespace character in the line
|
||||
while (*aCurPos && (aSepIdx = strcspn (aCurPos, " \t\r\n")) == 0)
|
||||
{
|
||||
aCurPos++;
|
||||
}
|
||||
// to next line if first word isn't found or comment started
|
||||
if (*aCurPos == '\0' || *aCurPos == '#')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// get the name of the item
|
||||
anItemName = aCurPos;
|
||||
// shift the position
|
||||
if (aCurPos[aSepIdx] == '\0')
|
||||
{
|
||||
aCurPos += aSepIdx;
|
||||
}
|
||||
else
|
||||
{
|
||||
aCurPos[aSepIdx] = '\0';
|
||||
aCurPos += aSepIdx + 1;
|
||||
}
|
||||
Handle(Express_Item) anItem = theSchema->Item (anItemName, Standard_True);
|
||||
// skip any class name not in schema
|
||||
if (anItem.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// -------------------------------------------------------------
|
||||
// second word is a package name
|
||||
// -------------------------------------------------------------
|
||||
// skip any whitespace character in the rest of the line
|
||||
while (*aCurPos && (aSepIdx = strcspn (aCurPos, " \t\r\n")) == 0)
|
||||
{
|
||||
aCurPos++;
|
||||
}
|
||||
// to next line if second word isn't found or comment started
|
||||
if (*aCurPos == '\0' || *aCurPos == '#')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// get the name of the package
|
||||
aPackageName = aCurPos;
|
||||
// shift the position
|
||||
if (aCurPos[aSepIdx] == '\0')
|
||||
{
|
||||
aCurPos += aSepIdx;
|
||||
}
|
||||
else
|
||||
{
|
||||
aCurPos[aSepIdx] = '\0';
|
||||
aCurPos += aSepIdx + 1;
|
||||
}
|
||||
// make warning if there is another package for the item
|
||||
if (anItem->IsPackageNameSet() && anItem->GetPackageName().IsDifferent (aPackageName))
|
||||
{
|
||||
Message::SendWarning() << "Warning: Package is redefined for item " << anItemName;
|
||||
}
|
||||
anItem->SetPackageName (aPackageName);
|
||||
anItem->SetGenMode (theMark ? Express_Item::GM_GenByUser : Express_Item::GM_NoGen);
|
||||
// -------------------------------------------------------------
|
||||
// third word is an item short name (optional)
|
||||
// -------------------------------------------------------------
|
||||
// skip any whitespace character in the line
|
||||
while (*aCurPos && (aSepIdx = strcspn (aCurPos, " \t\r\n")) == 0)
|
||||
{
|
||||
aCurPos++;
|
||||
}
|
||||
// to next line if third word isn't found or comment started
|
||||
if (*aCurPos == '\0' || *aCurPos == '#')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// get the short name
|
||||
aShortName = aCurPos;
|
||||
// shift the position
|
||||
if (aCurPos[aSepIdx] == '\0')
|
||||
{
|
||||
aCurPos += aSepIdx;
|
||||
}
|
||||
else
|
||||
{
|
||||
aCurPos[aSepIdx] = '\0';
|
||||
aCurPos += aSepIdx + 1;
|
||||
}
|
||||
if (!std::isalpha (*aShortName))
|
||||
{
|
||||
Message::SendWarning() << "Warning: Not recognized a shortname at the line " << aLineNum;
|
||||
continue;
|
||||
}
|
||||
// if short name "-" then just do not set it
|
||||
if (*aShortName != '-')
|
||||
{
|
||||
Handle(TCollection_HAsciiString) anItemShortName = new TCollection_HAsciiString(aShortName);
|
||||
if (anItemShortName->Length() > 0)
|
||||
{
|
||||
anItem->SetShortName (anItemShortName);
|
||||
}
|
||||
}
|
||||
// -------------------------------------------------------------
|
||||
// fourth word is an item check flag (optional)
|
||||
// -------------------------------------------------------------
|
||||
// skip any whitespace character in the line
|
||||
while (*aCurPos && (aSepIdx = strcspn (aCurPos, " \t\r\n")) == 0)
|
||||
{
|
||||
aCurPos++;
|
||||
}
|
||||
// to next line if fourth word isn't found or comment started
|
||||
if (*aCurPos == '\0' || *aCurPos == '#')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// get the check flag
|
||||
aCheckFlag = aCurPos;
|
||||
// shift the position
|
||||
if (aCurPos[aSepIdx] == '\0')
|
||||
{
|
||||
aCurPos += aSepIdx;
|
||||
}
|
||||
else
|
||||
{
|
||||
aCurPos[aSepIdx] = '\0';
|
||||
aCurPos += aSepIdx + 1;
|
||||
}
|
||||
if (!(*aCheckFlag == '0' || *aCheckFlag == '1'))
|
||||
{
|
||||
Message::SendWarning() << "Warning: Not recognized a check flag at the line " << aLineNum;
|
||||
continue;
|
||||
}
|
||||
Standard_Boolean hasCheck = (*aCheckFlag == '0' ? Standard_False : Standard_True);
|
||||
anItem->SetCheckFlag (hasCheck);
|
||||
// -------------------------------------------------------------
|
||||
// fifth word is an item fill share flag (optional)
|
||||
// -------------------------------------------------------------
|
||||
// skip any whitespace character in the line
|
||||
while (*aCurPos && (aSepIdx = strcspn (aCurPos, " \t\r\n")) == 0)
|
||||
{
|
||||
aCurPos++;
|
||||
}
|
||||
// to next line if fifth word isn't found or comment started
|
||||
if (*aCurPos == '\0' || *aCurPos == '#')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// get the fill share flag
|
||||
aFillSharedFlag = aCurPos;
|
||||
// shift the position
|
||||
if (aCurPos[aSepIdx] == '\0')
|
||||
{
|
||||
aCurPos += aSepIdx;
|
||||
}
|
||||
else
|
||||
{
|
||||
aCurPos[aSepIdx] = '\0';
|
||||
aCurPos += aSepIdx + 1;
|
||||
}
|
||||
if (!(*aFillSharedFlag == '0' || *aFillSharedFlag == '1'))
|
||||
{
|
||||
Message::SendWarning() << "Warning: Not recognized a fill shared flag at the line " << aLineNum;
|
||||
continue;
|
||||
}
|
||||
Standard_Boolean hasFillShared = (*aFillSharedFlag == '0' ? Standard_False : Standard_True);
|
||||
anItem->SetFillSharedFlag (hasFillShared);
|
||||
// -------------------------------------------------------------
|
||||
// sixth word is an item category name (optional)
|
||||
// -------------------------------------------------------------
|
||||
// skip any whitespace character in the line
|
||||
while (*aCurPos && (aSepIdx = strcspn (aCurPos, " \t\r\n")) == 0)
|
||||
{
|
||||
aCurPos++;
|
||||
}
|
||||
// to next line if sixth word isn't found or comment started
|
||||
if (*aCurPos == '\0' || *aCurPos == '#')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// get the category name
|
||||
aCategoryName = aCurPos;
|
||||
aCurPos[aSepIdx] = '\0';
|
||||
if (!std::isalpha (*aCategoryName))
|
||||
{
|
||||
Message::SendWarning() << "Warning: Not recognized a category name at the line " << aLineNum;
|
||||
continue;
|
||||
}
|
||||
// if category name "-" then just do not set it
|
||||
if (*aCategoryName != '-')
|
||||
{
|
||||
Handle(TCollection_HAsciiString) anItemCategoryName = new TCollection_HAsciiString(aCategoryName);
|
||||
if (anItemCategoryName->Length() > 0)
|
||||
{
|
||||
anItem->SetShortName (anItemCategoryName);
|
||||
}
|
||||
}
|
||||
}
|
||||
Message::SendInfo() << " Done";
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : main
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer main (const Standard_Integer argc, const char* argv[])
|
||||
{
|
||||
if (argc < 2)
|
||||
{
|
||||
Message::SendInfo() << "EXPRESS -> CASCADE/XSTEP classes generator 3.0\n"
|
||||
"Use: ExpToCas <schema.exp> [<create.lst> [<packaging.lst> [start_index]]]\n"
|
||||
"Where: \n"
|
||||
"- schema.exp is a file with EXPRESS schema \n"
|
||||
"- create.lst is a file with list of types to generate (all if none)\n"
|
||||
" (or \"-\" for creating all entities in the schema)\n"
|
||||
"- packaging.lst is a file with classes distribution per package\n"
|
||||
" in the form of the list (one item per line) \"<TypeName> <Package>\"\n"
|
||||
" If package not defined for some type, \"StepStep\" assumed\n"
|
||||
"- start_index - a first number for auxiliary generated files with data\n"
|
||||
" to copy into StepAP214_Protocol.cxx, RWStepAP214_GeneralModule.cxx and\n"
|
||||
" RWStepAP214_ReadWriteModule.cxx";
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=================================
|
||||
// Step 1: parsing EXPRESS file
|
||||
// open schema file
|
||||
OSD_Path aPath (argv[1]);
|
||||
OSD_File aFile (aPath);
|
||||
if (!aFile.IsReadable())
|
||||
{
|
||||
Message::SendFail() << "Error: Cannot open " << argv[1];
|
||||
return -1;
|
||||
}
|
||||
|
||||
// parse
|
||||
Message::SendInfo() << "Starting parsing " << argv[1];
|
||||
Handle(Express_Schema) aSchema = GetSchema (argv[1]);
|
||||
|
||||
if (aSchema.IsNull())
|
||||
{
|
||||
Message::SendFail() << "Error: Parsing finished with no result";
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Message::SendInfo() << "Schema " << aSchema->Name()->ToCString() << " successfully parsed";
|
||||
}
|
||||
Message::SendInfo() << "Total " << aSchema->NbItems() << " items";
|
||||
|
||||
//=================================
|
||||
// Step 2: Prepare data for creating classes
|
||||
|
||||
// load packaging information
|
||||
if (argc > 3)
|
||||
{
|
||||
if (!LoadList (argv[3], aSchema, Standard_False))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// load list of classes to generate
|
||||
if (argc > 2)
|
||||
{
|
||||
if (argv[2][0] == '-')
|
||||
{
|
||||
// set mark for all items
|
||||
for (Standard_Integer num = 1; num <= aSchema->NbItems(); num++)
|
||||
{
|
||||
aSchema->Item (num)->SetGenMode (Express_Item::GM_GenByUser);
|
||||
}
|
||||
}
|
||||
else if (!LoadList (argv[2], aSchema, Standard_True))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// get starting index
|
||||
Standard_Integer anIndex = -1;
|
||||
if (argc > 4)
|
||||
{
|
||||
char* aStopSymbol;
|
||||
anIndex = (Standard_Integer) strtol (argv[4], &aStopSymbol, 10);
|
||||
if (*aStopSymbol != '\0')
|
||||
{
|
||||
Message::SendFail() << "Error: invalid starting index: " << argv[4];
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//=================================
|
||||
// Step 3: Iterate over new items and set the package name if need
|
||||
const TCollection_AsciiString aUserName("user");
|
||||
for (Standard_Integer aNum = 1; aNum <= aSchema->NbItems(); aNum++)
|
||||
{
|
||||
if (aSchema->Item (aNum)->GetGenMode() == Express_Item::GM_GenByUser)
|
||||
{
|
||||
aSchema->Item (aNum)->Use2(aUserName, Express_Item::GetUnknownPackageName());
|
||||
}
|
||||
}
|
||||
|
||||
//=================================
|
||||
// Step 4: Iterate by items and generate classes
|
||||
Standard_Boolean isDone = Standard_False;
|
||||
Express_Item::SetIndex (anIndex);
|
||||
do
|
||||
{
|
||||
isDone = Standard_False;
|
||||
for (Standard_Integer aNum = 1; aNum <= aSchema->NbItems(); aNum++)
|
||||
{
|
||||
isDone = isDone || aSchema->Item (aNum)->Generate();
|
||||
}
|
||||
} while (isDone);
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
exptocas.lex
|
||||
expltocas.yacc
|
||||
lex.exptocas.cxx
|
||||
exptocas.tab.hxx
|
||||
exptocas.tab.cxx
|
||||
ExpToCasExe.cxx
|
||||
|
@@ -1,220 +0,0 @@
|
||||
// -*-C++-*-
|
||||
// FlexLexer.h -- define interfaces for lexical analyzer classes generated
|
||||
// by flex
|
||||
|
||||
// Copyright (c) 1993 The Regents of the University of California.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This code is derived from software contributed to Berkeley by
|
||||
// Kent Williams and Tom Epperly.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
|
||||
// Neither the name of the University nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
|
||||
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE.
|
||||
|
||||
// This file defines FlexLexer, an abstract class which specifies the
|
||||
// external interface provided to flex C++ lexer objects, and yyFlexLexer,
|
||||
// which defines a particular lexer class.
|
||||
//
|
||||
// If you want to create multiple lexer classes, you use the -P flag
|
||||
// to rename each yyFlexLexer to some other xxFlexLexer. You then
|
||||
// include <FlexLexer.h> in your other sources once per lexer class:
|
||||
//
|
||||
// #undef yyFlexLexer
|
||||
// #define yyFlexLexer xxFlexLexer
|
||||
// #include <FlexLexer.h>
|
||||
//
|
||||
// #undef yyFlexLexer
|
||||
// #define yyFlexLexer zzFlexLexer
|
||||
// #include <FlexLexer.h>
|
||||
// ...
|
||||
|
||||
#ifndef __FLEX_LEXER_H
|
||||
// Never included before - need to define base class.
|
||||
#define __FLEX_LEXER_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
extern "C++" {
|
||||
|
||||
struct yy_buffer_state;
|
||||
typedef int yy_state_type;
|
||||
|
||||
class FlexLexer
|
||||
{
|
||||
public:
|
||||
virtual ~FlexLexer() { }
|
||||
|
||||
const char* YYText() const { return yytext; }
|
||||
int YYLeng() const { return yyleng; }
|
||||
|
||||
virtual void
|
||||
yy_switch_to_buffer( yy_buffer_state* new_buffer ) = 0;
|
||||
virtual yy_buffer_state* yy_create_buffer( std::istream* s, int size ) = 0;
|
||||
virtual yy_buffer_state* yy_create_buffer( std::istream& s, int size ) = 0;
|
||||
virtual void yy_delete_buffer( yy_buffer_state* b ) = 0;
|
||||
virtual void yyrestart( std::istream* s ) = 0;
|
||||
virtual void yyrestart( std::istream& s ) = 0;
|
||||
|
||||
virtual int yylex() = 0;
|
||||
|
||||
// Call yylex with new input/output sources.
|
||||
int yylex( std::istream& new_in, std::ostream& new_out )
|
||||
{
|
||||
switch_streams( new_in, new_out );
|
||||
return yylex();
|
||||
}
|
||||
|
||||
int yylex( std::istream* new_in, std::ostream* new_out = 0)
|
||||
{
|
||||
switch_streams( new_in, new_out );
|
||||
return yylex();
|
||||
}
|
||||
|
||||
// Switch to new input/output streams. A nil stream pointer
|
||||
// indicates "keep the current one".
|
||||
virtual void switch_streams( std::istream* new_in,
|
||||
std::ostream* new_out ) = 0;
|
||||
virtual void switch_streams( std::istream& new_in,
|
||||
std::ostream& new_out ) = 0;
|
||||
|
||||
int lineno() const { return yylineno; }
|
||||
|
||||
int debug() const { return yy_flex_debug; }
|
||||
void set_debug( int flag ) { yy_flex_debug = flag; }
|
||||
|
||||
protected:
|
||||
char* yytext;
|
||||
int yyleng;
|
||||
int yylineno; // only maintained if you use %option yylineno
|
||||
int yy_flex_debug; // only has effect with -d or "%option debug"
|
||||
};
|
||||
|
||||
}
|
||||
#endif // FLEXLEXER_H
|
||||
|
||||
#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
|
||||
// Either this is the first time through (yyFlexLexerOnce not defined),
|
||||
// or this is a repeated include to define a different flavor of
|
||||
// yyFlexLexer, as discussed in the flex manual.
|
||||
# define yyFlexLexerOnce
|
||||
|
||||
extern "C++" {
|
||||
|
||||
class yyFlexLexer : public FlexLexer {
|
||||
public:
|
||||
// arg_yyin and arg_yyout default to the cin and cout, but we
|
||||
// only make that assignment when initializing in yylex().
|
||||
yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout );
|
||||
yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 );
|
||||
private:
|
||||
void ctor_common();
|
||||
|
||||
public:
|
||||
|
||||
virtual ~yyFlexLexer();
|
||||
|
||||
void yy_switch_to_buffer( yy_buffer_state* new_buffer );
|
||||
yy_buffer_state* yy_create_buffer( std::istream* s, int size );
|
||||
yy_buffer_state* yy_create_buffer( std::istream& s, int size );
|
||||
void yy_delete_buffer( yy_buffer_state* b );
|
||||
void yyrestart( std::istream* s );
|
||||
void yyrestart( std::istream& s );
|
||||
|
||||
void yypush_buffer_state( yy_buffer_state* new_buffer );
|
||||
void yypop_buffer_state();
|
||||
|
||||
virtual int yylex();
|
||||
virtual void switch_streams( std::istream& new_in, std::ostream& new_out );
|
||||
virtual void switch_streams( std::istream* new_in = 0, std::ostream* new_out = 0 );
|
||||
virtual int yywrap();
|
||||
|
||||
protected:
|
||||
virtual int LexerInput( char* buf, int max_size );
|
||||
virtual void LexerOutput( const char* buf, int size );
|
||||
virtual void LexerError( const char* msg );
|
||||
|
||||
void yyunput( int c, char* buf_ptr );
|
||||
int yyinput();
|
||||
|
||||
void yy_load_buffer_state();
|
||||
void yy_init_buffer( yy_buffer_state* b, std::istream& s );
|
||||
void yy_flush_buffer( yy_buffer_state* b );
|
||||
|
||||
int yy_start_stack_ptr;
|
||||
int yy_start_stack_depth;
|
||||
int* yy_start_stack;
|
||||
|
||||
void yy_push_state( int new_state );
|
||||
void yy_pop_state();
|
||||
int yy_top_state();
|
||||
|
||||
yy_state_type yy_get_previous_state();
|
||||
yy_state_type yy_try_NUL_trans( yy_state_type current_state );
|
||||
int yy_get_next_buffer();
|
||||
|
||||
std::istream yyin; // input source for default LexerInput
|
||||
std::ostream yyout; // output sink for default LexerOutput
|
||||
|
||||
// yy_hold_char holds the character lost when yytext is formed.
|
||||
char yy_hold_char;
|
||||
|
||||
// Number of characters read into yy_ch_buf.
|
||||
int yy_n_chars;
|
||||
|
||||
// Points to current character in buffer.
|
||||
char* yy_c_buf_p;
|
||||
|
||||
int yy_init; // whether we need to initialize
|
||||
int yy_start; // start state number
|
||||
|
||||
// Flag which is used to allow yywrap()'s to do buffer switches
|
||||
// instead of setting up a fresh yyin. A bit of a hack ...
|
||||
int yy_did_buffer_switch_on_eof;
|
||||
|
||||
|
||||
size_t yy_buffer_stack_top; /**< index of top of stack. */
|
||||
size_t yy_buffer_stack_max; /**< capacity of stack. */
|
||||
yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
|
||||
void yyensure_buffer_stack(void);
|
||||
|
||||
// The following are not always needed, but may be depending
|
||||
// on use of certain flex features (like REJECT or yymore()).
|
||||
|
||||
yy_state_type yy_last_accepting_state;
|
||||
char* yy_last_accepting_cpos;
|
||||
|
||||
yy_state_type* yy_state_buf;
|
||||
yy_state_type* yy_state_ptr;
|
||||
|
||||
char* yy_full_match;
|
||||
int* yy_full_state;
|
||||
int yy_full_lp;
|
||||
|
||||
int yy_lp;
|
||||
int yy_looking_for_trail_begin;
|
||||
|
||||
int yy_more_flag;
|
||||
int yy_more_len;
|
||||
int yy_more_offset;
|
||||
int yy_prev_more_offset;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // yyFlexLexer || ! yyFlexLexerOnce
|
@@ -1,171 +0,0 @@
|
||||
# STEP express schema to OCCT classes
|
||||
|
||||
## 1. Introduction
|
||||
|
||||
**ExpToCasExe** is an auxiliary tool to generate code for implementation
|
||||
of new STEP entities into OCCT.
|
||||
This tool consists of two packages: **ExpToCasExe** and **TKExpress**.
|
||||
|
||||
*ExpToCasExe* package is the basic package for generation.
|
||||
It parses the express schema, makes a list of entities described in the schema,
|
||||
and starts generating classes according to the specified lists.
|
||||
This package has the file *occt_existed_step_entities.lst* witch contains list
|
||||
of STEP entities implemented in *OCCT* at this moment.
|
||||
|
||||
*TKExpress* package generates files with description of the STEP entities
|
||||
to use in *OCCT* taking into account their dependencies.
|
||||
Below is a set of generated files using the example
|
||||
of the *Condition* entity from the *StepAP214* package.
|
||||
|
||||
* **StepAP214_Condition.hxx** - contains declaration of the class that describes STEP entity
|
||||
* **StepAP214_Condition.cxx** - contains definition of the class that describes STEP entity
|
||||
* **RWStepAP214_RWCondition.hxx** - contains declaration of the class that reads (writes) STEP entity from STEP file
|
||||
* **RWStepAP214_RWCondition.cxx** - contains definition of the class that reads (writes) STEP entity from STEP file
|
||||
* **category.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_GeneralModule.cxx* file
|
||||
* **fillshared.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_GeneralModule.cxx* file
|
||||
* **inc.txt** - common file for all generated entities with part of code to insert to *StepAP214_Protocol.cxx*
|
||||
* **newvoid.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_GeneralModule.cxx* file
|
||||
* **protocol.txt** - common file for all generated entities with part of code to insert to *StepAP214_Protocol.cxx* file
|
||||
* **readstep.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_ReadWriteModule.cxx* file
|
||||
* **reco.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_ReadWriteModule.cxx* file
|
||||
* **rwinc.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_ReadWriteModule.cxx* file
|
||||
* **steptype.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_ReadWriteModule.cxx* file
|
||||
* **typebind.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_ReadWriteModule.cxx* file
|
||||
* **writestep.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_ReadWriteModule.cxx* file
|
||||
|
||||
## 2. Build
|
||||
|
||||
The build process is automated, but has some specifics. *ExpToCasExe* package contains file *exptocas.lex*
|
||||
which contains rules for lexical analyzer builder (*FLEX*), and file *exptocas.yacc*
|
||||
which contains rules for syntax analyzer builder (*GNU Bison*).
|
||||
|
||||
During build process *FLEX* and *Bison* generate the next files:
|
||||
|
||||
* FlexLexer.h
|
||||
* lex.exptocas.cxx
|
||||
* exptocas.tab.cxx
|
||||
* exptocas.tab.hxx
|
||||
|
||||
These files are placed to the source directory ("*src/ExpToCasExe*") due to *CMAKE* script specific.
|
||||
Then standard Visual Studio build process continues.
|
||||
|
||||
There is no necessary to include these files to the *git* repository, due to automatic generation.
|
||||
To change the behaviour of Express schema parser, the user need to modify original files:
|
||||
*exptocas.lex* and *exptocas.yacc*.
|
||||
|
||||
## 3. Usage
|
||||
|
||||
**ExpToCasExe** program has the following call pattern:
|
||||
|
||||
~~~~
|
||||
> ExpToCasExe <schema.exp> [<new.lst> [<existed.lst> [start_index]]]
|
||||
~~~~
|
||||
|
||||
where:
|
||||
|
||||
* **schema.exp** - file with STEP Express schema
|
||||
* **new.lst** - file with list of new STEP entities which we have to generate
|
||||
* **existed.lst** - file with list of already implemented STEP entities
|
||||
* **start_index** - a first index for entity registration
|
||||
(value of it you can receive after analyse of *StepAP214_Protocol.cxx* file)
|
||||
|
||||
If *new.lst* file is set to "-" then all entities from Express schema are considered as new.
|
||||
|
||||
*new.lst* and *existed.lst* are the text files. Line in file describes the class name
|
||||
of STEP entity and to witch *OCCT* package it's belong. Line has the following format:
|
||||
|
||||
~~~~
|
||||
item_name package_name [shortname [check_flag(0 or 1) [fillshared_flag(0 or 1) [category]]]]
|
||||
~~~~
|
||||
|
||||
where:
|
||||
|
||||
* **item_name** is the class name of the STEP entity (*ProductDefinitionOrReference* for example)
|
||||
* **package_name** is the name of the *OCCT* package (*StepBasic* for example)
|
||||
* **shortname** is the short name of the STEP entity
|
||||
* **check_flag** is the flag to generate the *Check* function in the class
|
||||
* **fillshared_flag** is the flag to generate the *FillShared* function in the class
|
||||
* **category** is the name of category to witch entity belongs to
|
||||
|
||||
These file can include comments after the symbol "#".
|
||||
|
||||
The result of generation consists of several folders:
|
||||
|
||||
* two folders (*\_package_name\_* and *RW\_package_name\_*) for each package for which new entities were generated.
|
||||
* a folder *Registration* with *\*.txt* files with code to copy into common files (see the example in the first section).
|
||||
|
||||
For generation, it is easy to copy to separate directory following files:
|
||||
|
||||
* **ExpToCasExe.exe**, **TKernel.dll** and **TKExpress.dll** from OCCT
|
||||
* STEP Express schema
|
||||
* **occt_existed_step_entities.lst** from package *ExpToCasExe*
|
||||
|
||||
create a file with needed entities **new.lst** and from this directory execute command:
|
||||
|
||||
~~~~
|
||||
> ExpToCasExe.exe schema.exp new.lst occt_existed_step_entities.lst 1000
|
||||
~~~~
|
||||
|
||||
## 4. Disclaimer
|
||||
|
||||
**NOTE**:
|
||||
Some STEP schemes may be not fully corresponded to the rules which set in our generator.
|
||||
If during generation we receive a message about syntax error you can try to edit schema
|
||||
file in order to avoid it. Such approach is reasonable if number of errors is small.
|
||||
If there are many errors we have to change existed rules (for debug parser process you can
|
||||
uncomment string "//aScanner.set_debug(1);" in the file *exptocas.yacc*).
|
||||
TIP: remove upper case from name after SCHEMA key word.
|
||||
|
||||
**NOTE**:
|
||||
Please, take into account that most of existed entities were generated many years ago.
|
||||
Some of them can be not corresponded to last versions of schemes.
|
||||
|
||||
For example, we don't have classes for entity:
|
||||
|
||||
~~~~
|
||||
ENTITY founded_item
|
||||
SUPERTYPE OF ((ONEOF(b_spline_curve_knot_locator, b_spline_curve_segment, b_spline_surface_knot_locator,
|
||||
b_spline_surface_patch, b_spline_surface_strip,
|
||||
boundary_curve_of_b_spline_or_rectangular_composite_surface, box_domain,
|
||||
character_glyph_style_outline, character_glyph_style_stroke, composite_curve_segment,
|
||||
composite_curve_transition_locator, curve_style, curve_style_font, curve_style_font_and_scaling,
|
||||
curve_style_font_pattern, externally_defined_style, fill_area_style,
|
||||
interpolated_configuration_segment, kinematic_path_segment, plane_angle_and_length_pair,
|
||||
plane_angle_and_ratio_pair, point_style, presentation_style_assignment,
|
||||
rectangular_composite_surface_transition_locator, surface_patch, surface_side_style,
|
||||
surface_style_boundary, surface_style_control_grid, surface_style_fill_area,
|
||||
surface_style_parameter_line, surface_style_segmentation_curve, surface_style_silhouette,
|
||||
surface_style_usage, symbol_style, text_style, view_volume)) ANDOR
|
||||
(ONEOF(character_glyph_style_outline, character_glyph_style_stroke, curve_style, curve_style_font,
|
||||
curve_style_font_and_scaling, curve_style_font_pattern, externally_defined_style,
|
||||
fill_area_style, point_style, presentation_style_assignment, surface_side_style,
|
||||
surface_style_boundary, surface_style_control_grid, surface_style_fill_area,
|
||||
surface_style_parameter_line, surface_style_segmentation_curve, surface_style_silhouette,
|
||||
surface_style_usage, symbol_style, text_style)));
|
||||
DERIVE
|
||||
users : SET [0 : ?] OF founded_item_select := using_items(SELF, []);
|
||||
WHERE
|
||||
WR1: SIZEOF(users) > 0;
|
||||
WR2: NOT (SELF IN users);
|
||||
END_ENTITY;
|
||||
~~~~
|
||||
|
||||
But some of existed entities (for example - *composite_curve_segment*) must be inherited from
|
||||
this missing entity (at present such existed entities are inherited from *Standard_Transient*):
|
||||
|
||||
~~~~
|
||||
ENTITY composite_curve_segment
|
||||
SUBTYPE OF (founded_item);
|
||||
transition : transition_code;
|
||||
same_sense : BOOLEAN;
|
||||
parent_curve : curve;
|
||||
INVERSE
|
||||
using_curves : BAG[1:?] OF composite_curve FOR segments;
|
||||
WHERE
|
||||
wr1 : ('AUTOMOTIVE_DESIGN.BOUNDED_CURVE' IN TYPEOF(parent_curve));
|
||||
END_ENTITY; -- 10303-42: geometry_schema
|
||||
~~~~
|
||||
|
||||
**NOTE**: To facilitate the work of those who will use this program after you,
|
||||
it is strongly recommended update the file **occt_existed_step_entities.lst**
|
||||
after each generation and not to forget to change update date in the first line of this file.
|
@@ -1,203 +0,0 @@
|
||||
%{
|
||||
|
||||
// Created: Thu Oct 28 12:21:16 1999
|
||||
// Author: Andrey BETENEV
|
||||
// Copyright (c) 1999-2020 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.
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
This LEX scanner is performs lexical analysis of EXPRESS schema file
|
||||
for EXPRESS -> CASCADE/XSTEP classes generator
|
||||
|
||||
On the stage of lexical scanner comments (single- and multi-line),
|
||||
definitions of CONSTANT, FUNCTION, RULE items and clauses WHERE, INVERSE
|
||||
and DERIVE of TYPE amd ENTITY items are dismissed (ignored)
|
||||
|
||||
Then, keywords such as ENTITY, SUPERTYPE, SET etc., names of items
|
||||
and special symbols are identified and returned to parser (yacc) as tokens
|
||||
|
||||
Also, error processing and current line number tracking functions are defined
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/************************************/
|
||||
/* Section 1 */
|
||||
/* definitions */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <TColStd_HSequenceOfHAsciiString.hxx>
|
||||
#include <Express_HSequenceOfField.hxx>
|
||||
#include <Express_HSequenceOfItem.hxx>
|
||||
#include <Express_Field.hxx>
|
||||
#include <Express_Item.hxx>
|
||||
#include <Express_Type.hxx>
|
||||
#include <Express_Schema.hxx>
|
||||
#include <Express_Reference.hxx>
|
||||
|
||||
#include "exptocas.tab.hxx" /* define tokens */
|
||||
|
||||
/* Auxiliary functions */
|
||||
|
||||
static int fun_level=0;
|
||||
static int ec_linenum=1;
|
||||
static int ec_state = 0;
|
||||
|
||||
int yywrap(void) { return 1; }
|
||||
|
||||
int ec_curline ( void )
|
||||
{
|
||||
return ec_linenum;
|
||||
}
|
||||
|
||||
int ec_error ( const std::string& s, const std::string& text )
|
||||
{
|
||||
printf ( "\nError at line %d: %s \"%s\"\n", ec_curline(), s.c_str(), text.c_str() );
|
||||
return 0;
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
/*
|
||||
c++ generate C++ parser class
|
||||
*/
|
||||
%option c++
|
||||
%option noyywrap
|
||||
%option yyclass="exptocas::scanner"
|
||||
%option nounistd
|
||||
|
||||
%s TYP ENT
|
||||
%x COMM SKP RULE FUN
|
||||
|
||||
%a 4000
|
||||
%o 6000
|
||||
|
||||
%top{
|
||||
// Pre-include stdlib.h to avoid redefinition of integer type macros (INT8_MIN and similar in generated code)
|
||||
#if !defined(_MSC_VER) || (_MSC_VER >= 1600) // Visual Studio 2010+
|
||||
#include "stdint.h"
|
||||
#endif
|
||||
}
|
||||
|
||||
%{
|
||||
|
||||
// Tell flex which function to define
|
||||
#ifdef YY_DECL
|
||||
# undef YY_DECL
|
||||
#endif
|
||||
#define YY_DECL int exptocas::scanner::lex (exptocas::parser::semantic_type* yylval)
|
||||
|
||||
typedef exptocas::parser::token token;
|
||||
|
||||
/************************************/
|
||||
/* Section 2 */
|
||||
/* parsing rules */
|
||||
%}
|
||||
|
||||
%%
|
||||
|
||||
"--".* { /* Eat line comments */ }
|
||||
"(*" { ec_state = YYSTATE; BEGIN(COMM); }
|
||||
<COMM>. { /* Eat multiline comments */ }
|
||||
<COMM>"*)" { BEGIN(ec_state); }
|
||||
|
||||
"SCHEMA" { return yylval->num = token::KSCHEM; }
|
||||
"END_SCHEMA" { return yylval->num = token::KENDS; }
|
||||
|
||||
"TYPE" { BEGIN(TYP); return yylval->num = token::KTYP; }
|
||||
<TYP,SKP>"END_TYPE" { BEGIN(0); return yylval->num = token::KENDT; }
|
||||
|
||||
"ENTITY" { BEGIN(ENT); return yylval->num = token::KENT; }
|
||||
<ENT,SKP>"END_ENTITY" { BEGIN(0); return yylval->num = token::KENDE; }
|
||||
|
||||
<ENT>"INVERSE" |
|
||||
<ENT>"DERIVE" |
|
||||
<ENT,TYP>"WHERE" { BEGIN(SKP); }
|
||||
<SKP>. { /* eat contents of WHERE and DERIVE subclauses of ENTITY and TYPE */ }
|
||||
|
||||
"SELECT" { return yylval->num = token::KSEL; }
|
||||
"ENUMERATION" { return yylval->num = token::KENUM; }
|
||||
"LIST" { return yylval->num = token::KLIST; }
|
||||
"ARRAY" { return yylval->num = token::KARR; }
|
||||
"SET" { return yylval->num = token::KSET; }
|
||||
"BAG" { return yylval->num = token::KBAG; }
|
||||
"OF" { return yylval->num = token::KOF; }
|
||||
|
||||
"NUMBER" { return yylval->num = token::KNUM; }
|
||||
"INTEGER" { return yylval->num = token::KINT; }
|
||||
"REAL" { return yylval->num = token::KDBL; }
|
||||
"STRING" { return yylval->num = token::KSTR; }
|
||||
"LOGICAL" { return yylval->num = token::KLOG; }
|
||||
"BOOLEAN" { return yylval->num = token::KBOOL; }
|
||||
|
||||
"OPTIONAL" { return yylval->num = token::KOPT; }
|
||||
"UNIQUE" { return yylval->num = token::KUNIQ; }
|
||||
"SELF" { return yylval->num = token::KSELF; }
|
||||
|
||||
"ABSTRACT" { return yylval->num = token::KABSTR; }
|
||||
"SUBTYPE" { return yylval->num = token::KSUBT; }
|
||||
"SUPERTYPE" { return yylval->num = token::KSPRT; }
|
||||
"ANDOR" { return yylval->num = token::KANDOR; }
|
||||
"ONEOF" { return yylval->num = token::K1OF; }
|
||||
"AND" { return yylval->num = token::KAND; }
|
||||
|
||||
"UR"[0-9]+ { yylval->str = strdup ( yytext ); return token::NAME; }
|
||||
|
||||
[a-z_][a-z_0-9]* { yylval->str = strdup ( yytext ); return token::NAME; }
|
||||
|
||||
[0-9]+ { yylval->num = atoi ( yytext ); return token::NUMBER; }
|
||||
[,=();?:.\\]|"["|"]" { return yylval->num = yytext[0]; }
|
||||
|
||||
<INITIAL,FUN>"FUNCTION" { BEGIN(FUN); fun_level++; }
|
||||
<FUN>"(*" { ec_state = YYSTATE; BEGIN(COMM); /* eat comments in functions */ }
|
||||
<FUN>"--".* { /* Eat line comments in functions */ }
|
||||
<FUN>[A-Za-z_0-9]* { /* eat FUNCTIONs - skip IDs explicitly */ }
|
||||
<FUN>\'[^\']*\' { /* eat FUNCTIONs - skip strings explicitly */ }
|
||||
<FUN>. { /* eat FUNCTIONs - skip all other symbols in functions */ }
|
||||
<FUN>"END_FUNCTION;" { fun_level--; if ( ! fun_level ) BEGIN(0); }
|
||||
|
||||
"RULE" { BEGIN(RULE); /* eat RULEs */ }
|
||||
<RULE>. { /* eat RULEs */ }
|
||||
<RULE>"END_RULE;" { BEGIN(0); }
|
||||
|
||||
"CONSTANT"[ \t\na-z_0-9:=;'()|-]+"END_CONSTANT;" { /* eat CONSTANTs */
|
||||
char *s = yytext; /* but don't forget to count lines.. */
|
||||
while ( *s ) if ( *(s++) == '\n' ) ec_linenum++;
|
||||
}
|
||||
|
||||
[ \t]+ { /* eat spaces */ }
|
||||
[A-Za-z0-9_]+ { ec_error ( "unknown keyword ", yytext ); /* put unrecognized keywords to cerr */ }
|
||||
. { ec_error ( "unknown symbol ", yytext ); /* put unrecognized data to cerr */ }
|
||||
|
||||
<INITIAL,COMM,SKP,RULE,ENT,TYP,FUN>\n { ec_linenum++; /* count lines */ }
|
||||
|
||||
%%
|
||||
|
||||
/************************************/
|
||||
/* Section 3 */
|
||||
/* auxiliary procedures */
|
||||
|
||||
exptocas::scanner::scanner(std::istream* in, std::ostream* out)
|
||||
: exptocasFlexLexer(in, out)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
int main ( void )
|
||||
{
|
||||
yylex();
|
||||
}
|
||||
*/
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,910 +0,0 @@
|
||||
// A Bison parser, made by GNU Bison 3.7.4.
|
||||
|
||||
// Skeleton interface for Bison LALR(1) parsers in C++
|
||||
|
||||
// Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// As a special exception, you may create a larger work that contains
|
||||
// part or all of the Bison parser skeleton and distribute that work
|
||||
// under terms of your choice, so long as that work isn't itself a
|
||||
// parser generator using the skeleton or a modified version thereof
|
||||
// as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
// the parser skeleton itself, you may (at your option) remove this
|
||||
// special exception, which will cause the skeleton and the resulting
|
||||
// Bison output files to be licensed under the GNU General Public
|
||||
// License without this special exception.
|
||||
|
||||
// This special exception was added by the Free Software Foundation in
|
||||
// version 2.2 of Bison.
|
||||
|
||||
|
||||
/**
|
||||
** \file ExpToCasExe/exptocas.tab.hxx
|
||||
** Define the exptocas::parser class.
|
||||
*/
|
||||
|
||||
// C++ LALR(1) parser skeleton written by Akim Demaille.
|
||||
|
||||
// DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
|
||||
// especially those whose name start with YY_ or yy_. They are
|
||||
// private implementation details that can be changed or removed.
|
||||
|
||||
#ifndef YY_EXPTOCAS_EXPTOCASEXE_EXPTOCAS_TAB_HXX_INCLUDED
|
||||
# define YY_EXPTOCAS_EXPTOCASEXE_EXPTOCAS_TAB_HXX_INCLUDED
|
||||
// "%code requires" blocks.
|
||||
|
||||
#include <OSD_OpenFile.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <TColStd_HSequenceOfHAsciiString.hxx>
|
||||
#include <Express_HSequenceOfField.hxx>
|
||||
#include <Express_HSequenceOfItem.hxx>
|
||||
#include <Express_Field.hxx>
|
||||
#include <Express_Item.hxx>
|
||||
#include <Express_Enum.hxx>
|
||||
#include <Express_Alias.hxx>
|
||||
#include <Express_Select.hxx>
|
||||
#include <Express_Entity.hxx>
|
||||
#include <Express_Type.hxx>
|
||||
#include <Express_NamedType.hxx>
|
||||
#include <Express_PredefinedType.hxx>
|
||||
#include <Express_Number.hxx>
|
||||
#include <Express_Integer.hxx>
|
||||
#include <Express_Boolean.hxx>
|
||||
#include <Express_Logical.hxx>
|
||||
#include <Express_Real.hxx>
|
||||
#include <Express_String.hxx>
|
||||
#include <Express_ComplexType.hxx>
|
||||
#include <Express_Array.hxx>
|
||||
#include <Express_List.hxx>
|
||||
#include <Express_Set.hxx>
|
||||
#include <Express_Bag.hxx>
|
||||
#include <Express_Schema.hxx>
|
||||
#include <Express_Reference.hxx>
|
||||
#include <Express.hxx>
|
||||
|
||||
namespace exptocas {
|
||||
class scanner;
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
// disable MSVC warning C4522: 'exptocas::parser::stack_symbol_type': multiple assignment operators
|
||||
#pragma warning(disable: 4522)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
# include <cstdlib> // std::abort
|
||||
# include <iostream>
|
||||
# include <stdexcept>
|
||||
# include <string>
|
||||
# include <vector>
|
||||
|
||||
#if defined __cplusplus
|
||||
# define YY_CPLUSPLUS __cplusplus
|
||||
#else
|
||||
# define YY_CPLUSPLUS 199711L
|
||||
#endif
|
||||
|
||||
// Support move semantics when possible.
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
# define YY_MOVE std::move
|
||||
# define YY_MOVE_OR_COPY move
|
||||
# define YY_MOVE_REF(Type) Type&&
|
||||
# define YY_RVREF(Type) Type&&
|
||||
# define YY_COPY(Type) Type
|
||||
#else
|
||||
# define YY_MOVE
|
||||
# define YY_MOVE_OR_COPY copy
|
||||
# define YY_MOVE_REF(Type) Type&
|
||||
# define YY_RVREF(Type) const Type&
|
||||
# define YY_COPY(Type) const Type&
|
||||
#endif
|
||||
|
||||
// Support noexcept when possible.
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
# define YY_NOEXCEPT noexcept
|
||||
# define YY_NOTHROW
|
||||
#else
|
||||
# define YY_NOEXCEPT
|
||||
# define YY_NOTHROW throw ()
|
||||
#endif
|
||||
|
||||
// Support constexpr when possible.
|
||||
#if 201703 <= YY_CPLUSPLUS
|
||||
# define YY_CONSTEXPR constexpr
|
||||
#else
|
||||
# define YY_CONSTEXPR
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef YY_ATTRIBUTE_PURE
|
||||
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
|
||||
# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
# else
|
||||
# define YY_ATTRIBUTE_PURE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef YY_ATTRIBUTE_UNUSED
|
||||
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
|
||||
# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define YY_ATTRIBUTE_UNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Suppress unused-variable warnings by "using" E. */
|
||||
#if ! defined lint || defined __GNUC__
|
||||
# define YYUSE(E) ((void) (E))
|
||||
#else
|
||||
# define YYUSE(E) /* empty */
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
||||
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
||||
_Pragma ("GCC diagnostic pop")
|
||||
#else
|
||||
# define YY_INITIAL_VALUE(Value) Value
|
||||
#endif
|
||||
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||
#endif
|
||||
#ifndef YY_INITIAL_VALUE
|
||||
# define YY_INITIAL_VALUE(Value) /* Nothing. */
|
||||
#endif
|
||||
|
||||
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
|
||||
# define YY_IGNORE_USELESS_CAST_BEGIN \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
|
||||
# define YY_IGNORE_USELESS_CAST_END \
|
||||
_Pragma ("GCC diagnostic pop")
|
||||
#endif
|
||||
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
|
||||
# define YY_IGNORE_USELESS_CAST_BEGIN
|
||||
# define YY_IGNORE_USELESS_CAST_END
|
||||
#endif
|
||||
|
||||
# ifndef YY_CAST
|
||||
# ifdef __cplusplus
|
||||
# define YY_CAST(Type, Val) static_cast<Type> (Val)
|
||||
# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
|
||||
# else
|
||||
# define YY_CAST(Type, Val) ((Type) (Val))
|
||||
# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
|
||||
# endif
|
||||
# endif
|
||||
# ifndef YY_NULLPTR
|
||||
# if defined __cplusplus
|
||||
# if 201103L <= __cplusplus
|
||||
# define YY_NULLPTR nullptr
|
||||
# else
|
||||
# define YY_NULLPTR 0
|
||||
# endif
|
||||
# else
|
||||
# define YY_NULLPTR ((void*)0)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 0
|
||||
#endif
|
||||
|
||||
namespace exptocas {
|
||||
|
||||
|
||||
|
||||
|
||||
/// A Bison parser.
|
||||
class parser
|
||||
{
|
||||
public:
|
||||
#ifndef YYSTYPE
|
||||
/// Symbol semantic values.
|
||||
union semantic_type
|
||||
{
|
||||
|
||||
int num;
|
||||
char *str;
|
||||
TColStd_HSequenceOfHAsciiString *tlist;
|
||||
Express_HSequenceOfField *flist;
|
||||
Express_HSequenceOfItem *ilist;
|
||||
Express_Field *field;
|
||||
Express_Item *item;
|
||||
Express_Type *type;
|
||||
Express_Schema *schema;
|
||||
Express_Reference *ref;
|
||||
|
||||
|
||||
};
|
||||
#else
|
||||
typedef YYSTYPE semantic_type;
|
||||
#endif
|
||||
|
||||
/// Syntax errors thrown from user actions.
|
||||
struct syntax_error : std::runtime_error
|
||||
{
|
||||
syntax_error (const std::string& m)
|
||||
: std::runtime_error (m)
|
||||
{}
|
||||
|
||||
syntax_error (const syntax_error& s)
|
||||
: std::runtime_error (s.what ())
|
||||
{}
|
||||
|
||||
~syntax_error () YY_NOEXCEPT YY_NOTHROW;
|
||||
};
|
||||
|
||||
/// Token kinds.
|
||||
struct token
|
||||
{
|
||||
enum token_kind_type
|
||||
{
|
||||
YYEMPTY = -2,
|
||||
YYEOF = 0, // "end of file"
|
||||
YYerror = 256, // error
|
||||
YYUNDEF = 257, // "invalid token"
|
||||
KSCHEM = 258, // KSCHEM
|
||||
KENDS = 259, // KENDS
|
||||
KTYP = 260, // KTYP
|
||||
KENDT = 261, // KENDT
|
||||
KENT = 262, // KENT
|
||||
KENDE = 263, // KENDE
|
||||
KREF = 264, // KREF
|
||||
KFROM = 265, // KFROM
|
||||
KSEL = 266, // KSEL
|
||||
KENUM = 267, // KENUM
|
||||
KLIST = 268, // KLIST
|
||||
KARR = 269, // KARR
|
||||
KBAG = 270, // KBAG
|
||||
KSET = 271, // KSET
|
||||
KOF = 272, // KOF
|
||||
KNUM = 273, // KNUM
|
||||
KINT = 274, // KINT
|
||||
KDBL = 275, // KDBL
|
||||
KSTR = 276, // KSTR
|
||||
KLOG = 277, // KLOG
|
||||
KBOOL = 278, // KBOOL
|
||||
KOPT = 279, // KOPT
|
||||
KUNIQ = 280, // KUNIQ
|
||||
KSELF = 281, // KSELF
|
||||
KABSTR = 282, // KABSTR
|
||||
KSUBT = 283, // KSUBT
|
||||
KSPRT = 284, // KSPRT
|
||||
KANDOR = 285, // KANDOR
|
||||
K1OF = 286, // K1OF
|
||||
KAND = 287, // KAND
|
||||
NUMBER = 288, // NUMBER
|
||||
NAME = 289 // NAME
|
||||
};
|
||||
/// Backward compatibility alias (Bison 3.6).
|
||||
typedef token_kind_type yytokentype;
|
||||
};
|
||||
|
||||
/// Token kind, as returned by yylex.
|
||||
typedef token::yytokentype token_kind_type;
|
||||
|
||||
/// Backward compatibility alias (Bison 3.6).
|
||||
typedef token_kind_type token_type;
|
||||
|
||||
/// Symbol kinds.
|
||||
struct symbol_kind
|
||||
{
|
||||
enum symbol_kind_type
|
||||
{
|
||||
YYNTOKENS = 46, ///< Number of tokens.
|
||||
S_YYEMPTY = -2,
|
||||
S_YYEOF = 0, // "end of file"
|
||||
S_YYerror = 1, // error
|
||||
S_YYUNDEF = 2, // "invalid token"
|
||||
S_KSCHEM = 3, // KSCHEM
|
||||
S_KENDS = 4, // KENDS
|
||||
S_KTYP = 5, // KTYP
|
||||
S_KENDT = 6, // KENDT
|
||||
S_KENT = 7, // KENT
|
||||
S_KENDE = 8, // KENDE
|
||||
S_KREF = 9, // KREF
|
||||
S_KFROM = 10, // KFROM
|
||||
S_KSEL = 11, // KSEL
|
||||
S_KENUM = 12, // KENUM
|
||||
S_KLIST = 13, // KLIST
|
||||
S_KARR = 14, // KARR
|
||||
S_KBAG = 15, // KBAG
|
||||
S_KSET = 16, // KSET
|
||||
S_KOF = 17, // KOF
|
||||
S_KNUM = 18, // KNUM
|
||||
S_KINT = 19, // KINT
|
||||
S_KDBL = 20, // KDBL
|
||||
S_KSTR = 21, // KSTR
|
||||
S_KLOG = 22, // KLOG
|
||||
S_KBOOL = 23, // KBOOL
|
||||
S_KOPT = 24, // KOPT
|
||||
S_KUNIQ = 25, // KUNIQ
|
||||
S_KSELF = 26, // KSELF
|
||||
S_KABSTR = 27, // KABSTR
|
||||
S_KSUBT = 28, // KSUBT
|
||||
S_KSPRT = 29, // KSPRT
|
||||
S_KANDOR = 30, // KANDOR
|
||||
S_K1OF = 31, // K1OF
|
||||
S_KAND = 32, // KAND
|
||||
S_NUMBER = 33, // NUMBER
|
||||
S_NAME = 34, // NAME
|
||||
S_35_ = 35, // ','
|
||||
S_36_ = 36, // ';'
|
||||
S_37_ = 37, // '='
|
||||
S_38_ = 38, // '('
|
||||
S_39_ = 39, // ')'
|
||||
S_40_ = 40, // '['
|
||||
S_41_ = 41, // ':'
|
||||
S_42_ = 42, // ']'
|
||||
S_43_ = 43, // '?'
|
||||
S_44_ = 44, // '\\'
|
||||
S_45_ = 45, // '.'
|
||||
S_YYACCEPT = 46, // $accept
|
||||
S_SCHEMA = 47, // SCHEMA
|
||||
S_ILIST = 48, // ILIST
|
||||
S_ITEM = 49, // ITEM
|
||||
S_ENUM = 50, // ENUM
|
||||
S_SELECT = 51, // SELECT
|
||||
S_ALIAS = 52, // ALIAS
|
||||
S_ENTITY = 53, // ENTITY
|
||||
S_REFERENCE = 54, // REFERENCE
|
||||
S_TLIST = 55, // TLIST
|
||||
S_TLIST1 = 56, // TLIST1
|
||||
S_TYPE = 57, // TYPE
|
||||
S_TSTD = 58, // TSTD
|
||||
S_TNAME = 59, // TNAME
|
||||
S_TSET = 60, // TSET
|
||||
S_INDEX = 61, // INDEX
|
||||
S_OPTUNI = 62, // OPTUNI
|
||||
S_SUBT = 63, // SUBT
|
||||
S_SUPERT = 64, // SUPERT
|
||||
S_SUPLST = 65, // SUPLST
|
||||
S_FLIST = 66, // FLIST
|
||||
S_FLIST1 = 67, // FLIST1
|
||||
S_FIELD = 68, // FIELD
|
||||
S_REDEF = 69, // REDEF
|
||||
S_SPECIF = 70, // SPECIF
|
||||
S_OPTNL = 71, // OPTNL
|
||||
S_UNIQIT = 72, // UNIQIT
|
||||
S_UNIQLS = 73, // UNIQLS
|
||||
S_UNIQUE = 74, // UNIQUE
|
||||
S_SPCLST = 75 // SPCLST
|
||||
};
|
||||
};
|
||||
|
||||
/// (Internal) symbol kind.
|
||||
typedef symbol_kind::symbol_kind_type symbol_kind_type;
|
||||
|
||||
/// The number of tokens.
|
||||
static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS;
|
||||
|
||||
/// A complete symbol.
|
||||
///
|
||||
/// Expects its Base type to provide access to the symbol kind
|
||||
/// via kind ().
|
||||
///
|
||||
/// Provide access to semantic value.
|
||||
template <typename Base>
|
||||
struct basic_symbol : Base
|
||||
{
|
||||
/// Alias to Base.
|
||||
typedef Base super_type;
|
||||
|
||||
/// Default constructor.
|
||||
basic_symbol ()
|
||||
: value ()
|
||||
{}
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
/// Move constructor.
|
||||
basic_symbol (basic_symbol&& that)
|
||||
: Base (std::move (that))
|
||||
, value (std::move (that.value))
|
||||
{}
|
||||
#endif
|
||||
|
||||
/// Copy constructor.
|
||||
basic_symbol (const basic_symbol& that);
|
||||
/// Constructor for valueless symbols.
|
||||
basic_symbol (typename Base::kind_type t);
|
||||
|
||||
/// Constructor for symbols with semantic value.
|
||||
basic_symbol (typename Base::kind_type t,
|
||||
YY_RVREF (semantic_type) v);
|
||||
|
||||
/// Destroy the symbol.
|
||||
~basic_symbol ()
|
||||
{
|
||||
clear ();
|
||||
}
|
||||
|
||||
/// Destroy contents, and record that is empty.
|
||||
void clear ()
|
||||
{
|
||||
Base::clear ();
|
||||
}
|
||||
|
||||
#if YYDEBUG || 0
|
||||
/// The user-facing name of this symbol.
|
||||
const char *name () const YY_NOEXCEPT
|
||||
{
|
||||
return parser::symbol_name (this->kind ());
|
||||
}
|
||||
#endif // #if YYDEBUG || 0
|
||||
|
||||
|
||||
/// Backward compatibility (Bison 3.6).
|
||||
symbol_kind_type type_get () const YY_NOEXCEPT;
|
||||
|
||||
/// Whether empty.
|
||||
bool empty () const YY_NOEXCEPT;
|
||||
|
||||
/// Destructive move, \a s is emptied into this.
|
||||
void move (basic_symbol& s);
|
||||
|
||||
/// The semantic value.
|
||||
semantic_type value;
|
||||
|
||||
private:
|
||||
#if YY_CPLUSPLUS < 201103L
|
||||
/// Assignment operator.
|
||||
basic_symbol& operator= (const basic_symbol& that);
|
||||
#endif
|
||||
};
|
||||
|
||||
/// Type access provider for token (enum) based symbols.
|
||||
struct by_kind
|
||||
{
|
||||
/// Default constructor.
|
||||
by_kind ();
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
/// Move constructor.
|
||||
by_kind (by_kind&& that);
|
||||
#endif
|
||||
|
||||
/// Copy constructor.
|
||||
by_kind (const by_kind& that);
|
||||
|
||||
/// The symbol kind as needed by the constructor.
|
||||
typedef token_kind_type kind_type;
|
||||
|
||||
/// Constructor from (external) token numbers.
|
||||
by_kind (kind_type t);
|
||||
|
||||
/// Record that this symbol is empty.
|
||||
void clear ();
|
||||
|
||||
/// Steal the symbol kind from \a that.
|
||||
void move (by_kind& that);
|
||||
|
||||
/// The (internal) type number (corresponding to \a type).
|
||||
/// \a empty when empty.
|
||||
symbol_kind_type kind () const YY_NOEXCEPT;
|
||||
|
||||
/// Backward compatibility (Bison 3.6).
|
||||
symbol_kind_type type_get () const YY_NOEXCEPT;
|
||||
|
||||
/// The symbol kind.
|
||||
/// \a S_YYEMPTY when empty.
|
||||
symbol_kind_type kind_;
|
||||
};
|
||||
|
||||
/// Backward compatibility for a private implementation detail (Bison 3.6).
|
||||
typedef by_kind by_type;
|
||||
|
||||
/// "External" symbols: returned by the scanner.
|
||||
struct symbol_type : basic_symbol<by_kind>
|
||||
{};
|
||||
|
||||
/// Build a parser object.
|
||||
parser (exptocas::scanner* scanner_yyarg);
|
||||
virtual ~parser ();
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
/// Non copyable.
|
||||
parser (const parser&) = delete;
|
||||
/// Non copyable.
|
||||
parser& operator= (const parser&) = delete;
|
||||
#endif
|
||||
|
||||
/// Parse. An alias for parse ().
|
||||
/// \returns 0 iff parsing succeeded.
|
||||
int operator() ();
|
||||
|
||||
/// Parse.
|
||||
/// \returns 0 iff parsing succeeded.
|
||||
virtual int parse ();
|
||||
|
||||
#if YYDEBUG
|
||||
/// The current debugging stream.
|
||||
std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
|
||||
/// Set the current debugging stream.
|
||||
void set_debug_stream (std::ostream &);
|
||||
|
||||
/// Type for debugging levels.
|
||||
typedef int debug_level_type;
|
||||
/// The current debugging level.
|
||||
debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
|
||||
/// Set the current debugging level.
|
||||
void set_debug_level (debug_level_type l);
|
||||
#endif
|
||||
|
||||
/// Report a syntax error.
|
||||
/// \param msg a description of the syntax error.
|
||||
virtual void error (const std::string& msg);
|
||||
|
||||
/// Report a syntax error.
|
||||
void error (const syntax_error& err);
|
||||
|
||||
#if YYDEBUG || 0
|
||||
/// The user-facing name of the symbol whose (internal) number is
|
||||
/// YYSYMBOL. No bounds checking.
|
||||
static const char *symbol_name (symbol_kind_type yysymbol);
|
||||
#endif // #if YYDEBUG || 0
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
#if YY_CPLUSPLUS < 201103L
|
||||
/// Non copyable.
|
||||
parser (const parser&);
|
||||
/// Non copyable.
|
||||
parser& operator= (const parser&);
|
||||
#endif
|
||||
|
||||
|
||||
/// Stored state numbers (used for stacks).
|
||||
typedef unsigned char state_type;
|
||||
|
||||
/// Compute post-reduction state.
|
||||
/// \param yystate the current state
|
||||
/// \param yysym the nonterminal to push on the stack
|
||||
static state_type yy_lr_goto_state_ (state_type yystate, int yysym);
|
||||
|
||||
/// Whether the given \c yypact_ value indicates a defaulted state.
|
||||
/// \param yyvalue the value to check
|
||||
static bool yy_pact_value_is_default_ (int yyvalue);
|
||||
|
||||
/// Whether the given \c yytable_ value indicates a syntax error.
|
||||
/// \param yyvalue the value to check
|
||||
static bool yy_table_value_is_error_ (int yyvalue);
|
||||
|
||||
static const short yypact_ninf_;
|
||||
static const signed char yytable_ninf_;
|
||||
|
||||
/// Convert a scanner token kind \a t to a symbol kind.
|
||||
/// In theory \a t should be a token_kind_type, but character literals
|
||||
/// are valid, yet not members of the token_type enum.
|
||||
static symbol_kind_type yytranslate_ (int t);
|
||||
|
||||
#if YYDEBUG || 0
|
||||
/// For a symbol, its name in clear.
|
||||
static const char* const yytname_[];
|
||||
#endif // #if YYDEBUG || 0
|
||||
|
||||
|
||||
// Tables.
|
||||
// YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||
// STATE-NUM.
|
||||
static const short yypact_[];
|
||||
|
||||
// YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
|
||||
// Performed when YYTABLE does not specify something else to do. Zero
|
||||
// means the default is an error.
|
||||
static const signed char yydefact_[];
|
||||
|
||||
// YYPGOTO[NTERM-NUM].
|
||||
static const short yypgoto_[];
|
||||
|
||||
// YYDEFGOTO[NTERM-NUM].
|
||||
static const short yydefgoto_[];
|
||||
|
||||
// YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
|
||||
// positive, shift that token. If negative, reduce the rule whose
|
||||
// number is the opposite. If YYTABLE_NINF, syntax error.
|
||||
static const unsigned char yytable_[];
|
||||
|
||||
static const short yycheck_[];
|
||||
|
||||
// YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||
// symbol of state STATE-NUM.
|
||||
static const signed char yystos_[];
|
||||
|
||||
// YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
|
||||
static const signed char yyr1_[];
|
||||
|
||||
// YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
|
||||
static const signed char yyr2_[];
|
||||
|
||||
|
||||
#if YYDEBUG
|
||||
// YYRLINE[YYN] -- Source line where rule number YYN was defined.
|
||||
static const short yyrline_[];
|
||||
/// Report on the debug stream that the rule \a r is going to be reduced.
|
||||
virtual void yy_reduce_print_ (int r) const;
|
||||
/// Print the state stack on the debug stream.
|
||||
virtual void yy_stack_print_ () const;
|
||||
|
||||
/// Debugging level.
|
||||
int yydebug_;
|
||||
/// Debug stream.
|
||||
std::ostream* yycdebug_;
|
||||
|
||||
/// \brief Display a symbol kind, value and location.
|
||||
/// \param yyo The output stream.
|
||||
/// \param yysym The symbol.
|
||||
template <typename Base>
|
||||
void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
|
||||
#endif
|
||||
|
||||
/// \brief Reclaim the memory associated to a symbol.
|
||||
/// \param yymsg Why this token is reclaimed.
|
||||
/// If null, print nothing.
|
||||
/// \param yysym The symbol.
|
||||
template <typename Base>
|
||||
void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
|
||||
|
||||
private:
|
||||
/// Type access provider for state based symbols.
|
||||
struct by_state
|
||||
{
|
||||
/// Default constructor.
|
||||
by_state () YY_NOEXCEPT;
|
||||
|
||||
/// The symbol kind as needed by the constructor.
|
||||
typedef state_type kind_type;
|
||||
|
||||
/// Constructor.
|
||||
by_state (kind_type s) YY_NOEXCEPT;
|
||||
|
||||
/// Copy constructor.
|
||||
by_state (const by_state& that) YY_NOEXCEPT;
|
||||
|
||||
/// Record that this symbol is empty.
|
||||
void clear () YY_NOEXCEPT;
|
||||
|
||||
/// Steal the symbol kind from \a that.
|
||||
void move (by_state& that);
|
||||
|
||||
/// The symbol kind (corresponding to \a state).
|
||||
/// \a symbol_kind::S_YYEMPTY when empty.
|
||||
symbol_kind_type kind () const YY_NOEXCEPT;
|
||||
|
||||
/// The state number used to denote an empty symbol.
|
||||
/// We use the initial state, as it does not have a value.
|
||||
enum { empty_state = 0 };
|
||||
|
||||
/// The state.
|
||||
/// \a empty when empty.
|
||||
state_type state;
|
||||
};
|
||||
|
||||
/// "Internal" symbol: element of the stack.
|
||||
struct stack_symbol_type : basic_symbol<by_state>
|
||||
{
|
||||
/// Superclass.
|
||||
typedef basic_symbol<by_state> super_type;
|
||||
/// Construct an empty symbol.
|
||||
stack_symbol_type ();
|
||||
/// Move or copy construction.
|
||||
stack_symbol_type (YY_RVREF (stack_symbol_type) that);
|
||||
/// Steal the contents from \a sym to build this.
|
||||
stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
|
||||
#if YY_CPLUSPLUS < 201103L
|
||||
/// Assignment, needed by push_back by some old implementations.
|
||||
/// Moves the contents of that.
|
||||
stack_symbol_type& operator= (stack_symbol_type& that);
|
||||
|
||||
/// Assignment, needed by push_back by other implementations.
|
||||
/// Needed by some other old implementations.
|
||||
stack_symbol_type& operator= (const stack_symbol_type& that);
|
||||
#endif
|
||||
};
|
||||
|
||||
/// A stack with random access from its top.
|
||||
template <typename T, typename S = std::vector<T> >
|
||||
class stack
|
||||
{
|
||||
public:
|
||||
// Hide our reversed order.
|
||||
typedef typename S::iterator iterator;
|
||||
typedef typename S::const_iterator const_iterator;
|
||||
typedef typename S::size_type size_type;
|
||||
typedef typename std::ptrdiff_t index_type;
|
||||
|
||||
stack (size_type n = 200)
|
||||
: seq_ (n)
|
||||
{}
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
/// Non copyable.
|
||||
stack (const stack&) = delete;
|
||||
/// Non copyable.
|
||||
stack& operator= (const stack&) = delete;
|
||||
#endif
|
||||
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
const T&
|
||||
operator[] (index_type i) const
|
||||
{
|
||||
return seq_[size_type (size () - 1 - i)];
|
||||
}
|
||||
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
T&
|
||||
operator[] (index_type i)
|
||||
{
|
||||
return seq_[size_type (size () - 1 - i)];
|
||||
}
|
||||
|
||||
/// Steal the contents of \a t.
|
||||
///
|
||||
/// Close to move-semantics.
|
||||
void
|
||||
push (YY_MOVE_REF (T) t)
|
||||
{
|
||||
seq_.push_back (T ());
|
||||
operator[] (0).move (t);
|
||||
}
|
||||
|
||||
/// Pop elements from the stack.
|
||||
void
|
||||
pop (std::ptrdiff_t n = 1) YY_NOEXCEPT
|
||||
{
|
||||
for (; 0 < n; --n)
|
||||
seq_.pop_back ();
|
||||
}
|
||||
|
||||
/// Pop all elements from the stack.
|
||||
void
|
||||
clear () YY_NOEXCEPT
|
||||
{
|
||||
seq_.clear ();
|
||||
}
|
||||
|
||||
/// Number of elements on the stack.
|
||||
index_type
|
||||
size () const YY_NOEXCEPT
|
||||
{
|
||||
return index_type (seq_.size ());
|
||||
}
|
||||
|
||||
/// Iterator on top of the stack (going downwards).
|
||||
const_iterator
|
||||
begin () const YY_NOEXCEPT
|
||||
{
|
||||
return seq_.begin ();
|
||||
}
|
||||
|
||||
/// Bottom of the stack.
|
||||
const_iterator
|
||||
end () const YY_NOEXCEPT
|
||||
{
|
||||
return seq_.end ();
|
||||
}
|
||||
|
||||
/// Present a slice of the top of a stack.
|
||||
class slice
|
||||
{
|
||||
public:
|
||||
slice (const stack& stack, index_type range)
|
||||
: stack_ (stack)
|
||||
, range_ (range)
|
||||
{}
|
||||
|
||||
const T&
|
||||
operator[] (index_type i) const
|
||||
{
|
||||
return stack_[range_ - i];
|
||||
}
|
||||
|
||||
private:
|
||||
const stack& stack_;
|
||||
index_type range_;
|
||||
};
|
||||
|
||||
private:
|
||||
#if YY_CPLUSPLUS < 201103L
|
||||
/// Non copyable.
|
||||
stack (const stack&);
|
||||
/// Non copyable.
|
||||
stack& operator= (const stack&);
|
||||
#endif
|
||||
/// The wrapped container.
|
||||
S seq_;
|
||||
};
|
||||
|
||||
|
||||
/// Stack type.
|
||||
typedef stack<stack_symbol_type> stack_type;
|
||||
|
||||
/// The stack.
|
||||
stack_type yystack_;
|
||||
|
||||
/// Push a new state on the stack.
|
||||
/// \param m a debug message to display
|
||||
/// if null, no trace is output.
|
||||
/// \param sym the symbol
|
||||
/// \warning the contents of \a s.value is stolen.
|
||||
void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
|
||||
|
||||
/// Push a new look ahead token on the state on the stack.
|
||||
/// \param m a debug message to display
|
||||
/// if null, no trace is output.
|
||||
/// \param s the state
|
||||
/// \param sym the symbol (for its value and location).
|
||||
/// \warning the contents of \a sym.value is stolen.
|
||||
void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
|
||||
|
||||
/// Pop \a n symbols from the stack.
|
||||
void yypop_ (int n = 1);
|
||||
|
||||
/// Constants.
|
||||
enum
|
||||
{
|
||||
yylast_ = 164, ///< Last index in yytable_.
|
||||
yynnts_ = 30, ///< Number of nonterminal symbols.
|
||||
yyfinal_ = 4 ///< Termination state number.
|
||||
};
|
||||
|
||||
|
||||
// User arguments.
|
||||
exptocas::scanner* scanner;
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // exptocas
|
||||
|
||||
|
||||
// "%code provides" blocks.
|
||||
|
||||
#if !defined(yyFlexLexer) && !defined(FlexLexerOnce)
|
||||
#define yyFlexLexer exptocasFlexLexer
|
||||
#include "FlexLexer.h"
|
||||
#endif
|
||||
namespace exptocas {
|
||||
// To feed data back to bison, the yylex method needs yylval and
|
||||
// yylloc parameters. Since the exptocasFlexLexer class is defined in the
|
||||
// system header <FlexLexer.h> the signature of its yylex() method
|
||||
// can not be changed anymore. This makes it necessary to derive a
|
||||
// scanner class that provides a method with the desired signature:
|
||||
class scanner : public exptocasFlexLexer
|
||||
{
|
||||
public:
|
||||
explicit scanner(std::istream* in = 0, std::ostream* out = 0);
|
||||
|
||||
int lex(exptocas::parser::semantic_type* yylval);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // !YY_EXPTOCAS_EXPTOCASEXE_EXPTOCAS_TAB_HXX_INCLUDED
|
@@ -1,506 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 1999-2022 OPEN CASCADE SAS
|
||||
|
||||
This file is part of Open CASCADE Technology software library.
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
by the Free Software Foundation, with special exception defined in the file
|
||||
OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
distribution for complete text of the license and disclaimer of any warranty.
|
||||
|
||||
Alternatively, this file may be used under the terms of Open CASCADE
|
||||
commercial license or contractual agreement.
|
||||
*/
|
||||
|
||||
%code top {
|
||||
// Created: Thu Oct 28 12:21:16 1999
|
||||
// Author: Andrey BETENEV
|
||||
// Copyright (c) 1999-2020 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.
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
This YACC parser implements parsing algorithm for EXPRESS -> CASCADE/XSTEP
|
||||
classes generator
|
||||
|
||||
Input in the form of tokens is obtained from lexical analyser. Then, data
|
||||
structure representing schema is created on the basis of grammar analysis.
|
||||
|
||||
NOTE: The grammar currently implemented is not full.
|
||||
FUNCTION, RULE and CONSTANT items, WHERE, INVERSE and DERIVE clauses
|
||||
of TYPE and ENTITY items are not considered (ignored on the level of lexical
|
||||
scanner).
|
||||
SUPERTYPE and UNIQUE clauses of ENTITY item are recognized but ignored.
|
||||
Also, complex constructs such as using call to function in dimensions of
|
||||
complex time or redefinition of inherited field are ignored.
|
||||
|
||||
*****************************************************************************/
|
||||
}
|
||||
|
||||
%language "C++"
|
||||
%require "3.2"
|
||||
%parse-param {exptocas::scanner* scanner}
|
||||
|
||||
%code requires {
|
||||
#include <OSD_OpenFile.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <TColStd_HSequenceOfHAsciiString.hxx>
|
||||
#include <Express_HSequenceOfField.hxx>
|
||||
#include <Express_HSequenceOfItem.hxx>
|
||||
#include <Express_Field.hxx>
|
||||
#include <Express_Item.hxx>
|
||||
#include <Express_Enum.hxx>
|
||||
#include <Express_Alias.hxx>
|
||||
#include <Express_Select.hxx>
|
||||
#include <Express_Entity.hxx>
|
||||
#include <Express_Type.hxx>
|
||||
#include <Express_NamedType.hxx>
|
||||
#include <Express_PredefinedType.hxx>
|
||||
#include <Express_Number.hxx>
|
||||
#include <Express_Integer.hxx>
|
||||
#include <Express_Boolean.hxx>
|
||||
#include <Express_Logical.hxx>
|
||||
#include <Express_Real.hxx>
|
||||
#include <Express_String.hxx>
|
||||
#include <Express_ComplexType.hxx>
|
||||
#include <Express_Array.hxx>
|
||||
#include <Express_List.hxx>
|
||||
#include <Express_Set.hxx>
|
||||
#include <Express_Bag.hxx>
|
||||
#include <Express_Schema.hxx>
|
||||
#include <Express_Reference.hxx>
|
||||
#include <Express.hxx>
|
||||
|
||||
namespace exptocas {
|
||||
class scanner;
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
// disable MSVC warning C4522: 'exptocas::parser::stack_symbol_type': multiple assignment operators
|
||||
#pragma warning(disable: 4522)
|
||||
#endif
|
||||
}
|
||||
|
||||
%code {
|
||||
#undef yylex
|
||||
#define yylex scanner->lex
|
||||
// disable MSVC warnings in bison code
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4244 4800)
|
||||
#endif
|
||||
|
||||
/************************************************/
|
||||
/* ERROR MESSAGE FUNCTION */
|
||||
|
||||
/* external functions (from exptocas.l) */
|
||||
int ec_error ( const std::string& s, const std::string& text );
|
||||
int ec_curline ( void );
|
||||
|
||||
//int yyerror ( char *s )
|
||||
//{
|
||||
// printf ( "\nParse error at line %d: %s\n", ec_curline(), s );
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
/************************************************/
|
||||
/* FUNCTIONS FOR CREATING SCHEMA REPRESENTATION */
|
||||
|
||||
static Express_Schema *mkschema ( char *name, Express_HSequenceOfItem *ilist );
|
||||
static Express_HSequenceOfItem *mkilist ( Express_Item *item, Express_HSequenceOfItem *seq );
|
||||
static Express_Item *mkenum ( char *name, TColStd_HSequenceOfHAsciiString *tlist );
|
||||
static Express_Item *mkselect ( char *name, TColStd_HSequenceOfHAsciiString *tlist );
|
||||
static Express_Item *mkalias ( char *name, Express_Type *type );
|
||||
static Express_Item *mkentity ( char *name, TColStd_HSequenceOfHAsciiString *inherit,
|
||||
Express_HSequenceOfField *field, int isabstract );
|
||||
static Express_Reference *mkrefs ( char *name, TColStd_HSequenceOfHAsciiString *items);
|
||||
static TColStd_HSequenceOfHAsciiString *mktlist ( char *name, TColStd_HSequenceOfHAsciiString *tlist );
|
||||
static TColStd_HSequenceOfHAsciiString *mktlists ( TColStd_HSequenceOfHAsciiString *tlist1, TColStd_HSequenceOfHAsciiString *tlist2 );
|
||||
static Express_Type *mktstd ( int keyword );
|
||||
static Express_Type *mktname ( char *name );
|
||||
static Express_Type *mktset ( int keyword, int ilow, int ihigh, Express_Type *of );
|
||||
static Express_Field *mkfield ( char *name, Express_Type *type, int optional );
|
||||
static Express_HSequenceOfField *mkflist ( Express_Field *field, Express_HSequenceOfField *seq );
|
||||
}
|
||||
|
||||
%code provides {
|
||||
#if !defined(yyFlexLexer) && !defined(FlexLexerOnce)
|
||||
#define yyFlexLexer exptocasFlexLexer
|
||||
#include "FlexLexer.h"
|
||||
#endif
|
||||
namespace exptocas {
|
||||
// To feed data back to bison, the yylex method needs yylval and
|
||||
// yylloc parameters. Since the exptocasFlexLexer class is defined in the
|
||||
// system header <FlexLexer.h> the signature of its yylex() method
|
||||
// can not be changed anymore. This makes it necessary to derive a
|
||||
// scanner class that provides a method with the desired signature:
|
||||
class scanner : public exptocasFlexLexer
|
||||
{
|
||||
public:
|
||||
explicit scanner(std::istream* in = 0, std::ostream* out = 0);
|
||||
|
||||
int lex(exptocas::parser::semantic_type* yylval);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
/* Definition of possible types of expressions */
|
||||
%union {
|
||||
int num;
|
||||
char *str;
|
||||
TColStd_HSequenceOfHAsciiString *tlist;
|
||||
Express_HSequenceOfField *flist;
|
||||
Express_HSequenceOfItem *ilist;
|
||||
Express_Field *field;
|
||||
Express_Item *item;
|
||||
Express_Type *type;
|
||||
Express_Schema *schema;
|
||||
Express_Reference *ref;
|
||||
}
|
||||
|
||||
/* Definition of keywords */
|
||||
|
||||
%token <num> KSCHEM /* SCHEMA keyword */
|
||||
%token <num> KENDS /* END_SCHEMA keyword */
|
||||
%token <num> KTYP /* TYPE keyword */
|
||||
%token <num> KENDT /* END_TYPE keyword */
|
||||
%token <num> KENT /* ENTITY keyword */
|
||||
%token <num> KENDE /* END_ENTITY keyword */
|
||||
%token <num> KREF /* REFERENCE keyword */
|
||||
%token <num> KFROM /* FROM keyword */
|
||||
|
||||
%token <num> KSEL /* SELECT keyword */
|
||||
%token <num> KENUM /* ENUMERATION keyword */
|
||||
%token <num> KLIST /* LIST keyword */
|
||||
%token <num> KARR /* ARRAY keyword */
|
||||
%token <num> KBAG /* BAG keyword */
|
||||
%token <num> KSET /* SET keyword */
|
||||
%token <num> KOF /* OF keyword */
|
||||
|
||||
%token <num> KNUM /* NUMBER keyword */
|
||||
%token <num> KINT /* INTEGER keyword */
|
||||
%token <num> KDBL /* REAL keyword */
|
||||
%token <num> KSTR /* STRING keyword */
|
||||
%token <num> KLOG /* LOGICAL keyword */
|
||||
%token <num> KBOOL /* BOOLEAN keyword */
|
||||
|
||||
%token <num> KOPT /* OPTIONAL keyword */
|
||||
%token <num> KUNIQ /* UNIQUE keyword */
|
||||
%token <num> KSELF /* SELF keyword */
|
||||
|
||||
%token <num> KABSTR /* ABSTRACT keyword */
|
||||
%token <num> KSUBT /* SUBTYPE keyword */
|
||||
%token <num> KSPRT /* SUPERTYPE keyword */
|
||||
%left <num> KANDOR /* ANDOR keyword (%left is for eliminating shift/reduce conflict on SUPLST) */
|
||||
%left <num> K1OF /* ONEOF keyword */
|
||||
%token <num> KAND /* AND keyword */
|
||||
|
||||
%token <num> NUMBER /* integer value */
|
||||
%token <str> NAME /* name of type or entity */
|
||||
|
||||
%left ',' /* to eliminate shift/reduce conflict in SUPERTYPE */
|
||||
|
||||
/* Definition of expressions and their types */
|
||||
|
||||
%type <num> INDEX OPTNL OPTUNI SUPERT SUPLST REDEF SPCLST
|
||||
%type <tlist> TLIST TLIST1 UNIQIT UNIQLS UNIQUE SUBT SPECIF
|
||||
%type <type> TYPE TSTD TNAME TSET
|
||||
%type <item> ENUM SELECT ALIAS ENTITY ITEM
|
||||
%type <ilist> ILIST
|
||||
%type <field> FIELD
|
||||
%type <flist> FLIST FLIST1
|
||||
%type <schema> SCHEMA
|
||||
%type <ref> REFERENCE
|
||||
|
||||
%%
|
||||
|
||||
/************************************************/
|
||||
/* Definition of parsing rules (expressions) */
|
||||
/************************************************/
|
||||
|
||||
SCHEMA: KSCHEM NAME ';' ILIST KENDS ';' { $$ = mkschema ( $2, $4 ); /* Root: EXPRESS schema */ }
|
||||
;
|
||||
ILIST : ITEM { $$ = mkilist ( $1, 0 ); /* list of items for schema */ }
|
||||
| ITEM ILIST { $$ = mkilist ( $1, $2 ); }
|
||||
;
|
||||
|
||||
ITEM : ENUM
|
||||
| SELECT
|
||||
| ALIAS
|
||||
| REFERENCE
|
||||
| ENTITY { $$ = $1; /* item of schema (type definition) */ }
|
||||
;
|
||||
ENUM : KTYP NAME '=' KENUM KOF TLIST1 ';' KENDT ';' { $$ = mkenum ( $2, $6 ); /* TYPE ENUMERATION definition */ }
|
||||
;
|
||||
SELECT: KTYP NAME '=' KSEL TLIST1 ';' KENDT ';' { $$ = mkselect ( $2, $5 ); /* TYPE SELECT definition */ }
|
||||
;
|
||||
ALIAS : KTYP NAME '=' TYPE ';' KENDT ';' { $$ = mkalias ( $2, $4 ); /* TYPE '=' definition (alias) */ }
|
||||
;
|
||||
ENTITY: KENT NAME SUPERT SUBT ';' FLIST1 UNIQUE KENDE ';' { $$ = mkentity ( $2, $4, $6, 0 ); /* ENTITY definition */ }
|
||||
| KENT NAME KABSTR SUPERT SUBT ';' FLIST1 UNIQUE KENDE ';' { $$ = mkentity ( $2, $5, $7, 1 ); /* ENTITY definition */ }
|
||||
;
|
||||
|
||||
REFERENCE: KREF KFROM NAME TLIST1 ';' { $$ = mkrefs ( $3, $4 ); /* REFERENCE FROM definition */ }
|
||||
;
|
||||
|
||||
TLIST : NAME { $$ = mktlist ( $1, 0 ); /* list of (type) names */ }
|
||||
| NAME ',' TLIST { $$ = mktlist ( $1, $3 ); }
|
||||
;
|
||||
TLIST1: '(' TLIST ')' { $$ = $2; /* TLIST in brackets */ }
|
||||
;
|
||||
|
||||
TYPE : TSTD
|
||||
| TNAME
|
||||
| TSET { $$ = $1; /* type, simple or complex */ }
|
||||
;
|
||||
TSTD : KINT { $$ = mktstd ( $1 ); /* predefined type: INTEGER */ }
|
||||
| KNUM { $$ = mktstd ( $1 ); /* predefined type: NUMBER */ }
|
||||
| KDBL { $$ = mktstd ( $1 ); /* predefined type: REAL */ }
|
||||
| KSTR { $$ = mktstd ( $1 ); /* predefined type: STRING */ }
|
||||
| KLOG { $$ = mktstd ( $1 ); /* predefined type: LOGICAL */ }
|
||||
| KBOOL { $$ = mktstd ( $1 ); /* predefined type: BOOLEAN */ }
|
||||
;
|
||||
TNAME : NAME { $$ = mktname ( $1 ); /* named type */ }
|
||||
;
|
||||
TSET : KLIST '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE { $$ = mktset ( $1, $3, $5, $9 ); /* complex type: LIST */ }
|
||||
| KARR '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE { $$ = mktset ( $1, $3, $5, $9 ); /* complex type: ARRAY */ }
|
||||
| KSET '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE { $$ = mktset ( $1, $3, $5, $9 ); /* complex type: SET */ }
|
||||
| KBAG '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE { $$ = mktset ( $1, $3, $5, $9 ); /* complex type: BAG */ }
|
||||
;
|
||||
INDEX : NUMBER { $$ = $1; /* index for array, set, bag, list range */ }
|
||||
| '?' { $$ = -1; /* undefined */ }
|
||||
| NAME '(' NAME ')' {$$ = -1; printf ( "Warning at line %d: index function %s(%s) ignored\n", ec_curline(), $1, $3 ); /* some function.. */ }
|
||||
;
|
||||
OPTUNI: /* empty */ { $$ = 0; /* UNIQUE keyword for complex type definition */ }
|
||||
| KUNIQ { $$ = 1; }
|
||||
;
|
||||
|
||||
SUBT : /* empty */ { $$ = NULL; /* no subtype clause */ }
|
||||
| KSUBT KOF TLIST1 { $$ = $3; /* subtype clause */ }
|
||||
;
|
||||
SUPERT: /* empty */ { $$ = 0; /* no supertype clause */ }
|
||||
| KSPRT { $$ = 0; /* supertype clause (ignored) */ }
|
||||
| KSPRT KOF SUPLST { $$ = 0; /* supertype clause (ignored) */ }
|
||||
;
|
||||
SUPLST: NAME { $$ = 0; /* simple list of supertypes */ }
|
||||
| '(' SUPLST ')' { $$ = 0; /* allow bracketing */ }
|
||||
| NAME ',' SUPLST { $$ = 0; /* ... */ }
|
||||
| K1OF SUPLST { $$ = 0; /* ONEOF construct */ }
|
||||
| SUPLST KANDOR SUPLST { $$ = 0; /* ANDOR construct */ }
|
||||
;
|
||||
|
||||
FLIST : FIELD { $$ = mkflist ( $1, 0 ); /* list of fields of ENTITY item */ }
|
||||
| FIELD FLIST { $$ = mkflist ( $1, $2 ); }
|
||||
| REDEF { $$ = 0; /* redefinition of inherited field, just skip */ }
|
||||
| REDEF FLIST { $$ = $2; /* ignore redefinition of inherited field, take trailing list */ }
|
||||
;
|
||||
FLIST1: /* empty */ { $$ = NULL; /* empty list of fields */ }
|
||||
| FLIST { $$ = $1; /* or not empty.. just to fix reduce/reduce conflict */ }
|
||||
;
|
||||
FIELD : NAME ':' OPTNL TYPE ';' { $$ = mkfield ( $1, $4, $3 ); }
|
||||
;
|
||||
REDEF : KSELF '\\' SPECIF ':' TYPE ';' { $$ = 0; printf ( "Warning at line %d: field redefinition ignored\n", ec_curline() ); /* redefinition of inherited field */ }
|
||||
;
|
||||
SPECIF: NAME { $$ = mktlist ( $1, 0 ); /* inherited field specification */ }
|
||||
| NAME '.' SPECIF { $$ = mktlist ( $1, $3 ); }
|
||||
;
|
||||
|
||||
OPTNL : /* empty */ { $$ = 0; }
|
||||
| KOPT { $$ = 1; }
|
||||
;
|
||||
|
||||
UNIQIT: NAME ':' TLIST ';' { $$ = $3; /* UNIQUE statement */ }
|
||||
| NAME ':' SPCLST ';' { $$ = NULL; /* UNIQUE statement */ }
|
||||
;
|
||||
UNIQLS: UNIQIT { $$ = NULL; /* list of 1 UNIQUE statements */ }
|
||||
| UNIQIT UNIQLS { $$ = mktlists ( $1, $2 );/* list of UNIQUE statements */ }
|
||||
;
|
||||
UNIQUE: /* empty */ { $$ = NULL; /* no UNIQUE clause in ENTITY */ }
|
||||
| KUNIQ UNIQLS { $$ = $2; /* UNIQUE clause in ENTITY */ }
|
||||
;
|
||||
SPCLST: KSELF '\\' SPECIF { $$ = 0; /* list of specifications */ }
|
||||
| KSELF '\\' SPECIF ',' SPCLST { $$ = 0; }
|
||||
| NAME ',' SPCLST { $$ = 0; }
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
/************************************************/
|
||||
/* FUNCTIONS FOR CREATING SCHEMA REPRESENTATION */
|
||||
|
||||
static Express_Schema *mkschema ( char *name, Express_HSequenceOfItem *ilist )
|
||||
{
|
||||
Express_Schema *sch = new Express_Schema ( name, ilist );
|
||||
Express::Schema() = sch;
|
||||
return sch;
|
||||
}
|
||||
|
||||
static Express_HSequenceOfItem *mkilist ( Express_Item *item, Express_HSequenceOfItem *seq )
|
||||
{
|
||||
if ( ! seq ) {
|
||||
seq = new Express_HSequenceOfItem;
|
||||
seq->Append ( item );
|
||||
}
|
||||
else seq->Prepend ( item );
|
||||
return seq;
|
||||
}
|
||||
|
||||
static Express_Item *mkenum ( char *name, TColStd_HSequenceOfHAsciiString *tlist )
|
||||
{
|
||||
return new Express_Enum ( name, tlist );
|
||||
}
|
||||
|
||||
static Express_Item *mkselect ( char *name, TColStd_HSequenceOfHAsciiString *tlist )
|
||||
{
|
||||
return new Express_Select ( name, tlist );
|
||||
}
|
||||
|
||||
static Express_Item *mkalias ( char *name, Express_Type *type )
|
||||
{
|
||||
return new Express_Alias ( name, type );
|
||||
}
|
||||
|
||||
static Express_Item *mkentity ( char *name, TColStd_HSequenceOfHAsciiString *inherit,
|
||||
Express_HSequenceOfField *field, int isabstract )
|
||||
{
|
||||
Express_Entity *ent = new Express_Entity ( name, inherit, field );
|
||||
if ( isabstract ) ent->SetAbstractFlag ( Standard_True );
|
||||
return ent;
|
||||
}
|
||||
|
||||
static Express_Reference *mkrefs ( char *name, TColStd_HSequenceOfHAsciiString *items)
|
||||
{
|
||||
return new Express_Reference ( name, items );
|
||||
}
|
||||
|
||||
static TColStd_HSequenceOfHAsciiString *mktlist ( char *name, TColStd_HSequenceOfHAsciiString *tlist )
|
||||
{
|
||||
Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString ( name );
|
||||
if ( tlist ) tlist->Prepend ( str );
|
||||
else {
|
||||
tlist = new TColStd_HSequenceOfHAsciiString;
|
||||
tlist->Append ( str );
|
||||
}
|
||||
return tlist;
|
||||
}
|
||||
|
||||
static TColStd_HSequenceOfHAsciiString *mktlists ( TColStd_HSequenceOfHAsciiString *tlist1,
|
||||
TColStd_HSequenceOfHAsciiString *tlist2 )
|
||||
{
|
||||
if ( ! tlist1 ) return tlist2;
|
||||
if ( ! tlist2 ) return tlist1;
|
||||
for ( int i=1; i <= tlist2->Length(); i++ )
|
||||
tlist1->Append ( tlist2->Value(i) );
|
||||
return tlist1;
|
||||
}
|
||||
|
||||
static Express_Type *mktstd ( int keyword )
|
||||
{
|
||||
switch ( keyword ) {
|
||||
case exptocas::parser::token::KINT : return new Express_Integer;
|
||||
case exptocas::parser::token::KNUM : return new Express_Number;
|
||||
case exptocas::parser::token::KDBL : return new Express_Real;
|
||||
case exptocas::parser::token::KSTR : return new Express_String;
|
||||
case exptocas::parser::token::KBOOL: return new Express_Boolean;
|
||||
case exptocas::parser::token::KLOG : return new Express_Logical;
|
||||
default : ec_error ( "Predefined type not treated!", "" );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static Express_Type *mktname ( char *name )
|
||||
{
|
||||
return new Express_NamedType ( name );
|
||||
}
|
||||
|
||||
static Express_Type *mktset ( int keyword, int ilow, int ihigh, Express_Type *of )
|
||||
{
|
||||
switch ( keyword ) {
|
||||
case exptocas::parser::token::KLIST: return new Express_List ( ilow, ihigh, of );
|
||||
case exptocas::parser::token::KARR : return new Express_Array ( ilow, ihigh, of );
|
||||
case exptocas::parser::token::KBAG : return new Express_Bag ( ilow, ihigh, of );
|
||||
case exptocas::parser::token::KSET : return new Express_Set ( ilow, ihigh, of );
|
||||
default : ec_error ( "Complex type not treated!", "" );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static Express_Field *mkfield ( char *name, Express_Type *type, int optional )
|
||||
{
|
||||
return new Express_Field ( name, type, optional );
|
||||
}
|
||||
|
||||
static Express_HSequenceOfField *mkflist ( Express_Field *field, Express_HSequenceOfField *seq )
|
||||
{
|
||||
if ( seq ) seq->Prepend ( field );
|
||||
else {
|
||||
seq = new Express_HSequenceOfField;
|
||||
seq->Append ( field );
|
||||
}
|
||||
return seq;
|
||||
}
|
||||
|
||||
/*******************************************************************/
|
||||
/* MAIN & co */
|
||||
|
||||
/*
|
||||
void tlistfree ( struct tlist *list )
|
||||
{
|
||||
if ( ! list ) return;
|
||||
tlistfree ( list->next );
|
||||
list->next = 0;
|
||||
free ( list->str );
|
||||
list->str = 0;
|
||||
}
|
||||
* /
|
||||
|
||||
int printtlist ( struct ec_tlist *tl )
|
||||
{
|
||||
int num=0;
|
||||
while ( tl ) {
|
||||
num++;
|
||||
printf ( "%s\n", tl->name );
|
||||
tl = tl->next;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
int main ( void )
|
||||
{
|
||||
int num = 0;
|
||||
yyparse();
|
||||
|
||||
printf ( "\nFinished\n" );
|
||||
if ( schema ) {
|
||||
struct ec_item *it;
|
||||
it = schema->items;
|
||||
printf ( "\nSchema %s", schema->name );
|
||||
printf ( "\nItems:" );
|
||||
while ( it ) {
|
||||
num++;
|
||||
printf ( "\n%s", it->name );
|
||||
it = it->next;
|
||||
}
|
||||
// num = printtlist ( res );
|
||||
printf ( "\nTotal %d", num );
|
||||
}
|
||||
|
||||
// tlistfree ( yylval.tlist );
|
||||
return num;
|
||||
}
|
||||
*/
|
||||
|
||||
void exptocas::parser::error(const std::string& s)
|
||||
{
|
||||
printf("\nParse error at line %d: %s\n", scanner->lineno(), s.c_str());
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,942 +0,0 @@
|
||||
# Last update 27.10.2021
|
||||
#===============================================
|
||||
# package StepAP203
|
||||
#===============================================
|
||||
ApprovedItem StepAP203
|
||||
CcDesignApproval StepAP203
|
||||
CcDesignCertification StepAP203
|
||||
CcDesignContract StepAP203
|
||||
CcDesignDateAndTimeAssignment StepAP203
|
||||
CcDesignPersonAndOrganizationAssignment StepAP203
|
||||
CcDesignSecurityClassification StepAP203
|
||||
CcDesignSpecificationReference StepAP203
|
||||
CertifiedItem StepAP203
|
||||
Change StepAP203
|
||||
ChangeRequest StepAP203
|
||||
ChangeRequestItem StepAP203
|
||||
ClassifiedItem StepAP203
|
||||
ContractedItem StepAP203
|
||||
DateTimeItem StepAP203
|
||||
PersonOrganizationItem StepAP203
|
||||
SpecifiedItem StepAP203
|
||||
StartRequest StepAP203
|
||||
StartRequestItem StepAP203
|
||||
StartWork StepAP203
|
||||
WorkItem StepAP203
|
||||
|
||||
#===============================================
|
||||
# package StepAP214
|
||||
#===============================================
|
||||
AppliedApprovalAssignment StepAP214
|
||||
AppliedDateAndTimeAssignment StepAP214
|
||||
AppliedDateAssignment StepAP214
|
||||
AppliedDocumentReference StepAP214
|
||||
AppliedExternalIdentificationAssignment StepAP214
|
||||
AppliedGroupAssignment StepAP214
|
||||
AppliedOrganizationAssignment StepAP214
|
||||
AppliedPersonAndOrganizationAssignment StepAP214
|
||||
AppliedPresentedItem StepAP214
|
||||
AppliedSecurityClassificationAssignment StepAP214
|
||||
ApprovalItem StepAP214
|
||||
AutoDesignActualDateAndTimeAssignment StepAP214
|
||||
AutoDesignActualDateAssignment StepAP214
|
||||
AutoDesignApprovalAssignment StepAP214
|
||||
AutoDesignDateAndPersonAssignment StepAP214
|
||||
AutoDesignDateAndPersonItem StepAP214
|
||||
AutoDesignDateAndTimeItem StepAP214
|
||||
AutoDesignDatedItem StepAP214
|
||||
AutoDesignDocumentReference StepAP214
|
||||
AutoDesignGeneralOrgItem StepAP214
|
||||
AutoDesignGroupAssignment StepAP214
|
||||
AutoDesignGroupedItem StepAP214
|
||||
AutoDesignNominalDateAndTimeAssignment StepAP214
|
||||
AutoDesignNominalDateAssignment StepAP214
|
||||
AutoDesignOrganizationAssignment StepAP214
|
||||
AutoDesignOrganizationItem StepAP214
|
||||
AutoDesignPersonAndOrganizationAssignment StepAP214
|
||||
AutoDesignPresentedItem StepAP214
|
||||
AutoDesignPresentedItemSelect StepAP214
|
||||
AutoDesignReferencingItem StepAP214
|
||||
AutoDesignSecurityClassificationAssignment StepAP214
|
||||
Class StepAP214
|
||||
DateAndTimeItem StepAP214
|
||||
DateItem StepAP214
|
||||
DocumentReferenceItem StepAP214
|
||||
ExternalIdentificationItem StepAP214
|
||||
ExternallyDefinedClass StepAP214
|
||||
ExternallyDefinedGeneralProperty StepAP214
|
||||
GroupItem StepAP214
|
||||
OrganizationItem StepAP214
|
||||
PersonAndOrganizationItem StepAP214
|
||||
PresentedItemSelect StepAP214
|
||||
Protocol StepAP214
|
||||
RepItemGroup StepAP214
|
||||
SecurityClassificationItem StepAP214
|
||||
|
||||
#===============================================
|
||||
# package StepAP242
|
||||
#===============================================
|
||||
DraughtingModelItemAssociation StepAP242
|
||||
GeometricItemSpecificUsage StepAP242
|
||||
IdAttribute StepAP242
|
||||
IdAttributeSelect StepAP242
|
||||
ItemIdentifiedRepresentationUsage StepAP242
|
||||
ItemIdentifiedRepresentationUsageDefinition StepAP242
|
||||
|
||||
#===============================================
|
||||
# package StepBasic
|
||||
#===============================================
|
||||
Action StepBasic
|
||||
ActionAssignment StepBasic
|
||||
ActionMethod StepBasic
|
||||
ActionRequestAssignment StepBasic
|
||||
ActionRequestSolution StepBasic
|
||||
Address StepBasic
|
||||
AheadOrBehind StepBasic
|
||||
ApplicationContext StepBasic
|
||||
ApplicationContextElement StepBasic
|
||||
ApplicationProtocolDefinition StepBasic
|
||||
Approval StepBasic
|
||||
ApprovalAssignment StepBasic
|
||||
ApprovalDateTime StepBasic
|
||||
ApprovalPersonOrganization StepBasic
|
||||
ApprovalRelationship StepBasic
|
||||
ApprovalRole StepBasic
|
||||
ApprovalStatus StepBasic
|
||||
AreaUnit StepBasic
|
||||
CalendarDate StepBasic
|
||||
Certification StepBasic
|
||||
CertificationAssignment StepBasic
|
||||
CertificationType StepBasic
|
||||
CharacterizedObject StepBasic
|
||||
Contract StepBasic
|
||||
ContractAssignment StepBasic
|
||||
ContractType StepBasic
|
||||
ConversionBasedUnit StepBasic
|
||||
ConversionBasedUnitAndAreaUnit StepBasic
|
||||
ConversionBasedUnitAndLengthUnit StepBasic
|
||||
ConversionBasedUnitAndMassUnit StepBasic
|
||||
ConversionBasedUnitAndPlaneAngleUnit StepBasic
|
||||
ConversionBasedUnitAndRatioUnit StepBasic
|
||||
ConversionBasedUnitAndSolidAngleUnit StepBasic
|
||||
ConversionBasedUnitAndTimeUnit StepBasic
|
||||
ConversionBasedUnitAndVolumeUnit StepBasic
|
||||
CoordinatedUniversalTimeOffset StepBasic
|
||||
Date StepBasic
|
||||
DateAndTime StepBasic
|
||||
DateAndTimeAssignment StepBasic
|
||||
DateAssignment StepBasic
|
||||
DateRole StepBasic
|
||||
DateTimeRole StepBasic
|
||||
DateTimeSelect StepBasic
|
||||
DerivedUnit StepBasic
|
||||
DerivedUnitElement StepBasic
|
||||
DesignContext StepBasic
|
||||
DigitalDocument StepBasic
|
||||
DimensionalExponents StepBasic
|
||||
Document StepBasic
|
||||
DocumentFile StepBasic
|
||||
DocumentProductAssociation StepBasic
|
||||
DocumentProductEquivalence StepBasic
|
||||
DocumentReference StepBasic
|
||||
DocumentRelationship StepBasic
|
||||
DocumentRepresentationType StepBasic
|
||||
DocumentType StepBasic
|
||||
DocumentUsageConstraint StepBasic
|
||||
Effectivity StepBasic
|
||||
EffectivityAssignment StepBasic
|
||||
EulerAngles StepBasic
|
||||
ExternalIdentificationAssignment StepBasic
|
||||
ExternallyDefinedItem StepBasic
|
||||
ExternalSource StepBasic
|
||||
GeneralProperty StepBasic
|
||||
Group StepBasic
|
||||
GroupAssignment StepBasic
|
||||
GroupRelationship StepBasic
|
||||
IdentificationAssignment StepBasic
|
||||
IdentificationRole StepBasic
|
||||
LengthMeasureWithUnit StepBasic
|
||||
LengthUnit StepBasic
|
||||
LocalTime StepBasic
|
||||
MassMeasureWithUnit StepBasic
|
||||
MassUnit StepBasic
|
||||
MeasureValueMember StepBasic
|
||||
MeasureWithUnit StepBasic
|
||||
MechanicalContext StepBasic
|
||||
NameAssignment StepBasic
|
||||
NamedUnit StepBasic
|
||||
ObjectRole StepBasic
|
||||
OrdinalDate StepBasic
|
||||
Organization StepBasic
|
||||
OrganizationalAddress StepBasic
|
||||
OrganizationAssignment StepBasic
|
||||
OrganizationRole StepBasic
|
||||
Person StepBasic
|
||||
PersonalAddress StepBasic
|
||||
PersonAndOrganization StepBasic
|
||||
PersonAndOrganizationAssignment StepBasic
|
||||
PersonAndOrganizationRole StepBasic
|
||||
PersonOrganizationSelect StepBasic
|
||||
PhysicallyModeledProductDefinition StepBasic
|
||||
PlaneAngleMeasureWithUnit StepBasic
|
||||
PlaneAngleUnit StepBasic
|
||||
Product StepBasic
|
||||
ProductCategory StepBasic
|
||||
ProductCategoryRelationship StepBasic
|
||||
ProductConceptContext StepBasic
|
||||
ProductContext StepBasic
|
||||
ProductDefinition StepBasic
|
||||
ProductDefinitionContext StepBasic
|
||||
ProductDefinitionEffectivity StepBasic
|
||||
ProductDefinitionFormation StepBasic
|
||||
ProductDefinitionFormationRelationship StepBasic
|
||||
ProductDefinitionFormationWithSpecifiedSource StepBasic
|
||||
ProductDefinitionOrReference StepBasic
|
||||
ProductDefinitionReference StepBasic
|
||||
ProductDefinitionReferenceWithLocalRepresentation StepBasic
|
||||
ProductDefinitionRelationship StepBasic
|
||||
ProductDefinitionWithAssociatedDocuments StepBasic
|
||||
ProductOrFormationOrDefinition StepBasic
|
||||
ProductRelatedProductCategory StepBasic
|
||||
ProductType StepBasic
|
||||
RatioMeasureWithUnit StepBasic
|
||||
RatioUnit StepBasic
|
||||
RoleAssociation StepBasic
|
||||
RoleSelect StepBasic
|
||||
SecurityClassification StepBasic
|
||||
SecurityClassificationAssignment StepBasic
|
||||
SecurityClassificationLevel StepBasic
|
||||
SiPrefix StepBasic
|
||||
SiUnit StepBasic
|
||||
SiUnitAndAreaUnit StepBasic
|
||||
SiUnitAndLengthUnit StepBasic
|
||||
SiUnitAndMassUnit StepBasic
|
||||
SiUnitAndPlaneAngleUnit StepBasic
|
||||
SiUnitAndRatioUnit StepBasic
|
||||
SiUnitAndSolidAngleUnit StepBasic
|
||||
SiUnitAndThermodynamicTemperatureUnit StepBasic
|
||||
SiUnitAndTimeUnit StepBasic
|
||||
SiUnitAndVolumeUnit StepBasic
|
||||
SiUnitName StepBasic
|
||||
SizeMember StepBasic
|
||||
SizeSelect StepBasic
|
||||
SolidAngleMeasureWithUnit StepBasic
|
||||
SolidAngleUnit StepBasic
|
||||
Source StepBasic
|
||||
SourceItem StepBasic
|
||||
ThermodynamicTemperatureUnit StepBasic
|
||||
TimeMeasureWithUnit StepBasic
|
||||
TimeUnit StepBasic
|
||||
UncertaintyMeasureWithUnit StepBasic
|
||||
Unit StepBasic
|
||||
VersionedActionRequest StepBasic
|
||||
VolumeUnit StepBasic
|
||||
WeekOfYearAndDayDate StepBasic
|
||||
|
||||
#===============================================
|
||||
# package StepDimTol
|
||||
#===============================================
|
||||
AngularityTolerance StepDimTol
|
||||
AreaUnitType StepDimTol
|
||||
CircularRunoutTolerance StepDimTol
|
||||
CoaxialityTolerance StepDimTol
|
||||
CommonDatum StepDimTol
|
||||
ConcentricityTolerance StepDimTol
|
||||
CylindricityTolerance StepDimTol
|
||||
Datum StepDimTol
|
||||
DatumFeature StepDimTol
|
||||
DatumOrCommonDatum StepDimTol
|
||||
DatumReference StepDimTol
|
||||
DatumReferenceCompartment StepDimTol
|
||||
DatumReferenceElement StepDimTol
|
||||
DatumReferenceModifier StepDimTol
|
||||
DatumReferenceModifierType StepDimTol
|
||||
DatumReferenceModifierWithValue StepDimTol
|
||||
DatumSystem StepDimTol
|
||||
DatumSystemOrReference StepDimTol
|
||||
DatumTarget StepDimTol
|
||||
FlatnessTolerance StepDimTol
|
||||
GeneralDatumReference StepDimTol
|
||||
GeometricTolerance StepDimTol
|
||||
GeometricToleranceModifier StepDimTol
|
||||
GeometricToleranceRelationship StepDimTol
|
||||
GeometricToleranceTarget StepDimTol
|
||||
GeometricToleranceType StepDimTol
|
||||
GeometricToleranceWithDatumReference StepDimTol
|
||||
GeometricToleranceWithDefinedAreaUnit StepDimTol
|
||||
GeometricToleranceWithDefinedUnit StepDimTol
|
||||
GeometricToleranceWithMaximumTolerance StepDimTol
|
||||
GeometricToleranceWithModifiers StepDimTol
|
||||
GeoTolAndGeoTolWthDatRef StepDimTol
|
||||
GeoTolAndGeoTolWthDatRefAndGeoTolWthMaxTol StepDimTol
|
||||
GeoTolAndGeoTolWthDatRefAndGeoTolWthMod StepDimTol
|
||||
GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol StepDimTol
|
||||
GeoTolAndGeoTolWthDatRefAndUneqDisGeoTol StepDimTol
|
||||
GeoTolAndGeoTolWthMaxTol StepDimTol
|
||||
GeoTolAndGeoTolWthMod StepDimTol
|
||||
LimitCondition StepDimTol
|
||||
LineProfileTolerance StepDimTol
|
||||
ModifiedGeometricTolerance StepDimTol
|
||||
NonUniformZoneDefinition StepDimTol
|
||||
ParallelismTolerance StepDimTol
|
||||
PerpendicularityTolerance StepDimTol
|
||||
PlacedDatumTargetFeature StepDimTol
|
||||
PositionTolerance StepDimTol
|
||||
ProjectedZoneDefinition StepDimTol
|
||||
RoundnessTolerance StepDimTol
|
||||
RunoutZoneDefinition StepDimTol
|
||||
RunoutZoneOrientation StepDimTol
|
||||
ShapeToleranceSelect StepDimTol
|
||||
SimpleDatumReferenceModifier StepDimTol
|
||||
SimpleDatumReferenceModifierMember StepDimTol
|
||||
StraightnessTolerance StepDimTol
|
||||
SurfaceProfileTolerance StepDimTol
|
||||
SymmetryTolerance StepDimTol
|
||||
ToleranceZone StepDimTol
|
||||
ToleranceZoneDefinition StepDimTol
|
||||
ToleranceZoneForm StepDimTol
|
||||
ToleranceZoneTarget StepDimTol
|
||||
TotalRunoutTolerance StepDimTol
|
||||
UnequallyDisposedGeometricTolerance StepDimTol
|
||||
|
||||
#===============================================
|
||||
# package StepElement
|
||||
#===============================================
|
||||
AnalysisItemWithinRepresentation StepElement
|
||||
Curve3dElementDescriptor StepElement
|
||||
CurveEdge StepElement
|
||||
CurveElementEndReleasePacket StepElement
|
||||
CurveElementFreedom StepElement
|
||||
CurveElementFreedomMember StepElement
|
||||
CurveElementPurpose StepElement
|
||||
CurveElementPurposeMember StepElement
|
||||
CurveElementSectionDefinition StepElement
|
||||
CurveElementSectionDerivedDefinitions StepElement
|
||||
Element2dShape StepElement
|
||||
ElementAspect StepElement
|
||||
ElementAspectMember StepElement
|
||||
ElementDescriptor StepElement
|
||||
ElementMaterial StepElement
|
||||
ElementOrder StepElement
|
||||
ElementVolume StepElement
|
||||
EnumeratedCurveElementFreedom StepElement
|
||||
EnumeratedCurveElementPurpose StepElement
|
||||
EnumeratedSurfaceElementPurpose StepElement
|
||||
EnumeratedVolumeElementPurpose StepElement
|
||||
MeasureOrUnspecifiedValue StepElement
|
||||
MeasureOrUnspecifiedValueMember StepElement
|
||||
Surface3dElementDescriptor StepElement
|
||||
SurfaceElementProperty StepElement
|
||||
SurfaceElementPurpose StepElement
|
||||
SurfaceElementPurposeMember StepElement
|
||||
SurfaceSection StepElement
|
||||
SurfaceSectionField StepElement
|
||||
SurfaceSectionFieldConstant StepElement
|
||||
SurfaceSectionFieldVarying StepElement
|
||||
UniformSurfaceSection StepElement
|
||||
UnspecifiedValue StepElement
|
||||
Volume3dElementDescriptor StepElement
|
||||
Volume3dElementShape StepElement
|
||||
VolumeElementPurpose StepElement
|
||||
VolumeElementPurposeMember StepElement
|
||||
|
||||
#===============================================
|
||||
# package StepFEA
|
||||
#===============================================
|
||||
AlignedCurve3dElementCoordinateSystem StepFEA
|
||||
AlignedSurface3dElementCoordinateSystem StepFEA
|
||||
ArbitraryVolume3dElementCoordinateSystem StepFEA
|
||||
ConstantSurface3dElementCoordinateSystem StepFEA
|
||||
CoordinateSystemType StepFEA
|
||||
Curve3dElementProperty StepFEA
|
||||
Curve3dElementRepresentation StepFEA
|
||||
CurveEdge StepFEA
|
||||
CurveElementEndCoordinateSystem StepFEA
|
||||
CurveElementEndOffset StepFEA
|
||||
CurveElementEndRelease StepFEA
|
||||
CurveElementInterval StepFEA
|
||||
CurveElementIntervalConstant StepFEA
|
||||
CurveElementIntervalLinearlyVarying StepFEA
|
||||
CurveElementLocation StepFEA
|
||||
DegreeOfFreedom StepFEA
|
||||
DegreeOfFreedomMember StepFEA
|
||||
DummyNode StepFEA
|
||||
ElementGeometricRelationship StepFEA
|
||||
ElementGroup StepFEA
|
||||
ElementOrElementGroup StepFEA
|
||||
ElementRepresentation StepFEA
|
||||
ElementVolume StepFEA
|
||||
EnumeratedDegreeOfFreedom StepFEA
|
||||
FeaAreaDensity StepFEA
|
||||
FeaAxis2Placement3d StepFEA
|
||||
FeaCurveSectionGeometricRelationship StepFEA
|
||||
FeaGroup StepFEA
|
||||
FeaLinearElasticity StepFEA
|
||||
FeaMassDensity StepFEA
|
||||
FeaMaterialPropertyRepresentation StepFEA
|
||||
FeaMaterialPropertyRepresentationItem StepFEA
|
||||
FeaModel StepFEA
|
||||
FeaModel3d StepFEA
|
||||
FeaModelDefinition StepFEA
|
||||
FeaMoistureAbsorption StepFEA
|
||||
FeaParametricPoint StepFEA
|
||||
FeaRepresentationItem StepFEA
|
||||
FeaSecantCoefficientOfLinearThermalExpansion StepFEA
|
||||
FeaShellBendingStiffness StepFEA
|
||||
FeaShellMembraneBendingCouplingStiffness StepFEA
|
||||
FeaShellMembraneStiffness StepFEA
|
||||
FeaShellShearStiffness StepFEA
|
||||
FeaSurfaceSectionGeometricRelationship StepFEA
|
||||
FeaTangentialCoefficientOfLinearThermalExpansion StepFEA
|
||||
FreedomAndCoefficient StepFEA
|
||||
FreedomsList StepFEA
|
||||
GeometricNode StepFEA
|
||||
Node StepFEA
|
||||
NodeDefinition StepFEA
|
||||
NodeGroup StepFEA
|
||||
NodeRepresentation StepFEA
|
||||
NodeSet StepFEA
|
||||
NodeWithSolutionCoordinateSystem StepFEA
|
||||
NodeWithVector StepFEA
|
||||
ParametricCurve3dElementCoordinateDirection StepFEA
|
||||
ParametricCurve3dElementCoordinateSystem StepFEA
|
||||
ParametricSurface3dElementCoordinateSystem StepFEA
|
||||
Surface3dElementRepresentation StepFEA
|
||||
SymmetricTensor22d StepFEA
|
||||
SymmetricTensor23d StepFEA
|
||||
SymmetricTensor23dMember StepFEA
|
||||
SymmetricTensor42d StepFEA
|
||||
SymmetricTensor43d StepFEA
|
||||
SymmetricTensor43dMember StepFEA
|
||||
UnspecifiedValue StepFEA
|
||||
Volume3dElementRepresentation StepFEA
|
||||
|
||||
#===============================================
|
||||
# package StepGeom
|
||||
#===============================================
|
||||
Axis1Placement StepGeom
|
||||
Axis2Placement StepGeom
|
||||
Axis2Placement2d StepGeom
|
||||
Axis2Placement3d StepGeom
|
||||
BezierCurve StepGeom
|
||||
BezierCurveAndRationalBSplineCurve StepGeom
|
||||
BezierSurface StepGeom
|
||||
BezierSurfaceAndRationalBSplineSurface StepGeom
|
||||
BoundaryCurve StepGeom
|
||||
BoundedCurve StepGeom
|
||||
BoundedSurface StepGeom
|
||||
BSplineCurve StepGeom
|
||||
BSplineCurveForm StepGeom
|
||||
BSplineCurveWithKnots StepGeom
|
||||
BSplineCurveWithKnotsAndRationalBSplineCurve StepGeom
|
||||
BSplineSurface StepGeom
|
||||
BSplineSurfaceForm StepGeom
|
||||
BSplineSurfaceWithKnots StepGeom
|
||||
BSplineSurfaceWithKnotsAndRationalBSplineSurface StepGeom
|
||||
CartesianPoint StepGeom
|
||||
CartesianTransformationOperator StepGeom
|
||||
CartesianTransformationOperator2d StepGeom
|
||||
CartesianTransformationOperator3d StepGeom
|
||||
Circle StepGeom
|
||||
CompositeCurve StepGeom
|
||||
CompositeCurveOnSurface StepGeom
|
||||
CompositeCurveSegment StepGeom
|
||||
Conic StepGeom
|
||||
ConicalSurface StepGeom
|
||||
Curve StepGeom
|
||||
CurveBoundedSurface StepGeom
|
||||
CurveOnSurface StepGeom
|
||||
CurveReplica StepGeom
|
||||
CylindricalSurface StepGeom
|
||||
DegeneratePcurve StepGeom
|
||||
DegenerateToroidalSurface StepGeom
|
||||
Direction StepGeom
|
||||
ElementarySurface StepGeom
|
||||
Ellipse StepGeom
|
||||
EvaluatedDegeneratePcurve StepGeom
|
||||
GeometricRepresentationContext StepGeom
|
||||
GeometricRepresentationContextAndGlobalUnitAssignedContext StepGeom
|
||||
GeometricRepresentationContextAndParametricRepresentationContext StepGeom
|
||||
GeometricRepresentationItem StepGeom
|
||||
GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx StepGeom
|
||||
Hyperbola StepGeom
|
||||
IntersectionCurve StepGeom
|
||||
KnotType StepGeom
|
||||
Line StepGeom
|
||||
OffsetCurve3d StepGeom
|
||||
OffsetSurface StepGeom
|
||||
OrientedSurface StepGeom
|
||||
OuterBoundaryCurve StepGeom
|
||||
Parabola StepGeom
|
||||
Pcurve StepGeom
|
||||
PcurveOrSurface StepGeom
|
||||
Placement StepGeom
|
||||
Plane StepGeom
|
||||
Point StepGeom
|
||||
PointOnCurve StepGeom
|
||||
PointOnSurface StepGeom
|
||||
PointReplica StepGeom
|
||||
Polyline StepGeom
|
||||
PreferredSurfaceCurveRepresentation StepGeom
|
||||
QuasiUniformCurve StepGeom
|
||||
QuasiUniformCurveAndRationalBSplineCurve StepGeom
|
||||
QuasiUniformSurface StepGeom
|
||||
QuasiUniformSurfaceAndRationalBSplineSurface StepGeom
|
||||
RationalBSplineCurve StepGeom
|
||||
RationalBSplineSurface StepGeom
|
||||
RectangularCompositeSurface StepGeom
|
||||
RectangularTrimmedSurface StepGeom
|
||||
ReparametrisedCompositeCurveSegment StepGeom
|
||||
SeamCurve StepGeom
|
||||
SphericalSurface StepGeom
|
||||
SuParameters StepGeom
|
||||
Surface StepGeom
|
||||
SurfaceBoundary StepGeom
|
||||
SurfaceCurve StepGeom
|
||||
SurfaceCurveAndBoundedCurve StepGeom
|
||||
SurfaceOfLinearExtrusion StepGeom
|
||||
SurfaceOfRevolution StepGeom
|
||||
SurfacePatch StepGeom
|
||||
SurfaceReplica StepGeom
|
||||
SweptSurface StepGeom
|
||||
ToroidalSurface StepGeom
|
||||
TransitionCode StepGeom
|
||||
TrimmedCurve StepGeom
|
||||
TrimmingMember StepGeom
|
||||
TrimmingPreference StepGeom
|
||||
TrimmingSelect StepGeom
|
||||
UniformCurve StepGeom
|
||||
UniformCurveAndRationalBSplineCurve StepGeom
|
||||
UniformSurface StepGeom
|
||||
UniformSurfaceAndRationalBSplineSurface StepGeom
|
||||
Vector StepGeom
|
||||
VectorOrDirection StepGeom
|
||||
|
||||
#===============================================
|
||||
# package StepKinematics
|
||||
#===============================================
|
||||
ActuatedDirection StepKinematics
|
||||
ActuatedKinematicPair StepKinematics
|
||||
ActuatedKinPairAndOrderKinPair StepKinematics
|
||||
ContextDependentKinematicLinkRepresentation StepKinematics
|
||||
CylindricalPair StepKinematics
|
||||
CylindricalPairValue StepKinematics
|
||||
CylindricalPairWithRange StepKinematics
|
||||
FullyConstrainedPair StepKinematics
|
||||
GearPair StepKinematics
|
||||
GearPairValue StepKinematics
|
||||
GearPairWithRange StepKinematics
|
||||
HighOrderKinematicPair StepKinematics
|
||||
HomokineticPair StepKinematics
|
||||
KinematicJoint StepKinematics
|
||||
KinematicLink StepKinematics
|
||||
KinematicLinkRepresentation StepKinematics
|
||||
KinematicLinkRepresentationAssociation StepKinematics
|
||||
KinematicPair StepKinematics
|
||||
KinematicPropertyDefinitionRepresentation StepKinematics
|
||||
KinematicPropertyMechanismRepresentation StepKinematics
|
||||
KinematicTopologyDirectedStructure StepKinematics
|
||||
KinematicTopologyNetworkStructure StepKinematics
|
||||
KinematicTopologyRepresentationSelect StepKinematics
|
||||
KinematicTopologyStructure StepKinematics
|
||||
LinearFlexibleAndPinionPair StepKinematics
|
||||
LinearFlexibleAndPlanarCurvePair StepKinematics
|
||||
LinearFlexibleLinkRepresentation StepKinematics
|
||||
LowOrderKinematicPair StepKinematics
|
||||
LowOrderKinematicPairValue StepKinematics
|
||||
LowOrderKinematicPairWithMotionCoupling StepKinematics
|
||||
LowOrderKinematicPairWithRange StepKinematics
|
||||
MechanismRepresentation StepKinematics
|
||||
MechanismStateRepresentation StepKinematics
|
||||
OrientedJoint StepKinematics
|
||||
PairRepresentationRelationship StepKinematics
|
||||
PairValue StepKinematics
|
||||
PlanarCurvePair StepKinematics
|
||||
PlanarCurvePairRange StepKinematics
|
||||
PlanarPair StepKinematics
|
||||
PlanarPairValue StepKinematics
|
||||
PlanarPairWithRange StepKinematics
|
||||
PointOnPlanarCurvePair StepKinematics
|
||||
PointOnPlanarCurvePairValue StepKinematics
|
||||
PointOnPlanarCurvePairWithRange StepKinematics
|
||||
PointOnSurfacePair StepKinematics
|
||||
PointOnSurfacePairValue StepKinematics
|
||||
PointOnSurfacePairWithRange StepKinematics
|
||||
PrismaticPair StepKinematics
|
||||
PrismaticPairValue StepKinematics
|
||||
PrismaticPairWithRange StepKinematics
|
||||
ProductDefinitionKinematics StepKinematics
|
||||
ProductDefinitionRelationshipKinematics StepKinematics
|
||||
RackAndPinionPair StepKinematics
|
||||
RackAndPinionPairValue StepKinematics
|
||||
RackAndPinionPairWithRange StepKinematics
|
||||
RevolutePair StepKinematics
|
||||
RevolutePairValue StepKinematics
|
||||
RevolutePairWithRange StepKinematics
|
||||
RigidLinkRepresentation StepKinematics
|
||||
RigidPlacement StepKinematics
|
||||
RollingCurvePair StepKinematics
|
||||
RollingCurvePairValue StepKinematics
|
||||
RollingSurfacePair StepKinematics
|
||||
RollingSurfacePairValue StepKinematics
|
||||
RotationAboutDirection StepKinematics
|
||||
ScrewPair StepKinematics
|
||||
ScrewPairValue StepKinematics
|
||||
ScrewPairWithRange StepKinematics
|
||||
SlidingCurvePair StepKinematics
|
||||
SlidingCurvePairValue StepKinematics
|
||||
SlidingSurfacePair StepKinematics
|
||||
SlidingSurfacePairValue StepKinematics
|
||||
SpatialRotation StepKinematics
|
||||
SphericalPair StepKinematics
|
||||
SphericalPairSelect StepKinematics
|
||||
SphericalPairValue StepKinematics
|
||||
SphericalPairWithPin StepKinematics
|
||||
SphericalPairWithPinAndRange StepKinematics
|
||||
SphericalPairWithRange StepKinematics
|
||||
SurfacePair StepKinematics
|
||||
SurfacePairWithRange StepKinematics
|
||||
UnconstrainedPair StepKinematics
|
||||
UnconstrainedPairValue StepKinematics
|
||||
UniversalPair StepKinematics
|
||||
UniversalPairValue StepKinematics
|
||||
UniversalPairWithRange StepKinematics
|
||||
|
||||
#===============================================
|
||||
# package StepRepr
|
||||
#===============================================
|
||||
AllAroundShapeAspect StepRepr
|
||||
Apex StepRepr
|
||||
AssemblyComponentUsage StepRepr
|
||||
AssemblyComponentUsageSubstitute StepRepr
|
||||
BetweenShapeAspect StepRepr
|
||||
CentreOfSymmetry StepRepr
|
||||
CharacterizedDefinition StepRepr
|
||||
CharacterizedRepresentation StepRepr
|
||||
CompGroupShAspAndCompShAspAndDatumFeatAndShAsp StepRepr
|
||||
CompositeGroupShapeAspect StepRepr
|
||||
CompositeShapeAspect StepRepr
|
||||
CompoundRepresentationItem StepRepr
|
||||
CompShAspAndDatumFeatAndShAsp StepRepr
|
||||
ConfigurationDesign StepRepr
|
||||
ConfigurationDesignItem StepRepr
|
||||
ConfigurationEffectivity StepRepr
|
||||
ConfigurationItem StepRepr
|
||||
ConstructiveGeometryRepresentation StepRepr
|
||||
ConstructiveGeometryRepresentationRelationship StepRepr
|
||||
ContinuosShapeAspect StepRepr
|
||||
DataEnvironment StepRepr
|
||||
DefinitionalRepresentation StepRepr
|
||||
DerivedShapeAspect StepRepr
|
||||
DescriptiveRepresentationItem StepRepr
|
||||
Extension StepRepr
|
||||
ExternallyDefinedRepresentation StepRepr
|
||||
FeatureForDatumTargetRelationship StepRepr
|
||||
FunctionallyDefinedTransformation StepRepr
|
||||
GeometricAlignment StepRepr
|
||||
GlobalUncertaintyAssignedContext StepRepr
|
||||
GlobalUnitAssignedContext StepRepr
|
||||
IntegerRepresentationItem StepRepr
|
||||
ItemDefinedTransformation StepRepr
|
||||
MakeFromUsageOption StepRepr
|
||||
MappedItem StepRepr
|
||||
MaterialDesignation StepRepr
|
||||
MaterialProperty StepRepr
|
||||
MaterialPropertyRepresentation StepRepr
|
||||
MeasureRepresentationItem StepRepr
|
||||
NextAssemblyUsageOccurrence StepRepr
|
||||
ParallelOffset StepRepr
|
||||
ParametricRepresentationContext StepRepr
|
||||
PerpendicularTo StepRepr
|
||||
ProductConcept StepRepr
|
||||
ProductDefinitionShape StepRepr
|
||||
ProductDefinitionUsage StepRepr
|
||||
PromissoryUsageOccurrence StepRepr
|
||||
PropertyDefinition StepRepr
|
||||
PropertyDefinitionRelationship StepRepr
|
||||
PropertyDefinitionRepresentation StepRepr
|
||||
QuantifiedAssemblyComponentUsage StepRepr
|
||||
Representation StepRepr
|
||||
RepresentationContext StepRepr
|
||||
RepresentationContextReference StepRepr
|
||||
RepresentationItem StepRepr
|
||||
RepresentationMap StepRepr
|
||||
RepresentationOrRepresentationReference StepRepr
|
||||
RepresentationReference StepRepr
|
||||
RepresentationRelationship StepRepr
|
||||
RepresentationRelationshipWithTransformation StepRepr
|
||||
RepresentedDefinition StepRepr
|
||||
ReprItemAndLengthMeasureWithUnit StepRepr
|
||||
ReprItemAndLengthMeasureWithUnitAndQRI StepRepr
|
||||
ReprItemAndMeasureWithUnit StepRepr
|
||||
ReprItemAndMeasureWithUnitAndQRI StepRepr
|
||||
ReprItemAndPlaneAngleMeasureWithUnit StepRepr
|
||||
ReprItemAndPlaneAngleMeasureWithUnitAndQRI StepRepr
|
||||
ShapeAspect StepRepr
|
||||
ShapeAspectDerivingRelationship StepRepr
|
||||
ShapeAspectRelationship StepRepr
|
||||
ShapeAspectTransition StepRepr
|
||||
ShapeDefinition StepRepr
|
||||
ShapeRepresentationRelationship StepRepr
|
||||
ShapeRepresentationRelationshipWithTransformation StepRepr
|
||||
SpecifiedHigherUsageOccurrence StepRepr
|
||||
StructuralResponseProperty StepRepr
|
||||
StructuralResponsePropertyDefinitionRepresentation StepRepr
|
||||
SuppliedPartRelationship StepRepr
|
||||
Tangent StepRepr
|
||||
Transformation StepRepr
|
||||
ValueRange StepRepr
|
||||
ValueRepresentationItem StepRepr
|
||||
|
||||
#===============================================
|
||||
# package StepShape
|
||||
#===============================================
|
||||
AdvancedBrepShapeRepresentation StepShape
|
||||
AdvancedFace StepShape
|
||||
AngleRelator StepShape
|
||||
AngularLocation StepShape
|
||||
AngularSize StepShape
|
||||
Block StepShape
|
||||
BooleanOperand StepShape
|
||||
BooleanOperator StepShape
|
||||
BooleanResult StepShape
|
||||
BoxDomain StepShape
|
||||
BoxedHalfSpace StepShape
|
||||
BrepWithVoids StepShape
|
||||
ClosedShell StepShape
|
||||
CompoundShapeRepresentation StepShape
|
||||
ConnectedEdgeSet StepShape
|
||||
ConnectedFaceSet StepShape
|
||||
ConnectedFaceShapeRepresentation StepShape
|
||||
ConnectedFaceSubSet StepShape
|
||||
ContextDependentShapeRepresentation StepShape
|
||||
CsgPrimitive StepShape
|
||||
CsgSelect StepShape
|
||||
CsgShapeRepresentation StepShape
|
||||
CsgSolid StepShape
|
||||
DefinitionalRepresentationAndShapeRepresentation StepShape
|
||||
DimensionalCharacteristic StepShape
|
||||
DimensionalCharacteristicRepresentation StepShape
|
||||
DimensionalLocation StepShape
|
||||
DimensionalLocationWithPath StepShape
|
||||
DimensionalSize StepShape
|
||||
DimensionalSizeWithPath StepShape
|
||||
DirectedDimensionalLocation StepShape
|
||||
Edge StepShape
|
||||
EdgeBasedWireframeModel StepShape
|
||||
EdgeBasedWireframeShapeRepresentation StepShape
|
||||
EdgeCurve StepShape
|
||||
EdgeLoop StepShape
|
||||
ExtrudedAreaSolid StepShape
|
||||
ExtrudedFaceSolid StepShape
|
||||
Face StepShape
|
||||
FaceBasedSurfaceModel StepShape
|
||||
FaceBound StepShape
|
||||
FaceOuterBound StepShape
|
||||
FaceSurface StepShape
|
||||
FacetedBrep StepShape
|
||||
FacetedBrepAndBrepWithVoids StepShape
|
||||
FacetedBrepShapeRepresentation StepShape
|
||||
GeometricallyBoundedSurfaceShapeRepresentation StepShape
|
||||
GeometricallyBoundedWireframeShapeRepresentation StepShape
|
||||
GeometricCurveSet StepShape
|
||||
GeometricSet StepShape
|
||||
GeometricSetSelect StepShape
|
||||
HalfSpaceSolid StepShape
|
||||
LimitsAndFits StepShape
|
||||
Loop StepShape
|
||||
LoopAndPath StepShape
|
||||
ManifoldSolidBrep StepShape
|
||||
ManifoldSurfaceShapeRepresentation StepShape
|
||||
MeasureQualification StepShape
|
||||
MeasureRepresentationItemAndQualifiedRepresentationItem StepShape
|
||||
NonManifoldSurfaceShapeRepresentation StepShape
|
||||
OpenShell StepShape
|
||||
OrientedClosedShell StepShape
|
||||
OrientedEdge StepShape
|
||||
OrientedFace StepShape
|
||||
OrientedOpenShell StepShape
|
||||
OrientedPath StepShape
|
||||
Path StepShape
|
||||
PlusMinusTolerance StepShape
|
||||
PointRepresentation StepShape
|
||||
PolyLoop StepShape
|
||||
PrecisionQualifier StepShape
|
||||
QualifiedRepresentationItem StepShape
|
||||
ReversibleTopologyItem StepShape
|
||||
RevolvedAreaSolid StepShape
|
||||
RevolvedFaceSolid StepShape
|
||||
RightAngularWedge StepShape
|
||||
RightCircularCone StepShape
|
||||
RightCircularCylinder StepShape
|
||||
SeamEdge StepShape
|
||||
ShapeDefinitionRepresentation StepShape
|
||||
ShapeDimensionRepresentation StepShape
|
||||
ShapeDimensionRepresentationItem StepShape
|
||||
ShapeRepresentation StepShape
|
||||
ShapeRepresentationWithParameters StepShape
|
||||
Shell StepShape
|
||||
ShellBasedSurfaceModel StepShape
|
||||
SolidModel StepShape
|
||||
SolidReplica StepShape
|
||||
Sphere StepShape
|
||||
Subedge StepShape
|
||||
Subface StepShape
|
||||
SurfaceModel StepShape
|
||||
SweptAreaSolid StepShape
|
||||
SweptFaceSolid StepShape
|
||||
ToleranceMethodDefinition StepShape
|
||||
ToleranceValue StepShape
|
||||
TopologicalRepresentationItem StepShape
|
||||
Torus StepShape
|
||||
TransitionalShapeRepresentation StepShape
|
||||
TypeQualifier StepShape
|
||||
ValueFormatTypeQualifier StepShape
|
||||
ValueQualifier StepShape
|
||||
Vertex StepShape
|
||||
VertexLoop StepShape
|
||||
VertexPoint StepShape
|
||||
|
||||
#===============================================
|
||||
# package StepVisual
|
||||
#===============================================
|
||||
AnnotationCurveOccurrence StepVisual
|
||||
AnnotationCurveOccurrenceAndGeomReprItem StepVisual
|
||||
AnnotationFillArea StepVisual
|
||||
AnnotationFillAreaOccurrence StepVisual
|
||||
AnnotationOccurrence StepVisual
|
||||
AnnotationPlane StepVisual
|
||||
AnnotationPlaneElement StepVisual
|
||||
AnnotationText StepVisual
|
||||
AnnotationTextOccurrence StepVisual
|
||||
AreaInSet StepVisual
|
||||
AreaOrView StepVisual
|
||||
BackgroundColour StepVisual
|
||||
BoxCharacteristicSelect StepVisual
|
||||
CameraImage StepVisual
|
||||
CameraImage2dWithScale StepVisual
|
||||
CameraImage3dWithScale StepVisual
|
||||
CameraModel StepVisual
|
||||
CameraModelD2 StepVisual
|
||||
CameraModelD3 StepVisual
|
||||
CameraModelD3MultiClipping StepVisual
|
||||
CameraModelD3MultiClippingInterectionSelect StepVisual
|
||||
CameraModelD3MultiClippingIntersection StepVisual
|
||||
CameraModelD3MultiClippingUnion StepVisual
|
||||
CameraModelD3MultiClippingUnionSelect StepVisual
|
||||
CameraUsage StepVisual
|
||||
CentralOrParallel StepVisual
|
||||
CharacterizedObjAndRepresentationAndDraughtingModel StepVisual
|
||||
Colour StepVisual
|
||||
ColourRgb StepVisual
|
||||
ColourSpecification StepVisual
|
||||
ComplexTriangulatedFace StepVisual
|
||||
ComplexTriangulatedSurfaceSet StepVisual
|
||||
CompositeText StepVisual
|
||||
CompositeTextWithExtent StepVisual
|
||||
ContextDependentInvisibility StepVisual
|
||||
ContextDependentOverRidingStyledItem StepVisual
|
||||
CoordinatesList StepVisual
|
||||
CubicBezierTessellatedEdge StepVisual
|
||||
CubicBezierTriangulatedFace StepVisual
|
||||
CurveStyle StepVisual
|
||||
CurveStyleFont StepVisual
|
||||
CurveStyleFontPattern StepVisual
|
||||
CurveStyleFontSelect StepVisual
|
||||
DirectionCountSelect StepVisual
|
||||
DraughtingAnnotationOccurrence StepVisual
|
||||
DraughtingCallout StepVisual
|
||||
DraughtingCalloutElement StepVisual
|
||||
DraughtingModel StepVisual
|
||||
DraughtingPreDefinedColour StepVisual
|
||||
DraughtingPreDefinedCurveFont StepVisual
|
||||
EdgeOrCurve StepVisual
|
||||
ExternallyDefinedCurveFont StepVisual
|
||||
ExternallyDefinedTextFont StepVisual
|
||||
FaceOrSurface StepVisual
|
||||
FillAreaStyle StepVisual
|
||||
FillAreaStyleColour StepVisual
|
||||
FillStyleSelect StepVisual
|
||||
FontSelect StepVisual
|
||||
Invisibility StepVisual
|
||||
InvisibilityContext StepVisual
|
||||
InvisibleItem StepVisual
|
||||
LayeredItem StepVisual
|
||||
MarkerMember StepVisual
|
||||
MarkerSelect StepVisual
|
||||
MarkerType StepVisual
|
||||
MechanicalDesignGeometricPresentationArea StepVisual
|
||||
MechanicalDesignGeometricPresentationRepresentation StepVisual
|
||||
NullStyle StepVisual
|
||||
NullStyleMember StepVisual
|
||||
OverRidingStyledItem StepVisual
|
||||
PathOrCompositeCurve StepVisual
|
||||
PlanarBox StepVisual
|
||||
PlanarExtent StepVisual
|
||||
PointStyle StepVisual
|
||||
PreDefinedColour StepVisual
|
||||
PreDefinedCurveFont StepVisual
|
||||
PreDefinedItem StepVisual
|
||||
PreDefinedTextFont StepVisual
|
||||
PresentationArea StepVisual
|
||||
PresentationLayerAssignment StepVisual
|
||||
PresentationLayerUsage StepVisual
|
||||
PresentationRepresentation StepVisual
|
||||
PresentationRepresentationSelect StepVisual
|
||||
PresentationSet StepVisual
|
||||
PresentationSize StepVisual
|
||||
PresentationSizeAssignmentSelect StepVisual
|
||||
PresentationStyleAssignment StepVisual
|
||||
PresentationStyleByContext StepVisual
|
||||
PresentationStyleSelect StepVisual
|
||||
PresentationView StepVisual
|
||||
PresentedItem StepVisual
|
||||
PresentedItemRepresentation StepVisual
|
||||
RenderingPropertiesSelect StepVisual
|
||||
RepositionedTessellatedGeometricSet StepVisual
|
||||
RepositionedTessellatedItem StepVisual
|
||||
ShadingSurfaceMethod StepVisual
|
||||
StyleContextSelect StepVisual
|
||||
StyledItem StepVisual
|
||||
StyledItemTarget StepVisual
|
||||
SurfaceSide StepVisual
|
||||
SurfaceSideStyle StepVisual
|
||||
SurfaceStyleBoundary StepVisual
|
||||
SurfaceStyleControlGrid StepVisual
|
||||
SurfaceStyleElementSelect StepVisual
|
||||
SurfaceStyleFillArea StepVisual
|
||||
SurfaceStyleParameterLine StepVisual
|
||||
SurfaceStyleReflectanceAmbient StepVisual
|
||||
SurfaceStyleRendering StepVisual
|
||||
SurfaceStyleRenderingWithProperties StepVisual
|
||||
SurfaceStyleSegmentationCurve StepVisual
|
||||
SurfaceStyleSilhouette StepVisual
|
||||
SurfaceStyleTransparent StepVisual
|
||||
SurfaceStyleUsage StepVisual
|
||||
Template StepVisual
|
||||
TemplateInstance StepVisual
|
||||
TessellatedAnnotationOccurrence StepVisual
|
||||
TessellatedConnectingEdge StepVisual
|
||||
TessellatedCurveSet StepVisual
|
||||
TessellatedEdge StepVisual
|
||||
TessellatedEdgeOrVertex StepVisual
|
||||
TessellatedFace StepVisual
|
||||
TessellatedGeometricSet StepVisual
|
||||
TessellatedItem StepVisual
|
||||
TessellatedPointSet StepVisual
|
||||
TessellatedShapeRepresentation StepVisual
|
||||
TessellatedShapeRepresentationWithAccuracyParameters StepVisual
|
||||
TessellatedShell StepVisual
|
||||
TessellatedSolid StepVisual
|
||||
TessellatedStructuredItem StepVisual
|
||||
TessellatedSurfaceSet StepVisual
|
||||
TessellatedVertex StepVisual
|
||||
TessellatedWire StepVisual
|
||||
TextLiteral StepVisual
|
||||
TextOrCharacter StepVisual
|
||||
TextPath StepVisual
|
||||
TextStyle StepVisual
|
||||
TextStyleForDefinedFont StepVisual
|
||||
TextStyleWithBoxCharacteristics StepVisual
|
||||
TriangulatedFace StepVisual
|
||||
ViewVolume StepVisual
|
@@ -1,129 +0,0 @@
|
||||
// Created: Wed Nov 3 14:39:28 1999
|
||||
// Author: Andrey BETENEV
|
||||
// Copyright (c) 1999-2020 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 <Express.hxx>
|
||||
|
||||
#include <Express_Schema.hxx>
|
||||
#include <OSD_Process.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <Quantity_Date.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
//=======================================================================
|
||||
// function : Schema
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Express_Schema)& Express::Schema()
|
||||
{
|
||||
static Handle(Express_Schema) aSchema;
|
||||
return aSchema;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : WriteFileStamp
|
||||
// purpose : Write header of HXX or CXX file
|
||||
//=======================================================================
|
||||
|
||||
void Express::WriteFileStamp (Standard_OStream& theOS)
|
||||
{
|
||||
static const char* EC_VERSION = "2.0";
|
||||
|
||||
OSD_Process aProcess;
|
||||
Quantity_Date aCurTime = aProcess.SystemDate();
|
||||
OSD_Environment anEnv ("EXPTOCAS_TIME");
|
||||
TCollection_AsciiString aTimeString = anEnv.Value();
|
||||
if (aTimeString.IsEmpty())
|
||||
{
|
||||
aTimeString += aCurTime.Year();
|
||||
aTimeString += "-";
|
||||
aTimeString += aCurTime.Month();
|
||||
aTimeString += "-";
|
||||
aTimeString += aCurTime.Day();
|
||||
}
|
||||
|
||||
theOS << "// Created on : " << aTimeString << "\n"
|
||||
"// Created by: " << aProcess.UserName() << "\n"
|
||||
"// Generator: ExpToCasExe (EXPRESS -> CASCADE/XSTEP Translator) V" << EC_VERSION << "\n"
|
||||
"// Copyright (c) Open CASCADE " << aCurTime.Year() << "\n"
|
||||
"//\n"
|
||||
"// This file is part of Open CASCADE Technology software library.\n"
|
||||
"//\n"
|
||||
"// This library is free software; you can redistribute it and/or modify it under\n"
|
||||
"// the terms of the GNU Lesser General Public License version 2.1 as published\n"
|
||||
"// by the Free Software Foundation, with special exception defined in the file\n"
|
||||
"// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT\n"
|
||||
"// distribution for complete text of the license and disclaimer of any warranty.\n"
|
||||
"//\n"
|
||||
"// Alternatively, this file may be used under the terms of Open CASCADE\n"
|
||||
"// commercial license or contractual agreement.\n"
|
||||
"\n";
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : WriteMethodStamp
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Express::WriteMethodStamp (Standard_OStream& theOS, const TCollection_AsciiString& theName)
|
||||
{
|
||||
theOS << "\n"
|
||||
"//=======================================================================\n"
|
||||
"// function : " << theName << "\n"
|
||||
"// purpose :\n"
|
||||
"//=======================================================================\n"
|
||||
"\n";
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : ToStepName
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
TCollection_AsciiString Express::ToStepName (const TCollection_AsciiString& theName)
|
||||
{
|
||||
TCollection_AsciiString aStepName(theName);
|
||||
for (Standard_Integer i = 2; i <= aStepName.Length(); i++)
|
||||
{
|
||||
if (isupper (aStepName.Value (i)))
|
||||
{
|
||||
aStepName.Insert (i++, '_');
|
||||
}
|
||||
}
|
||||
aStepName.LowerCase();
|
||||
|
||||
return aStepName;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : GetPrefixEnum
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
TCollection_AsciiString Express::EnumPrefix (const TCollection_AsciiString& theName)
|
||||
{
|
||||
TCollection_AsciiString aStepName;
|
||||
for (Standard_Integer i = 1; i <= theName.Length(); i++)
|
||||
{
|
||||
if (isupper (theName.Value (i)))
|
||||
{
|
||||
aStepName += theName.Value (i);
|
||||
}
|
||||
}
|
||||
aStepName.LowerCase();
|
||||
|
||||
return aStepName;
|
||||
}
|
||||
|
@@ -1,52 +0,0 @@
|
||||
// Copyright (c) 1999-2020 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 _Express_HeaderFile
|
||||
#define _Express_HeaderFile
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
|
||||
class Express_Schema;
|
||||
class TCollection_AsciiString;
|
||||
|
||||
//! Provides data structures for representation of EXPRESS schema
|
||||
//! (items, types, entities etc.)
|
||||
//! and tools for generating XSTEP classes (HXX and CXX) from
|
||||
//! items of the schema
|
||||
class Express
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Returns (modifiable) handle to static schema object
|
||||
Standard_EXPORT static Handle(Express_Schema)& Schema();
|
||||
|
||||
//! Writes standard copyright stamp (creation date/time, user, etc.)
|
||||
Standard_EXPORT static void WriteFileStamp (Standard_OStream& theOS);
|
||||
|
||||
//! Writes standard comment for method in CXX file
|
||||
Standard_EXPORT static void WriteMethodStamp (Standard_OStream& theOS, const TCollection_AsciiString& theName);
|
||||
|
||||
//! Converts item name from CASCADE to STEP style
|
||||
//! e.g. BoundedCurve -> bounded_curve
|
||||
Standard_EXPORT static TCollection_AsciiString ToStepName (const TCollection_AsciiString& theName);
|
||||
|
||||
//! Converts item name from CASCADE to STEP style
|
||||
//! e.g. BoundedCurve -> bounded_curve
|
||||
Standard_EXPORT static TCollection_AsciiString EnumPrefix (const TCollection_AsciiString& theName);
|
||||
};
|
||||
|
||||
#endif // _Express_HeaderFile
|
@@ -1,71 +0,0 @@
|
||||
// Created: Tue Nov 2 14:40:06 1999
|
||||
// Author: Andrey BETENEV
|
||||
// Copyright (c) 1999-2020 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 <Express_Alias.hxx>
|
||||
|
||||
#include <Message.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Express_Alias, Express_Item)
|
||||
|
||||
//=======================================================================
|
||||
// function : Express_Alias
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
Express_Alias::Express_Alias (const Standard_CString theName, const Handle(Express_Type)& theType)
|
||||
: Express_Item (theName), myType (theType)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Type
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Handle(Express_Type)& Express_Alias::Type() const
|
||||
{
|
||||
return myType;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : CPPName
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TCollection_AsciiString Express_Alias::CPPName() const
|
||||
{
|
||||
return myType->CPPName();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : GenerateClass
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Express_Alias::GenerateClass() const
|
||||
{
|
||||
Message::SendInfo() << "ALIAS " << Name() << " = " << Type()->CPPName() << " used; no generation is needed";
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : PropagateUse
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Express_Alias::PropagateUse() const
|
||||
{
|
||||
}
|
@@ -1,55 +0,0 @@
|
||||
// Copyright (c) 1999-2020 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 _Express_Alias_HeaderFile
|
||||
#define _Express_Alias_HeaderFile
|
||||
|
||||
#include <Express_Item.hxx>
|
||||
#include <Express_Type.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
class TCollection_AsciiString;
|
||||
|
||||
//! Implements TYPE = type (alias) item of the EXPRESS
|
||||
//! schema, with interface for deferred Item class.
|
||||
class Express_Alias : public Express_Item
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Create ALIAS item and initialize it
|
||||
Standard_EXPORT Express_Alias (const Standard_CString theName, const Handle(Express_Type)& theType);
|
||||
|
||||
//! Returns aliased type
|
||||
Standard_EXPORT const Handle(Express_Type)& Type() const;
|
||||
|
||||
//! Returns name of aliased type
|
||||
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const Standard_OVERRIDE;
|
||||
|
||||
//! Create HXX/CXX files from item
|
||||
Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE;
|
||||
|
||||
//! Propagates the calls of Use function
|
||||
Standard_EXPORT virtual void PropagateUse() const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Express_Alias, Express_Item)
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
Handle(Express_Type) myType;
|
||||
|
||||
};
|
||||
|
||||
#endif // _Express_Alias_HeaderFile
|
@@ -1,21 +0,0 @@
|
||||
// Copyright (c) 1999-2020 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 _Express_Array_HeaderFile
|
||||
#define _Express_Array_HeaderFile
|
||||
|
||||
#include <Express_ComplexType.hxx>
|
||||
|
||||
typedef Express_ComplexType Express_Array;
|
||||
|
||||
#endif // _Express_Array_HeaderFile
|
@@ -1,21 +0,0 @@
|
||||
// Copyright (c) 1999-2020 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 _Express_Bag_HeaderFile
|
||||
#define _Express_Bag_HeaderFile
|
||||
|
||||
#include <Express_ComplexType.hxx>
|
||||
|
||||
typedef Express_ComplexType Express_Bag;
|
||||
|
||||
#endif // _Express_Bag_HeaderFile
|
@@ -1,39 +0,0 @@
|
||||
// Created: Tue Nov 2 15:27:26 1999
|
||||
// Author: Andrey BETENEV
|
||||
// Copyright (c) 1999-2020 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 <Express_Boolean.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Express_Boolean, Express_PredefinedType)
|
||||
|
||||
//=======================================================================
|
||||
// function : Express_Boolean
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
Express_Boolean::Express_Boolean()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : CPPName
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TCollection_AsciiString Express_Boolean::CPPName() const
|
||||
{
|
||||
return "Standard_Boolean";
|
||||
}
|
@@ -1,42 +0,0 @@
|
||||
// Copyright (c) 1999-2020 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 _Express_Boolean_HeaderFile
|
||||
#define _Express_Boolean_HeaderFile
|
||||
|
||||
#include <Express_PredefinedType.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
class TCollection_AsciiString;
|
||||
|
||||
//! Implements EXPRESS type 'BOOLEAN'
|
||||
class Express_Boolean : public Express_PredefinedType
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT Express_Boolean();
|
||||
|
||||
//! Returns "Standard_Boolean"
|
||||
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Express_Boolean, Express_PredefinedType)
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif // _Express_Boolean_HeaderFile
|
@@ -1,114 +0,0 @@
|
||||
// Created: Tue Nov 2 15:13:31 1999
|
||||
// Author: Andrey BETENEV
|
||||
// Copyright (c) 1999-2020 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 <Express_ComplexType.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Express_ComplexType, Express_Type)
|
||||
|
||||
//=======================================================================
|
||||
// function : Express_ComplexType
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
Express_ComplexType::Express_ComplexType (const Standard_Integer theImin,
|
||||
const Standard_Integer theImax,
|
||||
const Handle(Express_Type)& theType)
|
||||
{
|
||||
myMin = theImin;
|
||||
myMax = theImax;
|
||||
myType = theType;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Type
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Handle(Express_Type)& Express_ComplexType::Type() const
|
||||
{
|
||||
return myType;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : CPPName
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TCollection_AsciiString Express_ComplexType::CPPName() const
|
||||
{
|
||||
// check if array 2
|
||||
Handle(Express_Type) aType = myType;
|
||||
if (aType->IsKind (STANDARD_TYPE(Express_ComplexType)))
|
||||
{
|
||||
Handle(Express_ComplexType) aType2 = Handle(Express_ComplexType)::DownCast (aType);
|
||||
aType = aType2->Type();
|
||||
}
|
||||
|
||||
// parse name of array argument
|
||||
TCollection_AsciiString aName = aType->CPPName();
|
||||
Standard_Integer aSplitIdx = aName.Location (1, '_', 1, aName.Length());
|
||||
TCollection_AsciiString aClassName;
|
||||
if (aSplitIdx)
|
||||
{
|
||||
aClassName = aName.Split (aSplitIdx);
|
||||
}
|
||||
else
|
||||
{
|
||||
aClassName = aName;
|
||||
}
|
||||
Standard_Integer anIdx = aName.Location ("TCollection", 1, aName.Length());
|
||||
if (anIdx)
|
||||
{
|
||||
aName = "Interface_";
|
||||
}
|
||||
// generate name
|
||||
if (aType->IsStandard() || !aSplitIdx)
|
||||
{
|
||||
aName = "TColStd_";
|
||||
}
|
||||
if (aType == myType)
|
||||
{
|
||||
aName += "HArray1Of";
|
||||
}
|
||||
else
|
||||
{
|
||||
aName += "HArray2Of";
|
||||
}
|
||||
aName += aClassName;
|
||||
|
||||
return aName;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Use
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Express_ComplexType::Use() const
|
||||
{
|
||||
return myType->Use();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Use2
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Express_ComplexType::Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack) const
|
||||
{
|
||||
myType->Use2 (theRefName, theRefPack);
|
||||
}
|
@@ -1,61 +0,0 @@
|
||||
// Copyright (c) 1999-2020 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 _Express_ComplexType_HeaderFile
|
||||
#define _Express_ComplexType_HeaderFile
|
||||
|
||||
#include <Express_Type.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
class TCollection_AsciiString;
|
||||
|
||||
//! Base class for complex types (ARRAY, LIST, BAG, SET)
|
||||
//! in EXPRESS schema
|
||||
//! Stores type of elements and
|
||||
class Express_ComplexType : public Express_Type
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Creates an object and initializes fields
|
||||
Standard_EXPORT Express_ComplexType (const Standard_Integer theImin,
|
||||
const Standard_Integer theImax,
|
||||
const Handle(Express_Type)& theType);
|
||||
|
||||
//! Returns type of complex type items
|
||||
Standard_EXPORT const Handle(Express_Type)& Type() const;
|
||||
|
||||
//! Returns CPP-style name of the type
|
||||
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const Standard_OVERRIDE;
|
||||
|
||||
//! Declares type as used by some item being generated.
|
||||
//! Calls Use() for type of elements
|
||||
Standard_EXPORT virtual Standard_Boolean Use() const Standard_OVERRIDE;
|
||||
|
||||
//! Declares type as used by some item being generated.
|
||||
//! Calls Use() for type of elements
|
||||
Standard_EXPORT virtual void Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Express_ComplexType, Express_Type)
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
Standard_Integer myMin;
|
||||
Standard_Integer myMax;
|
||||
Handle(Express_Type) myType;
|
||||
|
||||
};
|
||||
|
||||
#endif // _Express_ComplexType_HeaderFile
|
@@ -1,24 +0,0 @@
|
||||
// Copyright (c) 1999-2020 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 Express_DataMapOfAsciiStringItem_HeaderFile
|
||||
#define Express_DataMapOfAsciiStringItem_HeaderFile
|
||||
|
||||
#include <Express_Item.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
typedef NCollection_DataMap<TCollection_AsciiString, Handle(Express_Item),
|
||||
TCollection_AsciiString> Express_DataMapOfAsciiStringItem;
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user