mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-13 14:27:08 +03:00
Compare commits
19 Commits
deg_curve_
...
CR31644_2
Author | SHA1 | Date | |
---|---|---|---|
|
706bd14880 | ||
|
b6b7767a4d | ||
|
881def360b | ||
|
e5f9f70649 | ||
|
a8a8017114 | ||
|
60360e3204 | ||
|
4012dc463e | ||
|
8a067c43b7 | ||
|
2027acc3de | ||
|
73fcf4b4ed | ||
|
69281b1bac | ||
|
fb3c2c739c | ||
|
104c5f4261 | ||
|
2d4070bed7 | ||
|
c8c36fda1c | ||
|
fbee65efd6 | ||
|
d65feb6928 | ||
|
491e742d67 | ||
|
870d891898 |
@@ -596,8 +596,15 @@ jobs:
|
|||||||
if: steps.check_failures.outputs.failed_count > 0
|
if: steps.check_failures.outputs.failed_count > 0
|
||||||
run: |
|
run: |
|
||||||
cd install/results/windows-x64-retest
|
cd install/results/windows-x64-retest
|
||||||
|
$failedCount = 0
|
||||||
if (Test-Path tests.log) {
|
if (Test-Path tests.log) {
|
||||||
$failedCount = (Select-String -Path tests.log -Pattern "Total cases:.*FAILED" | ForEach-Object { $_.Matches } | ForEach-Object { $_.Groups[1].Value }) -as [int]
|
$content = Get-Content tests.log
|
||||||
|
$totalLine = $content | Select-String "Total cases:"
|
||||||
|
if ($totalLine) {
|
||||||
|
if ($totalLine -match "FAILED") {
|
||||||
|
$failedCount = ($totalLine | ForEach-Object { $_.Line -replace '.*?(\d+) FAILED.*','$1' }) -as [int]
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($failedCount -gt 0) {
|
if ($failedCount -gt 0) {
|
||||||
Write-Error "Number of FAILED tests ($failedCount) exceeds threshold of 0"
|
Write-Error "Number of FAILED tests ($failedCount) exceeds threshold of 0"
|
||||||
echo "FAILED_COUNT=$failedCount" >> $env:GITHUB_ENV
|
echo "FAILED_COUNT=$failedCount" >> $env:GITHUB_ENV
|
||||||
@@ -830,8 +837,15 @@ jobs:
|
|||||||
if: steps.check_failures.outputs.failed_count > 0
|
if: steps.check_failures.outputs.failed_count > 0
|
||||||
run: |
|
run: |
|
||||||
cd install/results/windows-clang-x64-retest
|
cd install/results/windows-clang-x64-retest
|
||||||
|
$failedCount = 0
|
||||||
if (Test-Path tests.log) {
|
if (Test-Path tests.log) {
|
||||||
$failedCount = (Select-String -Path tests.log -Pattern "Total cases:.*FAILED" | ForEach-Object { $_.Matches } | ForEach-Object { $_.Groups[1].Value }) -as [int]
|
$content = Get-Content tests.log
|
||||||
|
$totalLine = $content | Select-String "Total cases:"
|
||||||
|
if ($totalLine) {
|
||||||
|
if ($totalLine -match "FAILED") {
|
||||||
|
$failedCount = ($totalLine | ForEach-Object { $_.Line -replace '.*?(\d+) FAILED.*','$1' }) -as [int]
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($failedCount -gt 0) {
|
if ($failedCount -gt 0) {
|
||||||
Write-Error "Number of FAILED tests ($failedCount) exceeds threshold of 0"
|
Write-Error "Number of FAILED tests ($failedCount) exceeds threshold of 0"
|
||||||
echo "FAILED_COUNT=$failedCount" >> $env:GITHUB_ENV
|
echo "FAILED_COUNT=$failedCount" >> $env:GITHUB_ENV
|
||||||
|
@@ -93,6 +93,10 @@ if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared")
|
|||||||
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX "" CACHE STRING "${BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR}" FORCE)
|
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX "" CACHE STRING "${BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR}" FORCE)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
|
message(AUTHOR_WARNING "OCCT is licensed under LGPL 2.1, which has limitations on"
|
||||||
|
"static linking with proprietary software."
|
||||||
|
"OCCT3D offers commercial licensing exceptions to LGPL 2.1."
|
||||||
|
"Please use our contact form at https://occt3d.com/")
|
||||||
unset (BUILD_SHARED_LIBS)
|
unset (BUILD_SHARED_LIBS)
|
||||||
unset (BUILD_SHARED_LIBRARY_NAME_POSTFIX)
|
unset (BUILD_SHARED_LIBRARY_NAME_POSTFIX)
|
||||||
endif()
|
endif()
|
||||||
@@ -975,6 +979,9 @@ message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all OCCT header fi
|
|||||||
# collect all the headers to <binary dir>/inc folder
|
# collect all the headers to <binary dir>/inc folder
|
||||||
COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}" "src" "${INSTALL_DIR_INCLUDE}")
|
COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}" "src" "${INSTALL_DIR_INCLUDE}")
|
||||||
|
|
||||||
|
# Create and install Standard_Version.hxx
|
||||||
|
CONFIGURE_AND_INSTALL_VERSION_HEADER()
|
||||||
|
|
||||||
string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
|
string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
|
||||||
message (STATUS "Info: \(${CURRENT_TIME}\) End the collecting")
|
message (STATUS "Info: \(${CURRENT_TIME}\) End the collecting")
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ Consult the file [dox/build/build_occt/building_occt.md](dox/build/build_occt/bu
|
|||||||
|
|
||||||
## Version
|
## Version
|
||||||
|
|
||||||
The current version of OCCT can be found in the file [`src/Standard/Standard_Version.hxx`](src/Standard/Standard_Version.hxx).
|
The current version of OCCT can be found in the file [`adm/cmake/version.cmake`](adm/cmake/version.cmake).
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
|
@@ -75,6 +75,10 @@ endmacro()
|
|||||||
# COMPILER variable
|
# COMPILER variable
|
||||||
macro (OCCT_MAKE_COMPILER_SHORT_NAME)
|
macro (OCCT_MAKE_COMPILER_SHORT_NAME)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
if (MSVC_VERSION LESS 1914)
|
||||||
|
message (AUTHOR_WARNING "Microsoft Visual C++ 19.14 (VS 2017 15.7) or newer is required for C++17 support")
|
||||||
|
endif()
|
||||||
|
|
||||||
if ((MSVC_VERSION EQUAL 1300) OR (MSVC_VERSION EQUAL 1310))
|
if ((MSVC_VERSION EQUAL 1300) OR (MSVC_VERSION EQUAL 1310))
|
||||||
set (COMPILER vc7)
|
set (COMPILER vc7)
|
||||||
elseif (MSVC_VERSION EQUAL 1400)
|
elseif (MSVC_VERSION EQUAL 1400)
|
||||||
@@ -92,20 +96,39 @@ macro (OCCT_MAKE_COMPILER_SHORT_NAME)
|
|||||||
elseif ((MSVC_VERSION GREATER 1900) AND (MSVC_VERSION LESS 2000))
|
elseif ((MSVC_VERSION GREATER 1900) AND (MSVC_VERSION LESS 2000))
|
||||||
# Since Visual Studio 15 (2017), its version diverged from version of
|
# Since Visual Studio 15 (2017), its version diverged from version of
|
||||||
# compiler which is 14.1; as that compiler uses the same run-time as 14.0,
|
# compiler which is 14.1; as that compiler uses the same run-time as 14.0,
|
||||||
# we keep its id as "vc14" to be compatibille
|
# we keep its id as "vc14" to be compatible
|
||||||
set (COMPILER vc14)
|
set (COMPILER vc14)
|
||||||
else()
|
else()
|
||||||
message (FATAL_ERROR "Unrecognized MSVC_VERSION")
|
message (FATAL_ERROR "Unrecognized MSVC_VERSION")
|
||||||
endif()
|
endif()
|
||||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCC)
|
elseif (DEFINED CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
|
||||||
|
message (AUTHOR_WARNING "GCC version 8.0 or newer is required for C++17 support")
|
||||||
|
endif()
|
||||||
set (COMPILER gcc)
|
set (COMPILER gcc)
|
||||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
|
||||||
|
message (AUTHOR_WARNING "GCC version 8.0 or newer is required for C++17 support")
|
||||||
|
endif()
|
||||||
set (COMPILER gxx)
|
set (COMPILER gxx)
|
||||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||||
|
if(APPLE)
|
||||||
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0.0)
|
||||||
|
message (AUTHOR_WARNING "Apple Clang version 11.0.0 or newer is required for C++17 support")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
|
||||||
|
message (AUTHOR_WARNING "Clang version 7.0 or newer is required for C++17 support")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
set (COMPILER clang)
|
set (COMPILER clang)
|
||||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
|
||||||
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17.1.1)
|
||||||
|
message (AUTHOR_WARNING "Intel C++ Compiler version 17.1.1 or newer is required for C++17 support")
|
||||||
|
endif()
|
||||||
set (COMPILER icc)
|
set (COMPILER icc)
|
||||||
else()
|
else()
|
||||||
|
message (AUTHOR_WARNING "Unknown compiler - please verify C++17 support")
|
||||||
set (COMPILER ${CMAKE_GENERATOR})
|
set (COMPILER ${CMAKE_GENERATOR})
|
||||||
string (REGEX REPLACE " " "" COMPILER ${COMPILER})
|
string (REGEX REPLACE " " "" COMPILER ${COMPILER})
|
||||||
endif()
|
endif()
|
||||||
@@ -458,6 +481,18 @@ function (COLLECT_AND_INSTALL_OCCT_HEADER_FILES THE_ROOT_TARGET_OCCT_DIR THE_OCC
|
|||||||
install (FILES ${OCCT_HEADER_FILES_INSTALLATION} DESTINATION "${INSTALL_DIR}/${THE_OCCT_INSTALL_DIR_PREFIX}")
|
install (FILES ${OCCT_HEADER_FILES_INSTALLATION} DESTINATION "${INSTALL_DIR}/${THE_OCCT_INSTALL_DIR_PREFIX}")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# Macro to configure and install Standard_Version.hxx file
|
||||||
|
macro (CONFIGURE_AND_INSTALL_VERSION_HEADER)
|
||||||
|
if (DEFINED BUILD_OCCT_VERSION_EXT AND "${BUILD_OCCT_VERSION_EXT}" STREQUAL "${OCC_VERSION_STRING_EXT}" AND EXISTS "${CMAKE_BINARY_DIR}/${INSTALL_DIR_INCLUDE}/Standard_Version.hxx")
|
||||||
|
install(FILES "${OCCT_BINARY_DIR}/${INSTALL_DIR_INCLUDE}/Standard_Version.hxx" DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_INCLUDE}")
|
||||||
|
else()
|
||||||
|
set(BUILD_OCCT_VERSION_EXT "${OCC_VERSION_STRING_EXT}" CACHE STRING "OCCT Version string. Used only for caching, can't impact on build. For modification of version, please check adm/cmake/version.cmake" FORCE)
|
||||||
|
mark_as_advanced(BUILD_OCCT_VERSION_EXT)
|
||||||
|
string(TIMESTAMP OCCT_VERSION_DATE "%Y-%m-%d" UTC)
|
||||||
|
OCCT_CONFIGURE_AND_INSTALL ("adm/templates/Standard_Version.hxx.in" "${INSTALL_DIR_INCLUDE}/Standard_Version.hxx" "Standard_Version.hxx" "${INSTALL_DIR}/${INSTALL_DIR_INCLUDE}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
function(ADD_PRECOMPILED_HEADER INPUT_TARGET PRECOMPILED_HEADER THE_IS_PRIVATE)
|
function(ADD_PRECOMPILED_HEADER INPUT_TARGET PRECOMPILED_HEADER THE_IS_PRIVATE)
|
||||||
if (NOT BUILD_USE_PCH)
|
if (NOT BUILD_USE_PCH)
|
||||||
return()
|
return()
|
||||||
@@ -550,42 +585,69 @@ function (OCCT_MODULES_AND_TOOLKITS FILE_NAME TOOLKITS_NAME_SUFFIX MODULE_LIST)
|
|||||||
set (${MODULE_LIST} ${${MODULE_LIST}} PARENT_SCOPE)
|
set (${MODULE_LIST} ${${MODULE_LIST}} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Returns OCC version string from file Standard_Version.hxx (if available)
|
|
||||||
|
# Macro to extract git hash from the source directory
|
||||||
|
# and store it in the variable GIT_HASH
|
||||||
|
# in case if git is not found or error occurs, GIT_HASH is set to empty string
|
||||||
|
macro(OCCT_GET_GIT_HASH)
|
||||||
|
set(GIT_HASH "")
|
||||||
|
|
||||||
|
find_package(Git QUIET)
|
||||||
|
if(GIT_FOUND)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE GIT_HASH
|
||||||
|
ERROR_VARIABLE GIT_ERROR
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
if(NOT GIT_ERROR)
|
||||||
|
# Check if working directory is clean
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} status --porcelain
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE GIT_STATUS
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
if(NOT "${GIT_STATUS}" STREQUAL "")
|
||||||
|
message(DEBUG "Git working directory is not clean. Git hash may be incorrect.")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(GIT_HASH "")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Returns OCC version string
|
||||||
function (OCC_VERSION OCC_VERSION_MAJOR OCC_VERSION_MINOR OCC_VERSION_MAINTENANCE OCC_VERSION_DEVELOPMENT OCC_VERSION_STRING_EXT)
|
function (OCC_VERSION OCC_VERSION_MAJOR OCC_VERSION_MINOR OCC_VERSION_MAINTENANCE OCC_VERSION_DEVELOPMENT OCC_VERSION_STRING_EXT)
|
||||||
|
|
||||||
set (OCC_VERSION_MAJOR 7)
|
include (version)
|
||||||
set (OCC_VERSION_MINOR 0)
|
set (OCC_VERSION_COMPLETE "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
|
||||||
set (OCC_VERSION_MAINTENANCE 0)
|
set (OCC_VERSION_STRING_EXT "${OCC_VERSION_COMPLETE}")
|
||||||
set (OCC_VERSION_DEVELOPMENT dev)
|
|
||||||
set (OCC_VERSION_COMPLETE "7.0.0")
|
|
||||||
|
|
||||||
set (STANDARD_VERSION_FILE "${CMAKE_SOURCE_DIR}/src/Standard/Standard_Version.hxx")
|
|
||||||
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/src/Standard/Standard_Version.hxx")
|
|
||||||
set (STANDARD_VERSION_FILE "${BUILD_PATCH}/src/Standard/Standard_Version.hxx")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (EXISTS "${STANDARD_VERSION_FILE}")
|
|
||||||
foreach (SOUGHT_VERSION OCC_VERSION_MAJOR OCC_VERSION_MINOR OCC_VERSION_MAINTENANCE)
|
|
||||||
file (STRINGS "${STANDARD_VERSION_FILE}" ${SOUGHT_VERSION} REGEX "^#define ${SOUGHT_VERSION} .*")
|
|
||||||
string (REGEX REPLACE ".*${SOUGHT_VERSION} .*([^ ]+).*" "\\1" ${SOUGHT_VERSION} "${${SOUGHT_VERSION}}" )
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
foreach (SOUGHT_VERSION OCC_VERSION_DEVELOPMENT OCC_VERSION_COMPLETE)
|
|
||||||
file (STRINGS "${STANDARD_VERSION_FILE}" ${SOUGHT_VERSION} REGEX "^#define ${SOUGHT_VERSION} .*")
|
|
||||||
string (REGEX REPLACE ".*${SOUGHT_VERSION} .*\"([^ ]+)\".*" "\\1" ${SOUGHT_VERSION} "${${SOUGHT_VERSION}}" )
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set (OCC_VERSION_MAJOR "${OCC_VERSION_MAJOR}" PARENT_SCOPE)
|
set (OCC_VERSION_MAJOR "${OCC_VERSION_MAJOR}" PARENT_SCOPE)
|
||||||
set (OCC_VERSION_MINOR "${OCC_VERSION_MINOR}" PARENT_SCOPE)
|
set (OCC_VERSION_MINOR "${OCC_VERSION_MINOR}" PARENT_SCOPE)
|
||||||
set (OCC_VERSION_MAINTENANCE "${OCC_VERSION_MAINTENANCE}" PARENT_SCOPE)
|
set (OCC_VERSION_MAINTENANCE "${OCC_VERSION_MAINTENANCE}" PARENT_SCOPE)
|
||||||
set (OCC_VERSION_DEVELOPMENT "${OCC_VERSION_DEVELOPMENT}" PARENT_SCOPE)
|
set (OCCT_ON_DEVELOPMENT OFF)
|
||||||
|
if (NOT "${OCC_VERSION_DEVELOPMENT}" STREQUAL "" AND NOT "${OCC_VERSION_DEVELOPMENT}" STREQUAL "OCC_VERSION_DEVELOPMENT")
|
||||||
if (OCC_VERSION_DEVELOPMENT AND OCC_VERSION_COMPLETE)
|
set (OCCT_ON_DEVELOPMENT ON)
|
||||||
set (OCC_VERSION_STRING_EXT "${OCC_VERSION_COMPLETE}.${OCC_VERSION_DEVELOPMENT}" PARENT_SCOPE)
|
|
||||||
else()
|
|
||||||
set (OCC_VERSION_STRING_EXT "${OCC_VERSION_COMPLETE}" PARENT_SCOPE)
|
|
||||||
endif()
|
endif()
|
||||||
|
if (${OCCT_ON_DEVELOPMENT})
|
||||||
|
set (OCC_VERSION_DEVELOPMENT "${OCC_VERSION_DEVELOPMENT}" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set (SET_OCC_VERSION_DEVELOPMENT "")
|
||||||
|
if (${OCCT_ON_DEVELOPMENT})
|
||||||
|
OCCT_GET_GIT_HASH()
|
||||||
|
if (NOT "${GIT_HASH}" STREQUAL "")
|
||||||
|
set (OCC_VERSION_DEVELOPMENT "${OCC_VERSION_DEVELOPMENT}-${GIT_HASH}")
|
||||||
|
set (OCC_VERSION_DEVELOPMENT "${OCC_VERSION_DEVELOPMENT}" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
set (OCC_VERSION_STRING_EXT "${OCC_VERSION_COMPLETE}.${OCC_VERSION_DEVELOPMENT}")
|
||||||
|
set (OCC_VERSION_STRING_EXT "${OCC_VERSION_STRING_EXT}" PARENT_SCOPE)
|
||||||
|
set (SET_OCC_VERSION_DEVELOPMENT "#define OCC_VERSION_DEVELOPMENT \"${OCC_VERSION_DEVELOPMENT}\"")
|
||||||
|
endif()
|
||||||
|
set (OCC_VERSION_STRING_EXT "${OCC_VERSION_STRING_EXT}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
macro (CHECK_PATH_FOR_CONSISTENCY THE_ROOT_PATH_NAME THE_BEING_CHECKED_PATH_NAME THE_VAR_TYPE THE_MESSAGE_OF_BEING_CHECKED_PATH)
|
macro (CHECK_PATH_FOR_CONSISTENCY THE_ROOT_PATH_NAME THE_BEING_CHECKED_PATH_NAME THE_VAR_TYPE THE_MESSAGE_OF_BEING_CHECKED_PATH)
|
||||||
|
22
adm/cmake/version.cmake
Normal file
22
adm/cmake/version.cmake
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#======================================================================
|
||||||
|
#
|
||||||
|
# Purpose: Defines macros identifying current version of Open CASCADE
|
||||||
|
#
|
||||||
|
# OCC_VERSION_MAJOR : (integer) number identifying major version
|
||||||
|
# OCC_VERSION_MINOR : (integer) number identifying minor version
|
||||||
|
# OCC_VERSION_MAINTENANCE : (integer) number identifying maintenance version
|
||||||
|
# OCC_VERSION_DEVELOPMENT : (string) if defined, indicates development or modified version
|
||||||
|
# in case of release, remove the value
|
||||||
|
#
|
||||||
|
# Sample values of OCC_VERSION_DEVELOPMENT:
|
||||||
|
# - "dev" for development version between releases
|
||||||
|
# - "beta..." or "rc..." for beta releases or release candidates
|
||||||
|
# - "project..." for version containing project-specific fixes
|
||||||
|
#
|
||||||
|
# For development version git commit hash can be added to the version string
|
||||||
|
#======================================================================
|
||||||
|
|
||||||
|
set (OCC_VERSION_MAJOR 7 )
|
||||||
|
set (OCC_VERSION_MINOR 8 )
|
||||||
|
set (OCC_VERSION_MAINTENANCE 2 )
|
||||||
|
set (OCC_VERSION_DEVELOPMENT "dev" )
|
@@ -142,17 +142,20 @@ proc OCCDoc_GetRelPath {thePathFrom thePathTo} {
|
|||||||
return $thePathTo
|
return $thePathTo
|
||||||
}
|
}
|
||||||
|
|
||||||
# Returns OCCT version string from file Standard_Version.hxx (if available)
|
# Returns OCCT version string from version.cmake (if available)
|
||||||
proc OCCDoc_DetectCasVersion {} {
|
proc OCCDoc_DetectCasVersion {} {
|
||||||
set occt_ver 6.7.0
|
set occt_ver "7.8.0"
|
||||||
set occt_ver_add ""
|
set occt_ver_add ""
|
||||||
set filename "[OCCDoc_GetSourceDir]/Standard/Standard_Version.hxx"
|
set filename "[OCCDoc_GetSourceDir]/../adm/cmake/version.cmake"
|
||||||
if { [file exists $filename] } {
|
if { [file exists $filename] } {
|
||||||
set fh [open $filename "r"]
|
set fh [open $filename "r"]
|
||||||
set fh_loaded [read $fh]
|
set fh_loaded [read $fh]
|
||||||
close $fh
|
close $fh
|
||||||
regexp {[^/]\s*#\s*define\s+OCC_VERSION_COMPLETE\s+\"([^\s]*)\"} $fh_loaded dummy occt_ver
|
regexp {set\s+OCC_VERSION_MAJOR\s+([0-9]+)} $fh_loaded dummy major
|
||||||
regexp {[^/]\s*#\s*define\s+OCC_VERSION_DEVELOPMENT\s+\"([^\s]*)\"} $fh_loaded dummy occt_ver_add
|
regexp {set\s+OCC_VERSION_MINOR\s+([0-9]+)} $fh_loaded dummy minor
|
||||||
|
regexp {set\s+OCC_VERSION_MAINTENANCE\s+([0-9]+)} $fh_loaded dummy maint
|
||||||
|
regexp {set\s+OCC_VERSION_DEVELOPMENT\s+\"([^\"]+)\"} $fh_loaded dummy occt_ver_add
|
||||||
|
set occt_ver "$major.$minor.$maint"
|
||||||
if { "$occt_ver_add" != "" } { set occt_ver ${occt_ver}.$occt_ver_add }
|
if { "$occt_ver_add" != "" } { set occt_ver ${occt_ver}.$occt_ver_add }
|
||||||
}
|
}
|
||||||
return $occt_ver
|
return $occt_ver
|
||||||
|
@@ -67,8 +67,9 @@ if ["%toCMake%"] == ["1"] (
|
|||||||
set "anOcctVerSuffix="
|
set "anOcctVerSuffix="
|
||||||
set "anOcctVersion=0.0.0"
|
set "anOcctVersion=0.0.0"
|
||||||
set "aGitBranch="
|
set "aGitBranch="
|
||||||
for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_DEVELOPMENT" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVerSuffix=%%i" )
|
rem Get OCCT version
|
||||||
for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_COMPLETE" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVersion=%%i" )
|
call "%~dp0build_common.bat"
|
||||||
|
set "aGitBranch="
|
||||||
for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" )
|
for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" )
|
||||||
|
|
||||||
for %%s in (%anNdkAbiList%) do (
|
for %%s in (%anNdkAbiList%) do (
|
||||||
|
8
adm/scripts/build_common.bat
Normal file
8
adm/scripts/build_common.bat
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
@echo OFF
|
||||||
|
|
||||||
|
rem Extract version info from version.cmake
|
||||||
|
for /f tokens^=2^ delims^=^" %%i in ('findstr OCC_VERSION_DEVELOPMENT "%~dp0\..\cmake\version.cmake"') do ( set "anOcctVerSuffix=%%i" )
|
||||||
|
for /f tokens^=3 %%i in ('findstr OCC_VERSION_MAJOR "%~dp0\..\cmake\version.cmake"') do ( set "OCC_VERSION_MAJOR=%%i" )
|
||||||
|
for /f tokens^=3 %%i in ('findstr OCC_VERSION_MINOR "%~dp0\..\cmake\version.cmake"') do ( set "OCC_VERSION_MINOR=%%i" )
|
||||||
|
for /f tokens^=3 %%i in ('findstr OCC_VERSION_MAINTENANCE "%~dp0\..\cmake\version.cmake"') do ( set "OCC_VERSION_MAINTENANCE=%%i" )
|
||||||
|
set "anOcctVersion=%OCC_VERSION_MAJOR%.%OCC_VERSION_MINOR%.%OCC_VERSION_MAINTENANCE%"
|
30
adm/scripts/build_common.sh
Normal file
30
adm/scripts/build_common.sh
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Ensure script dir is defined
|
||||||
|
if [ -z "$aScriptDir" ]; then
|
||||||
|
aScriptDir=$(dirname "$0")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if version file exists
|
||||||
|
versionFile="$aScriptDir/../cmake/version.cmake"
|
||||||
|
if [ ! -f "$versionFile" ]; then
|
||||||
|
echo "Error: version.cmake not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extract version info from version.cmake
|
||||||
|
OCC_VERSION_MAJOR=$(awk '/set.*OCC_VERSION_MAJOR/ {print $3}' "$versionFile")
|
||||||
|
OCC_VERSION_MINOR=$(awk '/set.*OCC_VERSION_MINOR/ {print $3}' "$versionFile")
|
||||||
|
OCC_VERSION_MAINTENANCE=$(awk '/set.*OCC_VERSION_MAINTENANCE/ {print $3}' "$versionFile")
|
||||||
|
anOcctVerSuffix=$(awk '/set.*OCC_VERSION_DEVELOPMENT/ {
|
||||||
|
if (NF > 2) {
|
||||||
|
gsub(/[)" ]/, "", $3)
|
||||||
|
print $3
|
||||||
|
} else {
|
||||||
|
print ""
|
||||||
|
}
|
||||||
|
}' "$versionFile")
|
||||||
|
|
||||||
|
# Combine version string
|
||||||
|
anOcctVersion="${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}"
|
||||||
|
|
@@ -49,8 +49,7 @@ if [[ -f "${aScriptDir}/ios_custom.sh" ]]; then
|
|||||||
source "${aScriptDir}/ios_custom.sh"
|
source "${aScriptDir}/ios_custom.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
source "${aScriptDir}/build_common.sh"
|
||||||
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
|
||||||
aGitBranch=`git symbolic-ref --short HEAD`
|
aGitBranch=`git symbolic-ref --short HEAD`
|
||||||
|
|
||||||
YEAR=$(date +"%Y")
|
YEAR=$(date +"%Y")
|
||||||
|
@@ -51,8 +51,7 @@ if [[ -f "${aScriptDir}/macos_custom.sh" ]]; then
|
|||||||
source "${aScriptDir}/macos_custom.sh"
|
source "${aScriptDir}/macos_custom.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
source "${aScriptDir}/build_common.sh"
|
||||||
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
|
||||||
aGitBranch=`git symbolic-ref --short HEAD`
|
aGitBranch=`git symbolic-ref --short HEAD`
|
||||||
|
|
||||||
YEAR=$(date +"%Y")
|
YEAR=$(date +"%Y")
|
||||||
|
@@ -53,9 +53,8 @@ if not ["%aCmakeBin%"] == [""] ( set "PATH=%aCmakeBin%;%PATH%" )
|
|||||||
|
|
||||||
set "anOcctVerSuffix="
|
set "anOcctVerSuffix="
|
||||||
set "anOcctVersion=0.0.0"
|
set "anOcctVersion=0.0.0"
|
||||||
|
call "%~dp0build_common.bat"
|
||||||
set "aGitBranch="
|
set "aGitBranch="
|
||||||
for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_DEVELOPMENT" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVerSuffix=%%i" )
|
|
||||||
for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_COMPLETE" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVersion=%%i" )
|
|
||||||
for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" )
|
for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" )
|
||||||
|
|
||||||
set "aBuildType=Release"
|
set "aBuildType=Release"
|
||||||
|
@@ -55,8 +55,8 @@ if not ["%aCmakeBin%"] == [""] ( set "PATH=%aCmakeBin%;%PATH%" )
|
|||||||
set "anOcctVerSuffix="
|
set "anOcctVerSuffix="
|
||||||
set "anOcctVersion=0.0.0"
|
set "anOcctVersion=0.0.0"
|
||||||
set "aGitBranch="
|
set "aGitBranch="
|
||||||
for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_DEVELOPMENT" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVerSuffix=%%i" )
|
call "%~dp0build_common.bat"
|
||||||
for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_COMPLETE" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVersion=%%i" )
|
set "aGitBranch="
|
||||||
for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" )
|
for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" )
|
||||||
|
|
||||||
set "aBuildType=Release"
|
set "aBuildType=Release"
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
// Created on: 2002-07-09
|
// Created on: @OCCT_VERSION_DATE@
|
||||||
// Created by: Andrey BETENEV
|
// Copyright (c) 2002-2025 OPEN CASCADE SAS
|
||||||
// Copyright (c) 2002-2014 OPEN CASCADE SAS
|
|
||||||
//
|
//
|
||||||
// This file is part of Open CASCADE Technology software library.
|
// This file is part of Open CASCADE Technology software library.
|
||||||
//
|
//
|
||||||
@@ -37,21 +36,21 @@ major, minor, and patch number
|
|||||||
#define _Standard_Version_HeaderFile
|
#define _Standard_Version_HeaderFile
|
||||||
|
|
||||||
// Primary definitions
|
// Primary definitions
|
||||||
#define OCC_VERSION_MAJOR 7
|
#define OCC_VERSION_MAJOR @OCC_VERSION_MAJOR@
|
||||||
#define OCC_VERSION_MINOR 8
|
#define OCC_VERSION_MINOR @OCC_VERSION_MINOR@
|
||||||
#define OCC_VERSION_MAINTENANCE 2
|
#define OCC_VERSION_MAINTENANCE @OCC_VERSION_MAINTENANCE@
|
||||||
|
|
||||||
//! This macro must be commented in official release, and set to non-empty
|
//! This macro must be commented in official release, and set to non-empty
|
||||||
//! string in other situations, to identify specifics of the version, e.g.:
|
//! string in other situations, to identify specifics of the version, e.g.:
|
||||||
//! - "dev" for development version between releases
|
//! - "dev" for development version between releases
|
||||||
//! - "beta..." or "rc..." for beta releases or release candidates
|
//! - "beta..." or "rc..." for beta releases or release candidates
|
||||||
//! - "project..." for version containing project-specific fixes
|
//! - "project..." for version containing project-specific fixes
|
||||||
#define OCC_VERSION_DEVELOPMENT "dev"
|
@SET_OCC_VERSION_DEVELOPMENT@
|
||||||
|
|
||||||
// Derived (manually): version as real and string (major.minor)
|
// Derived (manually): version as real and string (major.minor)
|
||||||
#define OCC_VERSION 7.8
|
#define OCC_VERSION @OCC_VERSION_MAJOR@.@OCC_VERSION_MINOR@
|
||||||
#define OCC_VERSION_STRING "7.8"
|
#define OCC_VERSION_STRING "@OCC_VERSION_MAJOR@.@OCC_VERSION_MINOR@"
|
||||||
#define OCC_VERSION_COMPLETE "7.8.2"
|
#define OCC_VERSION_COMPLETE "@OCC_VERSION_MAJOR@.@OCC_VERSION_MINOR@.@OCC_VERSION_MAINTENANCE@"
|
||||||
|
|
||||||
//! Derived: extended version as string ("major.minor.maintenance.dev")
|
//! Derived: extended version as string ("major.minor.maintenance.dev")
|
||||||
#ifdef OCC_VERSION_DEVELOPMENT
|
#ifdef OCC_VERSION_DEVELOPMENT
|
@@ -20,7 +20,7 @@ BEGIN
|
|||||||
VALUE "LegalCopyright", "\251 OPEN CASCADE SAS\000"
|
VALUE "LegalCopyright", "\251 OPEN CASCADE SAS\000"
|
||||||
VALUE "ProductName", "Open CASCADE Technology\000"
|
VALUE "ProductName", "Open CASCADE Technology\000"
|
||||||
VALUE "ProductVersion", OCC_VERSION_STRING_EXT "\000"
|
VALUE "ProductVersion", OCC_VERSION_STRING_EXT "\000"
|
||||||
VALUE "OfficialSite", "www.opencascade.com\000"
|
VALUE "OfficialSite", "www.occt3d.com\000"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
@@ -937,6 +937,11 @@ void AIS_InteractiveContext::RecomputePrsOnly(const Handle(AIS_InteractiveObject
|
|||||||
{
|
{
|
||||||
myMainVwr->Update();
|
myMainVwr->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!myMainVwr->ActiveViews().IsEmpty())
|
||||||
|
{
|
||||||
|
theIObj->RecomputeTransformation(myMainVwr->ActiveViewIterator().Value()->Camera());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================================
|
//=================================================================================================
|
||||||
|
@@ -236,6 +236,7 @@ AIS_Manipulator::AIS_Manipulator()
|
|||||||
: myPosition(gp::XOY()),
|
: myPosition(gp::XOY()),
|
||||||
myCurrentIndex(-1),
|
myCurrentIndex(-1),
|
||||||
myCurrentMode(AIS_MM_None),
|
myCurrentMode(AIS_MM_None),
|
||||||
|
mySkinMode(ManipulatorSkin_Shaded),
|
||||||
myIsActivationOnDetection(Standard_False),
|
myIsActivationOnDetection(Standard_False),
|
||||||
myIsZoomPersistentMode(Standard_True),
|
myIsZoomPersistentMode(Standard_True),
|
||||||
myHasStartedTransformation(Standard_False),
|
myHasStartedTransformation(Standard_False),
|
||||||
@@ -255,6 +256,7 @@ AIS_Manipulator::AIS_Manipulator(const gp_Ax2& thePosition)
|
|||||||
: myPosition(thePosition),
|
: myPosition(thePosition),
|
||||||
myCurrentIndex(-1),
|
myCurrentIndex(-1),
|
||||||
myCurrentMode(AIS_MM_None),
|
myCurrentMode(AIS_MM_None),
|
||||||
|
mySkinMode(ManipulatorSkin_Shaded),
|
||||||
myIsActivationOnDetection(Standard_False),
|
myIsActivationOnDetection(Standard_False),
|
||||||
myIsZoomPersistentMode(Standard_True),
|
myIsZoomPersistentMode(Standard_True),
|
||||||
myHasStartedTransformation(Standard_False),
|
myHasStartedTransformation(Standard_False),
|
||||||
@@ -331,6 +333,15 @@ void AIS_Manipulator::EnableMode(const AIS_ManipulatorMode theMode)
|
|||||||
|
|
||||||
//=================================================================================================
|
//=================================================================================================
|
||||||
|
|
||||||
|
void AIS_Manipulator::attachToPoint(const gp_Pnt& thePoint)
|
||||||
|
{
|
||||||
|
gp_Ax2 aPosition = gp::XOY();
|
||||||
|
aPosition.SetLocation(thePoint);
|
||||||
|
SetPosition(aPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
void AIS_Manipulator::attachToBox(const Bnd_Box& theBox)
|
void AIS_Manipulator::attachToBox(const Bnd_Box& theBox)
|
||||||
{
|
{
|
||||||
if (theBox.IsVoid())
|
if (theBox.IsVoid())
|
||||||
@@ -391,9 +402,17 @@ void AIS_Manipulator::Attach(const Handle(AIS_ManipulatorObjectSequence)& theObj
|
|||||||
aCurObject->BoundingBox(aBox);
|
aCurObject->BoundingBox(aBox);
|
||||||
|
|
||||||
if (theOptions.AdjustPosition)
|
if (theOptions.AdjustPosition)
|
||||||
|
{
|
||||||
|
const Handle(Graphic3d_TransformPers)& aTransPers = aCurObject->TransformPersistence();
|
||||||
|
if (!aTransPers.IsNull() && (aTransPers->IsZoomOrRotate() || aTransPers->IsAxial()))
|
||||||
|
{
|
||||||
|
attachToPoint(aTransPers->AnchorPoint());
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
attachToBox(aBox);
|
attachToBox(aBox);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (theOptions.AdjustSize)
|
if (theOptions.AdjustSize)
|
||||||
{
|
{
|
||||||
@@ -592,6 +611,41 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation(const Standard_Integer t
|
|||||||
gp_Dir aCurrentAxis = gce_MakeDir(aPosLoc, aNewPosition);
|
gp_Dir aCurrentAxis = gce_MakeDir(aPosLoc, aNewPosition);
|
||||||
Standard_Real anAngle = aStartAxis.AngleWithRef(aCurrentAxis, aCurrAxis.Direction());
|
Standard_Real anAngle = aStartAxis.AngleWithRef(aCurrentAxis, aCurrAxis.Direction());
|
||||||
|
|
||||||
|
if (Abs(anAngle) < Precision::Confusion())
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw a sector indicating the rotation angle
|
||||||
|
if (mySkinMode == ManipulatorSkin_Flat)
|
||||||
|
{
|
||||||
|
const gp_Ax1& anAxis = myAxes[myCurrentIndex].ReferenceAxis();
|
||||||
|
const gp_Dir aRotationStart =
|
||||||
|
anAxis.Direction().Z() > 0 ? myStartPosition.YDirection() : myStartPosition.Direction();
|
||||||
|
Standard_Real aRotationAngle =
|
||||||
|
aRotationStart.AngleWithRef(aCurrentAxis, aCurrAxis.Direction());
|
||||||
|
aRotationAngle -= (anAngle > 0) ? anAngle * 2.0 : anAngle;
|
||||||
|
if (anAxis.Direction().Z() > 0)
|
||||||
|
{
|
||||||
|
aRotationAngle += M_PI_2;
|
||||||
|
}
|
||||||
|
|
||||||
|
gp_Trsf aTrsf;
|
||||||
|
aTrsf.SetRotation(anAxis, aRotationAngle);
|
||||||
|
|
||||||
|
Handle(Prs3d_ShadingAspect) anAspect = new Prs3d_ShadingAspect();
|
||||||
|
anAspect->Aspect()->SetShadingModel(Graphic3d_TypeOfShadingModel_Unlit);
|
||||||
|
anAspect->SetMaterial(myDrawer->ShadingAspect()->Material());
|
||||||
|
anAspect->SetTransparency(0.5);
|
||||||
|
anAspect->SetColor(myAxes[myCurrentIndex].Color());
|
||||||
|
|
||||||
|
mySector.Init(0.0f, myAxes[myCurrentIndex].InnerRadius(), anAxis, Abs(anAngle));
|
||||||
|
mySectorGroup->Clear();
|
||||||
|
mySectorGroup->SetPrimitivesAspect(anAspect->Aspect());
|
||||||
|
mySectorGroup->AddPrimitiveArray(mySector.Array());
|
||||||
|
mySectorGroup->SetTransformation(aTrsf);
|
||||||
|
}
|
||||||
|
|
||||||
// Change value of an angle if it should have different sign.
|
// Change value of an angle if it should have different sign.
|
||||||
if (anAngle * myPrevState < 0 && Abs(anAngle) < M_PI_2)
|
if (anAngle * myPrevState < 0 && Abs(anAngle) < M_PI_2)
|
||||||
{
|
{
|
||||||
@@ -599,11 +653,6 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation(const Standard_Integer t
|
|||||||
anAngle = aSign * (M_PI * 2 - anAngle);
|
anAngle = aSign * (M_PI * 2 - anAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Abs(anAngle) < Precision::Confusion())
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
gp_Trsf aNewTrsf;
|
gp_Trsf aNewTrsf;
|
||||||
aNewTrsf.SetRotation(aCurrAxis, anAngle);
|
aNewTrsf.SetRotation(aCurrAxis, anAngle);
|
||||||
theTrsf *= aNewTrsf;
|
theTrsf *= aNewTrsf;
|
||||||
@@ -678,10 +727,14 @@ Standard_Boolean AIS_Manipulator::ProcessDragging(const Handle(AIS_InteractiveCo
|
|||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
case AIS_DragAction_Stop: {
|
case AIS_DragAction_Stop: {
|
||||||
// at the end of transformation redisplay for updating sensitive areas
|
|
||||||
StopTransform(true);
|
StopTransform(true);
|
||||||
if (aCtx->IsDisplayed(this))
|
if (mySkinMode == ManipulatorSkin_Flat)
|
||||||
{
|
{
|
||||||
|
mySectorGroup->Clear();
|
||||||
|
}
|
||||||
|
else if (aCtx->IsDisplayed(this))
|
||||||
|
{
|
||||||
|
// at the end of transformation redisplay for updating sensitive areas
|
||||||
aCtx->Redisplay(this, true);
|
aCtx->Redisplay(this, true);
|
||||||
}
|
}
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
@@ -733,6 +786,195 @@ void AIS_Manipulator::StopTransform(const Standard_Boolean theToApply)
|
|||||||
|
|
||||||
//=================================================================================================
|
//=================================================================================================
|
||||||
|
|
||||||
|
void AIS_Manipulator::RecomputeTransformation(const Handle(Graphic3d_Camera)& theCamera)
|
||||||
|
{
|
||||||
|
if (mySkinMode == ManipulatorSkin_Shaded)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Boolean isRecomputedTranslation = Standard_False;
|
||||||
|
Standard_Boolean isRecomputedRotation = Standard_False;
|
||||||
|
Standard_Boolean isRecomputedDragging = Standard_False;
|
||||||
|
Standard_Boolean isRecomputedScaling = Standard_False;
|
||||||
|
|
||||||
|
// Remove transformation from dragger group
|
||||||
|
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||||
|
{
|
||||||
|
if (myAxes[anIt].HasDragging())
|
||||||
|
{
|
||||||
|
myAxes[anIt].DraggerGroup()->SetTransformation(gp_Trsf());
|
||||||
|
isRecomputedDragging = Standard_True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const gp_Dir& aCameraDir = theCamera->Direction();
|
||||||
|
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||||
|
{
|
||||||
|
Axis& anAxis = myAxes[anIt];
|
||||||
|
const gp_Ax1& aRefAxis = anAxis.ReferenceAxis();
|
||||||
|
gp_Dir anAxisDir, aNormal;
|
||||||
|
|
||||||
|
if (aRefAxis.Direction().X() > 0)
|
||||||
|
{
|
||||||
|
aNormal = myPosition.YDirection().Reversed();
|
||||||
|
anAxisDir = myPosition.XDirection();
|
||||||
|
}
|
||||||
|
else if (aRefAxis.Direction().Y() > 0)
|
||||||
|
{
|
||||||
|
aNormal = myPosition.XDirection().Crossed(myPosition.YDirection()).Reversed();
|
||||||
|
anAxisDir = myPosition.YDirection();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aNormal = myPosition.XDirection().Reversed();
|
||||||
|
anAxisDir = myPosition.XDirection().Crossed(myPosition.YDirection());
|
||||||
|
}
|
||||||
|
|
||||||
|
const gp_Dir aCameraProj = Abs(Abs(anAxisDir.Dot(aCameraDir)) - 1.0) <= gp::Resolution()
|
||||||
|
? aCameraDir
|
||||||
|
: anAxisDir.Crossed(aCameraDir).Crossed(anAxisDir);
|
||||||
|
const Standard_Boolean isReversed = anAxisDir.Dot(aCameraDir) > 0;
|
||||||
|
Standard_Real anAngle = aNormal.AngleWithRef(aCameraProj, anAxisDir);
|
||||||
|
if (aRefAxis.Direction().X() > 0)
|
||||||
|
anAngle -= M_PI_2;
|
||||||
|
|
||||||
|
if (anAxis.HasTranslation())
|
||||||
|
{
|
||||||
|
Handle(Prs3d_ShadingAspect) anAspect = new Prs3d_ShadingAspect();
|
||||||
|
anAspect->Aspect()->SetShadingModel(Graphic3d_TypeOfShadingModel_Unlit);
|
||||||
|
|
||||||
|
Quantity_Color aColor =
|
||||||
|
isReversed ? Quantity_Color(anAxis.Color().Rgb() * 0.1f) : anAxis.Color();
|
||||||
|
anAspect->Aspect()->SetInteriorColor(aColor);
|
||||||
|
|
||||||
|
gp_Trsf aTranslatorTrsf;
|
||||||
|
aTranslatorTrsf.SetRotation(aRefAxis, anAngle);
|
||||||
|
if (isReversed)
|
||||||
|
{
|
||||||
|
const Standard_Real aLength = anAxis.AxisLength() + anAxis.Indent() * 4.0f;
|
||||||
|
aTranslatorTrsf.SetTranslationPart(aRefAxis.Direction().XYZ().Reversed() * aLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
anAxis.TranslatorGroup()->SetGroupPrimitivesAspect(anAspect->Aspect());
|
||||||
|
anAxis.TranslatorGroup()->SetTransformation(aTranslatorTrsf);
|
||||||
|
anAxis.TranslatorHighlightPrs()->CurrentGroup()->SetTransformation(aTranslatorTrsf);
|
||||||
|
isRecomputedTranslation = Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anAxis.HasRotation())
|
||||||
|
{
|
||||||
|
gp_Trsf aRotatorTrsf;
|
||||||
|
aRotatorTrsf.SetRotation(aRefAxis, anAngle - M_PI_2);
|
||||||
|
anAxis.RotatorGroup()->SetTransformation(aRotatorTrsf);
|
||||||
|
anAxis.RotatorHighlightPrs()->CurrentGroup()->SetTransformation(aRotatorTrsf);
|
||||||
|
isRecomputedRotation = Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anAxis.HasDragging() && isReversed)
|
||||||
|
{
|
||||||
|
for (Standard_Integer anIndexIter = 0; anIndexIter < 3; ++anIndexIter)
|
||||||
|
{
|
||||||
|
gp_Vec aTranslation =
|
||||||
|
(anIndexIter == anIt)
|
||||||
|
? aRefAxis.Direction().XYZ() * myAxes[anIndexIter].AxisRadius() * 2.0f
|
||||||
|
: aRefAxis.Direction().XYZ().Reversed() * myAxes[anIndexIter].AxisLength();
|
||||||
|
gp_Trsf aDraggerTrsf;
|
||||||
|
aDraggerTrsf.SetTranslation(aTranslation);
|
||||||
|
|
||||||
|
const Handle(Graphic3d_Group)& aDraggerGroup = myAxes[anIndexIter].DraggerGroup();
|
||||||
|
aDraggerTrsf *= aDraggerGroup->Transformation();
|
||||||
|
aDraggerGroup->SetTransformation(aDraggerTrsf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anAxis.HasScaling())
|
||||||
|
{
|
||||||
|
gp_Trsf aScalerTrsf;
|
||||||
|
if (aRefAxis.Direction().X() > 0)
|
||||||
|
{
|
||||||
|
anAngle += M_PI_2;
|
||||||
|
}
|
||||||
|
aScalerTrsf.SetRotation(aRefAxis, anAngle);
|
||||||
|
if (isReversed)
|
||||||
|
{
|
||||||
|
Standard_ShortReal aLength =
|
||||||
|
anAxis.AxisLength() * 2.0f + anAxis.BoxSize() + anAxis.Indent() * 4.0f;
|
||||||
|
aScalerTrsf.SetTranslationPart(gp_Vec(aRefAxis.Direction().XYZ().Reversed() * aLength));
|
||||||
|
}
|
||||||
|
anAxis.ScalerGroup()->SetTransformation(aScalerTrsf);
|
||||||
|
anAxis.ScalerHighlightPrs()->CurrentGroup()->SetTransformation(aScalerTrsf);
|
||||||
|
isRecomputedScaling = Standard_True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isRecomputedRotation)
|
||||||
|
{
|
||||||
|
const gp_Dir aXDir = gp::DX();
|
||||||
|
const gp_Dir anYDir = gp::DY();
|
||||||
|
const gp_Dir aZDir = gp::DZ();
|
||||||
|
|
||||||
|
const gp_Dir aCameraProjection =
|
||||||
|
Abs(aXDir.Dot(aCameraDir)) <= gp::Resolution()
|
||||||
|
|| Abs(anYDir.Dot(aCameraDir)) <= gp::Resolution()
|
||||||
|
? aCameraDir
|
||||||
|
: aXDir.XYZ() * (aXDir.Dot(aCameraDir)) + anYDir.XYZ() * (anYDir.Dot(aCameraDir));
|
||||||
|
const Standard_Boolean isReversed = aZDir.Dot(aCameraDir) > 0;
|
||||||
|
|
||||||
|
const Standard_Real anAngle = M_PI_2 - aCameraDir.Angle(aCameraProjection);
|
||||||
|
gp_Dir aRotAxis = Abs(Abs(aCameraProjection.Dot(aZDir)) - 1.0) <= gp::Resolution()
|
||||||
|
? aZDir
|
||||||
|
: aCameraProjection.Crossed(aZDir);
|
||||||
|
if (isReversed)
|
||||||
|
{
|
||||||
|
aRotAxis.Reverse();
|
||||||
|
}
|
||||||
|
|
||||||
|
gp_Trsf aRotationTrsf;
|
||||||
|
aRotationTrsf.SetRotation(gp_Ax1(gp::Origin(), aRotAxis), anAngle);
|
||||||
|
|
||||||
|
gp_Ax3 aToSystem(gp::Origin(),
|
||||||
|
myPosition.XDirection().Crossed(myPosition.YDirection()),
|
||||||
|
myPosition.XDirection());
|
||||||
|
gp_Ax3 aFromSystem(gp::XOY());
|
||||||
|
aFromSystem.Transform(aRotationTrsf);
|
||||||
|
|
||||||
|
gp_Trsf aTrsf;
|
||||||
|
aTrsf.SetTransformation(aFromSystem, aToSystem);
|
||||||
|
myCircleGroup->SetTransformation(aTrsf);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isRecomputedDragging)
|
||||||
|
{
|
||||||
|
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||||
|
{
|
||||||
|
myAxes[anIt].DraggerHighlightPrs()->CurrentGroup()->SetTransformation(
|
||||||
|
myAxes[anIt].DraggerGroup()->Transformation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isRecomputedTranslation)
|
||||||
|
{
|
||||||
|
RecomputeSelection(AIS_MM_Translation);
|
||||||
|
};
|
||||||
|
if (isRecomputedRotation)
|
||||||
|
{
|
||||||
|
RecomputeSelection(AIS_MM_Rotation);
|
||||||
|
};
|
||||||
|
if (isRecomputedDragging)
|
||||||
|
{
|
||||||
|
RecomputeSelection(AIS_MM_TranslationPlane);
|
||||||
|
};
|
||||||
|
if (isRecomputedScaling)
|
||||||
|
{
|
||||||
|
RecomputeSelection(AIS_MM_Scaling);
|
||||||
|
};
|
||||||
|
|
||||||
|
Object()->GetContext()->RecomputeSelectionOnly(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
void AIS_Manipulator::Transform(const gp_Trsf& theTrsf)
|
void AIS_Manipulator::Transform(const gp_Trsf& theTrsf)
|
||||||
{
|
{
|
||||||
if (!IsAttached() || !myHasStartedTransformation)
|
if (!IsAttached() || !myHasStartedTransformation)
|
||||||
@@ -747,6 +989,15 @@ void AIS_Manipulator::Transform(const gp_Trsf& theTrsf)
|
|||||||
for (; anObjIter.More(); anObjIter.Next(), aTrsfIter.Next())
|
for (; anObjIter.More(); anObjIter.Next(), aTrsfIter.Next())
|
||||||
{
|
{
|
||||||
const Handle(AIS_InteractiveObject)& anObj = anObjIter.ChangeValue();
|
const Handle(AIS_InteractiveObject)& anObj = anObjIter.ChangeValue();
|
||||||
|
const Handle(Graphic3d_TransformPers)& aTransPers = anObj->TransformPersistence();
|
||||||
|
if (!aTransPers.IsNull() && (aTransPers->IsZoomOrRotate() || aTransPers->IsAxial()))
|
||||||
|
{
|
||||||
|
gp_XYZ aNewAnchorPoint = aTransPers->AnchorPoint().XYZ() - myPosition.Location().XYZ();
|
||||||
|
aNewAnchorPoint += myStartPosition.Location().Transformed(theTrsf).XYZ();
|
||||||
|
aTransPers->SetAnchorPoint(aNewAnchorPoint);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const gp_Trsf& anOldTrsf = aTrsfIter.Value();
|
const gp_Trsf& anOldTrsf = aTrsfIter.Value();
|
||||||
const Handle(TopLoc_Datum3D)& aParentTrsf = anObj->CombinedParentTransformation();
|
const Handle(TopLoc_Datum3D)& aParentTrsf = anObj->CombinedParentTransformation();
|
||||||
if (!aParentTrsf.IsNull() && aParentTrsf->Form() != gp_Identity)
|
if (!aParentTrsf.IsNull() && aParentTrsf->Form() != gp_Identity)
|
||||||
@@ -892,6 +1143,10 @@ void AIS_Manipulator::DeactivateCurrentMode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Handle(Prs3d_ShadingAspect) anAspect = new Prs3d_ShadingAspect();
|
Handle(Prs3d_ShadingAspect) anAspect = new Prs3d_ShadingAspect();
|
||||||
|
if (mySkinMode == ManipulatorSkin_Flat)
|
||||||
|
{
|
||||||
|
anAspect->Aspect()->SetShadingModel(Graphic3d_TypeOfShadingModel_Unlit);
|
||||||
|
}
|
||||||
anAspect->Aspect()->SetInteriorStyle(Aspect_IS_SOLID);
|
anAspect->Aspect()->SetInteriorStyle(Aspect_IS_SOLID);
|
||||||
anAspect->SetMaterial(myDrawer->ShadingAspect()->Material());
|
anAspect->SetMaterial(myDrawer->ShadingAspect()->Material());
|
||||||
if (myCurrentMode == AIS_MM_TranslationPlane)
|
if (myCurrentMode == AIS_MM_TranslationPlane)
|
||||||
@@ -935,6 +1190,17 @@ void AIS_Manipulator::SetZoomPersistence(const Standard_Boolean theToEnable)
|
|||||||
|
|
||||||
//=================================================================================================
|
//=================================================================================================
|
||||||
|
|
||||||
|
void AIS_Manipulator::SetSkinMode(const ManipulatorSkin theSkinMode)
|
||||||
|
{
|
||||||
|
if (mySkinMode != theSkinMode)
|
||||||
|
{
|
||||||
|
SetToUpdate();
|
||||||
|
}
|
||||||
|
mySkinMode = theSkinMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
void AIS_Manipulator::SetTransformPersistence(const Handle(Graphic3d_TransformPers)& theTrsfPers)
|
void AIS_Manipulator::SetTransformPersistence(const Handle(Graphic3d_TransformPers)& theTrsfPers)
|
||||||
{
|
{
|
||||||
Standard_ASSERT_RETURN(!myIsZoomPersistentMode,
|
Standard_ASSERT_RETURN(!myIsZoomPersistentMode,
|
||||||
@@ -979,16 +1245,37 @@ void AIS_Manipulator::Compute(const Handle(PrsMgr_PresentationManager)& thePrsMg
|
|||||||
thePrs->SetMutable(Standard_True);
|
thePrs->SetMutable(Standard_True);
|
||||||
Handle(Graphic3d_Group) aGroup;
|
Handle(Graphic3d_Group) aGroup;
|
||||||
Handle(Prs3d_ShadingAspect) anAspect = new Prs3d_ShadingAspect();
|
Handle(Prs3d_ShadingAspect) anAspect = new Prs3d_ShadingAspect();
|
||||||
|
if (mySkinMode == ManipulatorSkin_Flat)
|
||||||
|
{
|
||||||
|
anAspect->Aspect()->SetShadingModel(Graphic3d_TypeOfShadingModel_Unlit);
|
||||||
|
}
|
||||||
anAspect->Aspect()->SetInteriorStyle(Aspect_IS_SOLID);
|
anAspect->Aspect()->SetInteriorStyle(Aspect_IS_SOLID);
|
||||||
anAspect->SetMaterial(myDrawer->ShadingAspect()->Material());
|
anAspect->SetMaterial(myDrawer->ShadingAspect()->Material());
|
||||||
anAspect->SetTransparency(myDrawer->ShadingAspect()->Transparency());
|
anAspect->SetTransparency(myDrawer->ShadingAspect()->Transparency());
|
||||||
|
|
||||||
// Display center
|
// Display center
|
||||||
myCenter.Init(myAxes[0].AxisRadius() * 2.0f, gp::Origin());
|
myCenter.Init(myAxes[0].AxisRadius() * 2.0f, gp::Origin(), mySkinMode);
|
||||||
aGroup = thePrs->NewGroup();
|
aGroup = thePrs->NewGroup();
|
||||||
aGroup->SetPrimitivesAspect(myDrawer->ShadingAspect()->Aspect());
|
aGroup->SetPrimitivesAspect(myDrawer->ShadingAspect()->Aspect());
|
||||||
aGroup->AddPrimitiveArray(myCenter.Array());
|
aGroup->AddPrimitiveArray(myCenter.Array());
|
||||||
|
|
||||||
|
// Display outer circle
|
||||||
|
if (mySkinMode == ManipulatorSkin_Flat
|
||||||
|
&& (myAxes[0].HasRotation() || myAxes[1].HasRotation() || myAxes[2].HasRotation()))
|
||||||
|
{
|
||||||
|
myCircle.Init(myAxes[0].InnerRadius(),
|
||||||
|
myAxes[0].Size(),
|
||||||
|
gp_Ax1(gp::Origin(), gp::DZ()),
|
||||||
|
2.0f * M_PI,
|
||||||
|
myAxes[0].FacettesNumber() * 4);
|
||||||
|
myCircleGroup = thePrs->NewGroup();
|
||||||
|
myCircleGroup->SetPrimitivesAspect(myDrawer->ShadingAspect()->Aspect());
|
||||||
|
myCircleGroup->AddPrimitiveArray(myCircle.Array());
|
||||||
|
|
||||||
|
mySectorGroup = thePrs->NewGroup();
|
||||||
|
mySectorGroup->SetGroupPrimitivesAspect(anAspect->Aspect());
|
||||||
|
}
|
||||||
|
|
||||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||||
{
|
{
|
||||||
// Display axes
|
// Display axes
|
||||||
@@ -998,7 +1285,7 @@ void AIS_Manipulator::Compute(const Handle(PrsMgr_PresentationManager)& thePrsMg
|
|||||||
new Prs3d_ShadingAspect(new Graphic3d_AspectFillArea3d(*anAspect->Aspect()));
|
new Prs3d_ShadingAspect(new Graphic3d_AspectFillArea3d(*anAspect->Aspect()));
|
||||||
anAspectAx->SetColor(myAxes[anIt].Color());
|
anAspectAx->SetColor(myAxes[anIt].Color());
|
||||||
aGroup->SetGroupPrimitivesAspect(anAspectAx->Aspect());
|
aGroup->SetGroupPrimitivesAspect(anAspectAx->Aspect());
|
||||||
myAxes[anIt].Compute(thePrsMgr, thePrs, anAspectAx);
|
myAxes[anIt].Compute(thePrsMgr, thePrs, anAspectAx, mySkinMode);
|
||||||
myAxes[anIt].SetTransformPersistence(TransformPersistence());
|
myAxes[anIt].SetTransformPersistence(TransformPersistence());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1034,7 +1321,7 @@ void AIS_Manipulator::HilightSelected(const Handle(PrsMgr_PresentationManager)&
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anOwner->Mode() == AIS_MM_TranslationPlane)
|
if (anOwner->Mode() == AIS_MM_TranslationPlane && mySkinMode == ManipulatorSkin_Shaded)
|
||||||
{
|
{
|
||||||
myDraggerHighlight->SetColor(myAxes[anOwner->Index()].Color());
|
myDraggerHighlight->SetColor(myAxes[anOwner->Index()].Color());
|
||||||
aGroup->SetGroupPrimitivesAspect(myDraggerHighlight->Aspect());
|
aGroup->SetGroupPrimitivesAspect(myDraggerHighlight->Aspect());
|
||||||
@@ -1068,7 +1355,7 @@ void AIS_Manipulator::HilightOwnerWithColor(const Handle(PrsMgr_PresentationMana
|
|||||||
|
|
||||||
aPresentation->CStructure()->ViewAffinity = myViewAffinity;
|
aPresentation->CStructure()->ViewAffinity = myViewAffinity;
|
||||||
|
|
||||||
if (anOwner->Mode() == AIS_MM_TranslationPlane)
|
if (anOwner->Mode() == AIS_MM_TranslationPlane && mySkinMode == ManipulatorSkin_Shaded)
|
||||||
{
|
{
|
||||||
Handle(Prs3d_Drawer) aStyle = new Prs3d_Drawer();
|
Handle(Prs3d_Drawer) aStyle = new Prs3d_Drawer();
|
||||||
aStyle->SetColor(myAxes[anOwner->Index()].Color());
|
aStyle->SetColor(myAxes[anOwner->Index()].Color());
|
||||||
@@ -1106,6 +1393,23 @@ void AIS_Manipulator::HilightOwnerWithColor(const Handle(PrsMgr_PresentationMana
|
|||||||
|
|
||||||
//=================================================================================================
|
//=================================================================================================
|
||||||
|
|
||||||
|
void AIS_Manipulator::RecomputeSelection(const AIS_ManipulatorMode theMode)
|
||||||
|
{
|
||||||
|
if (theMode == AIS_MM_None)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Handle(SelectMgr_Selection)& aSelection = Object()->Selection(theMode);
|
||||||
|
if (!aSelection.IsNull())
|
||||||
|
{
|
||||||
|
aSelection->Clear();
|
||||||
|
ComputeSelection(aSelection, theMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
void AIS_Manipulator::ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
|
void AIS_Manipulator::ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
|
||||||
const Standard_Integer theMode)
|
const Standard_Integer theMode)
|
||||||
{
|
{
|
||||||
@@ -1138,18 +1442,25 @@ void AIS_Manipulator::ComputeSelection(const Handle(SelectMgr_Selection)& theSel
|
|||||||
const Axis& anAxis = myAxes[anIt];
|
const Axis& anAxis = myAxes[anIt];
|
||||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_Translation, 9);
|
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_Translation, 9);
|
||||||
|
|
||||||
|
if (mySkinMode == ManipulatorSkin_Shaded)
|
||||||
|
{
|
||||||
// define sensitivity by line
|
// define sensitivity by line
|
||||||
Handle(Select3D_SensitiveSegment) aLine =
|
Handle(Select3D_SensitiveSegment) aLine =
|
||||||
new Select3D_SensitiveSegment(anOwner, gp::Origin(), anAxis.TranslatorTipPosition());
|
new Select3D_SensitiveSegment(anOwner, gp::Origin(), anAxis.TranslatorTipPosition());
|
||||||
aLine->SetSensitivityFactor(aHighSensitivity);
|
aLine->SetSensitivityFactor(aHighSensitivity);
|
||||||
theSelection->Add(aLine);
|
theSelection->Add(aLine);
|
||||||
|
}
|
||||||
|
|
||||||
// enlarge sensitivity by triangulation
|
// enlarge sensitivity by triangulation
|
||||||
Handle(Select3D_SensitivePrimitiveArray) aTri =
|
Handle(Select3D_SensitivePrimitiveArray) aTri =
|
||||||
new Select3D_SensitivePrimitiveArray(anOwner);
|
new Select3D_SensitivePrimitiveArray(anOwner);
|
||||||
|
TopLoc_Location aTrsf =
|
||||||
|
!myAxes[anIt].TranslatorGroup().IsNull()
|
||||||
|
? TopLoc_Location(myAxes[anIt].TranslatorGroup()->Transformation())
|
||||||
|
: TopLoc_Location();
|
||||||
aTri->InitTriangulation(anAxis.TriangleArray()->Attributes(),
|
aTri->InitTriangulation(anAxis.TriangleArray()->Attributes(),
|
||||||
anAxis.TriangleArray()->Indices(),
|
anAxis.TriangleArray()->Indices(),
|
||||||
TopLoc_Location());
|
aTrsf);
|
||||||
theSelection->Add(aTri);
|
theSelection->Add(aTri);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1164,17 +1475,24 @@ void AIS_Manipulator::ComputeSelection(const Handle(SelectMgr_Selection)& theSel
|
|||||||
const Axis& anAxis = myAxes[anIt];
|
const Axis& anAxis = myAxes[anIt];
|
||||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_Rotation, 9);
|
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_Rotation, 9);
|
||||||
|
|
||||||
|
if (mySkinMode == ManipulatorSkin_Shaded)
|
||||||
|
{
|
||||||
// define sensitivity by circle
|
// define sensitivity by circle
|
||||||
const gp_Circ aGeomCircle(gp_Ax2(gp::Origin(), anAxis.ReferenceAxis().Direction()),
|
const gp_Circ aGeomCircle(gp_Ax2(gp::Origin(), anAxis.ReferenceAxis().Direction()),
|
||||||
anAxis.RotatorDiskRadius());
|
anAxis.RotatorDiskRadius());
|
||||||
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle(anOwner, aGeomCircle);
|
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle(anOwner, aGeomCircle);
|
||||||
aCircle->SetSensitivityFactor(aLowSensitivity);
|
aCircle->SetSensitivityFactor(aLowSensitivity);
|
||||||
theSelection->Add(aCircle);
|
theSelection->Add(aCircle);
|
||||||
|
}
|
||||||
// enlarge sensitivity by triangulation
|
// enlarge sensitivity by triangulation
|
||||||
Handle(Select3D_SensitiveTriangulation) aTri =
|
Handle(Select3D_SensitivePrimitiveArray) aTri =
|
||||||
new ManipSensTriangulation(anOwner,
|
new Select3D_SensitivePrimitiveArray(anOwner);
|
||||||
myAxes[anIt].RotatorDisk().Triangulation(),
|
const Handle(Graphic3d_Group)& aGroup = myAxes[anIt].RotatorGroup();
|
||||||
anAxis.ReferenceAxis().Direction());
|
TopLoc_Location aTrsf =
|
||||||
|
!aGroup.IsNull() ? TopLoc_Location(aGroup->Transformation()) : TopLoc_Location();
|
||||||
|
aTri->InitTriangulation(myAxes[anIt].RotatorDisk().Array()->Attributes(),
|
||||||
|
myAxes[anIt].RotatorDisk().Array()->Indices(),
|
||||||
|
aTrsf);
|
||||||
theSelection->Add(aTri);
|
theSelection->Add(aTri);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1188,17 +1506,23 @@ void AIS_Manipulator::ComputeSelection(const Handle(SelectMgr_Selection)& theSel
|
|||||||
}
|
}
|
||||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_Scaling, 9);
|
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_Scaling, 9);
|
||||||
|
|
||||||
|
if (mySkinMode == ManipulatorSkin_Shaded)
|
||||||
|
{
|
||||||
// define sensitivity by point
|
// define sensitivity by point
|
||||||
Handle(Select3D_SensitivePoint) aPnt =
|
Handle(Select3D_SensitivePoint) aPnt =
|
||||||
new Select3D_SensitivePoint(anOwner, myAxes[anIt].ScalerCubePosition());
|
new Select3D_SensitivePoint(anOwner, myAxes[anIt].ScalerCubePosition());
|
||||||
aPnt->SetSensitivityFactor(aHighSensitivity);
|
aPnt->SetSensitivityFactor(aHighSensitivity);
|
||||||
theSelection->Add(aPnt);
|
theSelection->Add(aPnt);
|
||||||
|
}
|
||||||
// enlarge sensitivity by triangulation
|
// enlarge sensitivity by triangulation
|
||||||
Handle(Select3D_SensitiveTriangulation) aTri =
|
Handle(Select3D_SensitivePrimitiveArray) aTri =
|
||||||
new Select3D_SensitiveTriangulation(anOwner,
|
new Select3D_SensitivePrimitiveArray(anOwner);
|
||||||
myAxes[anIt].ScalerCube().Triangulation(),
|
const Handle(Graphic3d_Group)& aGroup = myAxes[anIt].ScalerGroup();
|
||||||
TopLoc_Location(),
|
TopLoc_Location aTrsf =
|
||||||
Standard_True);
|
!aGroup.IsNull() ? TopLoc_Location(aGroup->Transformation()) : TopLoc_Location();
|
||||||
|
aTri->InitTriangulation(myAxes[anIt].ScalerCube().Array()->Attributes(),
|
||||||
|
myAxes[anIt].ScalerCube().Array()->Indices(),
|
||||||
|
aTrsf);
|
||||||
theSelection->Add(aTri);
|
theSelection->Add(aTri);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1212,6 +1536,8 @@ void AIS_Manipulator::ComputeSelection(const Handle(SelectMgr_Selection)& theSel
|
|||||||
}
|
}
|
||||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_TranslationPlane, 9);
|
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_TranslationPlane, 9);
|
||||||
|
|
||||||
|
if (mySkinMode == ManipulatorSkin_Shaded)
|
||||||
|
{
|
||||||
// define sensitivity by two crossed lines
|
// define sensitivity by two crossed lines
|
||||||
Standard_Real aSensitivityOffset =
|
Standard_Real aSensitivityOffset =
|
||||||
ZoomPersistence() ? aHighSensitivity * (0.5 + M_SQRT2) : 0.0;
|
ZoomPersistence() ? aHighSensitivity * (0.5 + M_SQRT2) : 0.0;
|
||||||
@@ -1222,20 +1548,25 @@ void AIS_Manipulator::ComputeSelection(const Handle(SelectMgr_Selection)& theSel
|
|||||||
gp_XYZ aMidP = (aP1.XYZ() + aP2.XYZ()) / 2.0;
|
gp_XYZ aMidP = (aP1.XYZ() + aP2.XYZ()) / 2.0;
|
||||||
gp_XYZ anOrig = aMidP.Normalized().Multiplied(aSensitivityOffset);
|
gp_XYZ anOrig = aMidP.Normalized().Multiplied(aSensitivityOffset);
|
||||||
|
|
||||||
Handle(Select3D_SensitiveSegment) aLine1 = new Select3D_SensitiveSegment(anOwner, aP1, aP2);
|
Handle(Select3D_SensitiveSegment) aLine1 =
|
||||||
|
new Select3D_SensitiveSegment(anOwner, aP1, aP2);
|
||||||
aLine1->SetSensitivityFactor(aLowSensitivity);
|
aLine1->SetSensitivityFactor(aLowSensitivity);
|
||||||
theSelection->Add(aLine1);
|
theSelection->Add(aLine1);
|
||||||
Handle(Select3D_SensitiveSegment) aLine2 =
|
Handle(Select3D_SensitiveSegment) aLine2 =
|
||||||
new Select3D_SensitiveSegment(anOwner, anOrig, aMidP);
|
new Select3D_SensitiveSegment(anOwner, anOrig, aMidP);
|
||||||
aLine2->SetSensitivityFactor(aLowSensitivity);
|
aLine2->SetSensitivityFactor(aLowSensitivity);
|
||||||
theSelection->Add(aLine2);
|
theSelection->Add(aLine2);
|
||||||
|
}
|
||||||
|
|
||||||
// enlarge sensitivity by triangulation
|
// enlarge sensitivity by triangulation
|
||||||
Handle(Select3D_SensitiveTriangulation) aTri =
|
Handle(Select3D_SensitivePrimitiveArray) aTri =
|
||||||
new Select3D_SensitiveTriangulation(anOwner,
|
new Select3D_SensitivePrimitiveArray(anOwner);
|
||||||
myAxes[anIt].DraggerSector().Triangulation(),
|
const Handle(Graphic3d_Group)& aGroup = myAxes[anIt].DraggerGroup();
|
||||||
TopLoc_Location(),
|
TopLoc_Location aTrsf =
|
||||||
Standard_True);
|
!aGroup.IsNull() ? TopLoc_Location(aGroup->Transformation()) : TopLoc_Location();
|
||||||
|
aTri->InitTriangulation(myAxes[anIt].DraggerSector().Array()->Attributes(),
|
||||||
|
myAxes[anIt].DraggerSector().Array()->Indices(),
|
||||||
|
aTrsf);
|
||||||
theSelection->Add(aTri);
|
theSelection->Add(aTri);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1255,6 +1586,7 @@ void AIS_Manipulator::ComputeSelection(const Handle(SelectMgr_Selection)& theSel
|
|||||||
void AIS_Manipulator::Disk::Init(const Standard_ShortReal theInnerRadius,
|
void AIS_Manipulator::Disk::Init(const Standard_ShortReal theInnerRadius,
|
||||||
const Standard_ShortReal theOuterRadius,
|
const Standard_ShortReal theOuterRadius,
|
||||||
const gp_Ax1& thePosition,
|
const gp_Ax1& thePosition,
|
||||||
|
const Standard_Real theAngle,
|
||||||
const Standard_Integer theSlicesNb,
|
const Standard_Integer theSlicesNb,
|
||||||
const Standard_Integer theStacksNb)
|
const Standard_Integer theStacksNb)
|
||||||
{
|
{
|
||||||
@@ -1263,6 +1595,7 @@ void AIS_Manipulator::Disk::Init(const Standard_ShortReal theInnerRadius,
|
|||||||
myOuterRad = theOuterRadius;
|
myOuterRad = theOuterRadius;
|
||||||
|
|
||||||
Prs3d_ToolDisk aTool(theInnerRadius, theOuterRadius, theSlicesNb, theStacksNb);
|
Prs3d_ToolDisk aTool(theInnerRadius, theOuterRadius, theSlicesNb, theStacksNb);
|
||||||
|
aTool.SetAngleRange(0, theAngle);
|
||||||
gp_Ax3 aSystem(myPosition.Location(), myPosition.Direction());
|
gp_Ax3 aSystem(myPosition.Location(), myPosition.Direction());
|
||||||
gp_Trsf aTrsf;
|
gp_Trsf aTrsf;
|
||||||
aTrsf.SetTransformation(aSystem, gp_Ax3());
|
aTrsf.SetTransformation(aSystem, gp_Ax3());
|
||||||
@@ -1277,15 +1610,18 @@ void AIS_Manipulator::Disk::Init(const Standard_ShortReal theInnerRadius,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_Manipulator::Sphere::Init(const Standard_ShortReal theRadius,
|
void AIS_Manipulator::Sphere::Init(const Standard_ShortReal theRadius,
|
||||||
const gp_Pnt& thePosition,
|
const gp_Pnt& thePosition,
|
||||||
|
const ManipulatorSkin theSkinMode,
|
||||||
const Standard_Integer theSlicesNb,
|
const Standard_Integer theSlicesNb,
|
||||||
const Standard_Integer theStacksNb)
|
const Standard_Integer theStacksNb)
|
||||||
{
|
{
|
||||||
myPosition = thePosition;
|
myPosition = thePosition;
|
||||||
myRadius = theRadius;
|
myRadius = theRadius;
|
||||||
|
|
||||||
Prs3d_ToolSphere aTool(theRadius, theSlicesNb, theStacksNb);
|
|
||||||
gp_Trsf aTrsf;
|
gp_Trsf aTrsf;
|
||||||
aTrsf.SetTranslation(gp_Vec(gp::Origin(), thePosition));
|
aTrsf.SetTranslation(gp_Vec(gp::Origin(), thePosition));
|
||||||
|
|
||||||
|
const Standard_Real aRadius = theSkinMode == ManipulatorSkin_Flat ? theRadius * 0.5 : theRadius;
|
||||||
|
Prs3d_ToolSphere aTool(aRadius, theSlicesNb, theStacksNb);
|
||||||
myArray = aTool.CreateTriangulation(aTrsf);
|
myArray = aTool.CreateTriangulation(aTrsf);
|
||||||
myTriangulation = aTool.CreatePolyTriangulation(aTrsf);
|
myTriangulation = aTool.CreatePolyTriangulation(aTrsf);
|
||||||
}
|
}
|
||||||
@@ -1295,13 +1631,36 @@ void AIS_Manipulator::Sphere::Init(const Standard_ShortReal theRadius,
|
|||||||
// function : Init
|
// function : Init
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_Manipulator::Cube::Init(const gp_Ax1& thePosition, const Standard_ShortReal theSize)
|
void AIS_Manipulator::Cube::Init(const gp_Ax1& thePosition,
|
||||||
|
const Standard_ShortReal theSize,
|
||||||
|
const ManipulatorSkin theSkinMode)
|
||||||
|
{
|
||||||
|
if (theSkinMode == ManipulatorSkin_Flat)
|
||||||
|
{
|
||||||
|
gp_Dir aXDirection;
|
||||||
|
if (thePosition.Direction().X() > 0)
|
||||||
|
aXDirection = gp::DY();
|
||||||
|
else if (thePosition.Direction().Y() > 0)
|
||||||
|
aXDirection = gp::DZ();
|
||||||
|
else
|
||||||
|
aXDirection = gp::DX();
|
||||||
|
|
||||||
|
gp_Pnt aLocation =
|
||||||
|
thePosition.Location().Translated(gp_Vec(thePosition.Direction().XYZ() * theSize));
|
||||||
|
gp_Ax3 aSystem(aLocation, aXDirection, thePosition.Direction());
|
||||||
|
gp_Trsf aTrsf;
|
||||||
|
aTrsf.SetTransformation(aSystem, gp_Ax3());
|
||||||
|
|
||||||
|
Prs3d_ToolDisk aTool(0.0, theSize, 40, 40);
|
||||||
|
myArray = aTool.CreateTriangulation(aTrsf);
|
||||||
|
myTriangulation = aTool.CreatePolyTriangulation(aTrsf);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
myArray = new Graphic3d_ArrayOfTriangles(12 * 3, 0, Standard_True);
|
myArray = new Graphic3d_ArrayOfTriangles(12 * 3, 0, Standard_True);
|
||||||
|
|
||||||
Poly_Array1OfTriangle aPolyTriangles(1, 12);
|
Poly_Array1OfTriangle aPolyTriangles(1, 12);
|
||||||
TColgp_Array1OfPnt aPoints(1, 36);
|
TColgp_Array1OfPnt aPoints(1, 36);
|
||||||
NCollection_Array1<gp_Dir> aNormals(1, 12);
|
|
||||||
myTriangulation = new Poly_Triangulation(aPoints, aPolyTriangles);
|
myTriangulation = new Poly_Triangulation(aPoints, aPolyTriangles);
|
||||||
|
|
||||||
gp_Ax2 aPln(thePosition.Location(), thePosition.Direction());
|
gp_Ax2 aPln(thePosition.Location(), thePosition.Direction());
|
||||||
@@ -1346,6 +1705,7 @@ void AIS_Manipulator::Cube::Init(const gp_Ax1& thePosition, const Standard_Short
|
|||||||
addTriangle(10, aV3, aV7, aTopRight, -aRight);
|
addTriangle(10, aV3, aV7, aTopRight, -aRight);
|
||||||
addTriangle(11, aV3, aV2, aV7, -aRight);
|
addTriangle(11, aV3, aV2, aV7, -aRight);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// class : Cube
|
// class : Cube
|
||||||
@@ -1377,16 +1737,47 @@ void AIS_Manipulator::Cube::addTriangle(const Standard_Integer theIndex,
|
|||||||
void AIS_Manipulator::Sector::Init(const Standard_ShortReal theRadius,
|
void AIS_Manipulator::Sector::Init(const Standard_ShortReal theRadius,
|
||||||
const gp_Ax1& thePosition,
|
const gp_Ax1& thePosition,
|
||||||
const gp_Dir& theXDirection,
|
const gp_Dir& theXDirection,
|
||||||
|
const ManipulatorSkin theSkinMode,
|
||||||
const Standard_Integer theSlicesNb,
|
const Standard_Integer theSlicesNb,
|
||||||
const Standard_Integer theStacksNb)
|
const Standard_Integer theStacksNb)
|
||||||
{
|
{
|
||||||
Prs3d_ToolSector aTool(theRadius, theSlicesNb, theStacksNb);
|
|
||||||
gp_Ax3 aSystem(thePosition.Location(), thePosition.Direction(), theXDirection);
|
gp_Ax3 aSystem(thePosition.Location(), thePosition.Direction(), theXDirection);
|
||||||
gp_Trsf aTrsf;
|
gp_Trsf aTrsf;
|
||||||
aTrsf.SetTransformation(aSystem, gp_Ax3());
|
aTrsf.SetTransformation(aSystem, gp_Ax3());
|
||||||
|
|
||||||
|
if (theSkinMode == ManipulatorSkin_Flat)
|
||||||
|
{
|
||||||
|
myArray = new Graphic3d_ArrayOfTriangles(4, 6, Graphic3d_ArrayFlags_VertexNormal);
|
||||||
|
myTriangulation = new Poly_Triangulation(4, 2, Standard_False);
|
||||||
|
|
||||||
|
const Standard_Real anIndent = theRadius / 3.0;
|
||||||
|
gp_Pnt aV1 = gp_Pnt(anIndent, anIndent, 0.0).Transformed(aTrsf);
|
||||||
|
gp_Pnt aV2 = gp_Pnt(anIndent, anIndent * 2.0, 0.0).Transformed(aTrsf);
|
||||||
|
gp_Pnt aV3 = gp_Pnt(anIndent * 2.0, anIndent * 2.0, 0.0).Transformed(aTrsf);
|
||||||
|
gp_Pnt aV4 = gp_Pnt(anIndent * 2.0, anIndent, 0.0).Transformed(aTrsf);
|
||||||
|
gp_Dir aNormal = gp_Dir(0.0, 0.0, -1.0).Transformed(aTrsf);
|
||||||
|
|
||||||
|
myArray->AddVertex(aV1, aNormal);
|
||||||
|
myArray->AddVertex(aV2, aNormal);
|
||||||
|
myArray->AddVertex(aV3, aNormal);
|
||||||
|
myArray->AddVertex(aV4, aNormal);
|
||||||
|
myArray->AddTriangleEdges(3, 1, 2);
|
||||||
|
myArray->AddTriangleEdges(1, 3, 4);
|
||||||
|
|
||||||
|
myTriangulation->SetNode(1, aV1);
|
||||||
|
myTriangulation->SetNode(2, aV2);
|
||||||
|
myTriangulation->SetNode(3, aV3);
|
||||||
|
myTriangulation->SetNode(4, aV4);
|
||||||
|
myTriangulation->SetTriangle(1, Poly_Triangle(3, 1, 2));
|
||||||
|
myTriangulation->SetTriangle(2, Poly_Triangle(1, 3, 4));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Prs3d_ToolSector aTool(theRadius, theSlicesNb, theStacksNb);
|
||||||
myArray = aTool.CreateTriangulation(aTrsf);
|
myArray = aTool.CreateTriangulation(aTrsf);
|
||||||
myTriangulation = aTool.CreatePolyTriangulation(aTrsf);
|
myTriangulation = aTool.CreatePolyTriangulation(aTrsf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// class : Axis
|
// class : Axis
|
||||||
@@ -1423,7 +1814,8 @@ AIS_Manipulator::Axis::Axis(const gp_Ax1& theAxis,
|
|||||||
|
|
||||||
void AIS_Manipulator::Axis::Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
void AIS_Manipulator::Axis::Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||||
const Handle(Prs3d_Presentation)& thePrs,
|
const Handle(Prs3d_Presentation)& thePrs,
|
||||||
const Handle(Prs3d_ShadingAspect)& theAspect)
|
const Handle(Prs3d_ShadingAspect)& theAspect,
|
||||||
|
const ManipulatorSkin theSkinMode)
|
||||||
{
|
{
|
||||||
if (myHasTranslation)
|
if (myHasTranslation)
|
||||||
{
|
{
|
||||||
@@ -1432,16 +1824,80 @@ void AIS_Manipulator::Axis::Compute(const Handle(PrsMgr_PresentationManager)& th
|
|||||||
myArrowTipPos =
|
myArrowTipPos =
|
||||||
gp_Pnt(0.0, 0.0, 0.0).Translated(myReferenceAxis.Direction().XYZ() * aCylinderLength);
|
gp_Pnt(0.0, 0.0, 0.0).Translated(myReferenceAxis.Direction().XYZ() * aCylinderLength);
|
||||||
|
|
||||||
|
myTranslatorGroup = thePrs->NewGroup();
|
||||||
|
myTranslatorGroup->SetClosed(theSkinMode == ManipulatorSkin_Shaded);
|
||||||
|
myTranslatorGroup->SetGroupPrimitivesAspect(theAspect->Aspect());
|
||||||
|
|
||||||
|
if (theSkinMode == ManipulatorSkin_Flat)
|
||||||
|
{
|
||||||
|
const Standard_Integer aStripsNb = 14;
|
||||||
|
|
||||||
|
myTriangleArray = new Graphic3d_ArrayOfTriangles(aStripsNb * 4,
|
||||||
|
aStripsNb * 6,
|
||||||
|
Graphic3d_ArrayFlags_VertexNormal);
|
||||||
|
Handle(Graphic3d_ArrayOfTriangles) aColorlessArr =
|
||||||
|
new Graphic3d_ArrayOfTriangles(aStripsNb * 2,
|
||||||
|
aStripsNb * 3,
|
||||||
|
Graphic3d_ArrayFlags_VertexNormal);
|
||||||
|
Handle(Graphic3d_ArrayOfTriangles) aColoredArr = new Graphic3d_ArrayOfTriangles(
|
||||||
|
aStripsNb * 2,
|
||||||
|
aStripsNb * 3,
|
||||||
|
Graphic3d_ArrayFlags_VertexNormal | Graphic3d_ArrayFlags_VertexColor);
|
||||||
|
|
||||||
|
gp_Ax3 aSystem(gp::Origin(), myReferenceAxis.Direction());
|
||||||
|
gp_Trsf aTrsf;
|
||||||
|
aTrsf.SetTransformation(aSystem, gp_Ax3());
|
||||||
|
|
||||||
|
gp_Dir aNormal = gp_Dir(1.0, 0.0, 0.0).Transformed(aTrsf);
|
||||||
|
Standard_Real aLength = myLength + myIndent * 4.0f;
|
||||||
|
|
||||||
|
const Standard_Real aStepV = 1.0f / aStripsNb;
|
||||||
|
for (Standard_Integer aU = 0; aU <= 1; ++aU)
|
||||||
|
{
|
||||||
|
for (Standard_Integer aV = 0; aV <= aStripsNb; ++aV)
|
||||||
|
{
|
||||||
|
gp_Pnt aVertex = gp_Pnt(0.0, myAxisRadius * (1.5f * aU - 0.75f), aLength * aV * aStepV)
|
||||||
|
.Transformed(aTrsf);
|
||||||
|
myTriangleArray->AddVertex(aVertex, aNormal);
|
||||||
|
|
||||||
|
if (aV != 0)
|
||||||
|
{
|
||||||
|
aColorlessArr->AddVertex(aVertex, aNormal);
|
||||||
|
}
|
||||||
|
if (aV != aStripsNb)
|
||||||
|
{
|
||||||
|
aColoredArr->AddVertex(aVertex, aNormal, myColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aU != 0 && aV != 0)
|
||||||
|
{
|
||||||
|
int aVertId = myTriangleArray->VertexNumber();
|
||||||
|
myTriangleArray->AddTriangleEdges(aVertId, aVertId - aStripsNb - 2, aVertId - 1);
|
||||||
|
myTriangleArray->AddTriangleEdges(aVertId - aStripsNb - 2,
|
||||||
|
aVertId,
|
||||||
|
aVertId - aStripsNb - 1);
|
||||||
|
|
||||||
|
Handle(Graphic3d_ArrayOfTriangles) aSquares = aV % 2 == 0 ? aColorlessArr : aColoredArr;
|
||||||
|
|
||||||
|
aVertId = aSquares->VertexNumber();
|
||||||
|
aSquares->AddTriangleEdges(aVertId, aVertId - aStripsNb - 1, aVertId - 1);
|
||||||
|
aSquares->AddTriangleEdges(aVertId - aStripsNb - 1, aVertId, aVertId - aStripsNb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myTranslatorGroup->AddPrimitiveArray(aColoredArr);
|
||||||
|
myTranslatorGroup->AddPrimitiveArray(aColorlessArr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
myTriangleArray = Prs3d_Arrow::DrawShaded(gp_Ax1(gp::Origin(), myReferenceAxis.Direction()),
|
myTriangleArray = Prs3d_Arrow::DrawShaded(gp_Ax1(gp::Origin(), myReferenceAxis.Direction()),
|
||||||
myAxisRadius,
|
myAxisRadius,
|
||||||
myLength,
|
myLength,
|
||||||
myAxisRadius * 1.5,
|
myAxisRadius * 1.5,
|
||||||
anArrowLength,
|
anArrowLength,
|
||||||
myFacettesNumber);
|
myFacettesNumber);
|
||||||
myTranslatorGroup = thePrs->NewGroup();
|
|
||||||
myTranslatorGroup->SetClosed(true);
|
|
||||||
myTranslatorGroup->SetGroupPrimitivesAspect(theAspect->Aspect());
|
|
||||||
myTranslatorGroup->AddPrimitiveArray(myTriangleArray);
|
myTranslatorGroup->AddPrimitiveArray(myTriangleArray);
|
||||||
|
}
|
||||||
|
|
||||||
if (myHighlightTranslator.IsNull())
|
if (myHighlightTranslator.IsNull())
|
||||||
{
|
{
|
||||||
@@ -1461,10 +1917,12 @@ void AIS_Manipulator::Axis::Compute(const Handle(PrsMgr_PresentationManager)& th
|
|||||||
if (myHasScaling)
|
if (myHasScaling)
|
||||||
{
|
{
|
||||||
myCubePos = myReferenceAxis.Direction().XYZ() * (myLength + myIndent);
|
myCubePos = myReferenceAxis.Direction().XYZ() * (myLength + myIndent);
|
||||||
myCube.Init(gp_Ax1(myCubePos, myReferenceAxis.Direction()), myBoxSize);
|
const Standard_ShortReal aBoxSize =
|
||||||
|
theSkinMode == ManipulatorSkin_Shaded ? myBoxSize : myBoxSize * 0.5f + myIndent;
|
||||||
|
myCube.Init(gp_Ax1(myCubePos, myReferenceAxis.Direction()), aBoxSize, theSkinMode);
|
||||||
|
|
||||||
myScalerGroup = thePrs->NewGroup();
|
myScalerGroup = thePrs->NewGroup();
|
||||||
myScalerGroup->SetClosed(true);
|
myScalerGroup->SetClosed(theSkinMode == ManipulatorSkin_Shaded);
|
||||||
myScalerGroup->SetGroupPrimitivesAspect(theAspect->Aspect());
|
myScalerGroup->SetGroupPrimitivesAspect(theAspect->Aspect());
|
||||||
myScalerGroup->AddPrimitiveArray(myCube.Array());
|
myScalerGroup->AddPrimitiveArray(myCube.Array());
|
||||||
|
|
||||||
@@ -1485,10 +1943,12 @@ void AIS_Manipulator::Axis::Compute(const Handle(PrsMgr_PresentationManager)& th
|
|||||||
|
|
||||||
if (myHasRotation)
|
if (myHasRotation)
|
||||||
{
|
{
|
||||||
myCircleRadius = myInnerRadius + myIndent * 2 + myDiskThickness * 0.5f;
|
myCircleRadius = myInnerRadius + myIndent * 2.0f + myDiskThickness * 0.5f;
|
||||||
myCircle.Init(myInnerRadius + myIndent * 2,
|
const Standard_Real anAngle = theSkinMode == ManipulatorSkin_Shaded ? M_PI * 2.0f : M_PI;
|
||||||
myInnerRadius + myDiskThickness + myIndent * 2,
|
myCircle.Init(myInnerRadius + myIndent * 2.0f,
|
||||||
|
Size(),
|
||||||
gp_Ax1(gp::Origin(), myReferenceAxis.Direction()),
|
gp_Ax1(gp::Origin(), myReferenceAxis.Direction()),
|
||||||
|
anAngle,
|
||||||
myFacettesNumber * 2);
|
myFacettesNumber * 2);
|
||||||
myRotatorGroup = thePrs->NewGroup();
|
myRotatorGroup = thePrs->NewGroup();
|
||||||
myRotatorGroup->SetGroupPrimitivesAspect(theAspect->Aspect());
|
myRotatorGroup->SetGroupPrimitivesAspect(theAspect->Aspect());
|
||||||
@@ -1519,13 +1979,21 @@ void AIS_Manipulator::Axis::Compute(const Handle(PrsMgr_PresentationManager)& th
|
|||||||
else
|
else
|
||||||
aXDirection = gp::DX();
|
aXDirection = gp::DX();
|
||||||
|
|
||||||
mySector.Init(myInnerRadius + myIndent * 2,
|
gp_Pnt aPosition = theSkinMode == ManipulatorSkin_Flat
|
||||||
gp_Ax1(gp::Origin(), myReferenceAxis.Direction()),
|
? gp_Pnt(myReferenceAxis.Direction().Reversed().XYZ() * (myAxisRadius))
|
||||||
|
: gp::Origin();
|
||||||
|
Standard_ShortReal aRadius =
|
||||||
|
theSkinMode == ManipulatorSkin_Flat ? myLength : myInnerRadius + myIndent * 2;
|
||||||
|
mySector.Init(aRadius,
|
||||||
|
gp_Ax1(aPosition, myReferenceAxis.Direction()),
|
||||||
aXDirection,
|
aXDirection,
|
||||||
|
theSkinMode,
|
||||||
myFacettesNumber * 2);
|
myFacettesNumber * 2);
|
||||||
myDraggerGroup = thePrs->NewGroup();
|
myDraggerGroup = thePrs->NewGroup();
|
||||||
|
|
||||||
Handle(Graphic3d_AspectFillArea3d) aFillArea = new Graphic3d_AspectFillArea3d();
|
Handle(Graphic3d_AspectFillArea3d) aFillArea =
|
||||||
|
theSkinMode == ManipulatorSkin_Flat ? theAspect->Aspect() : new Graphic3d_AspectFillArea3d();
|
||||||
|
|
||||||
myDraggerGroup->SetGroupPrimitivesAspect(aFillArea);
|
myDraggerGroup->SetGroupPrimitivesAspect(aFillArea);
|
||||||
myDraggerGroup->AddPrimitiveArray(mySector.Array());
|
myDraggerGroup->AddPrimitiveArray(mySector.Array());
|
||||||
|
|
||||||
|
@@ -217,6 +217,14 @@ public:
|
|||||||
//! @warning It will does nothing if transformation is not initiated (with StartTransform() call).
|
//! @warning It will does nothing if transformation is not initiated (with StartTransform() call).
|
||||||
Standard_EXPORT void Transform(const gp_Trsf& aTrsf);
|
Standard_EXPORT void Transform(const gp_Trsf& aTrsf);
|
||||||
|
|
||||||
|
//! Apply camera transformation to flat skin manipulator
|
||||||
|
Standard_EXPORT void RecomputeTransformation(const Handle(Graphic3d_Camera)& theCamera)
|
||||||
|
Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Recomputes sensitive primitives for the given selection mode.
|
||||||
|
//! @param theMode selection mode to recompute sensitive primitives
|
||||||
|
Standard_EXPORT void RecomputeSelection(const AIS_ManipulatorMode theMode);
|
||||||
|
|
||||||
//! Reset start (reference) transformation.
|
//! Reset start (reference) transformation.
|
||||||
//! @param[in] theToApply option to apply or to cancel the started transformation.
|
//! @param[in] theToApply option to apply or to cancel the started transformation.
|
||||||
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform
|
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform
|
||||||
@@ -304,6 +312,18 @@ public: //! @name Configuration of graphical transformations
|
|||||||
const Handle(Graphic3d_TransformPers)& theTrsfPers) Standard_OVERRIDE;
|
const Handle(Graphic3d_TransformPers)& theTrsfPers) Standard_OVERRIDE;
|
||||||
|
|
||||||
public: //! @name Setters for parameters
|
public: //! @name Setters for parameters
|
||||||
|
enum ManipulatorSkin
|
||||||
|
{
|
||||||
|
ManipulatorSkin_Shaded,
|
||||||
|
ManipulatorSkin_Flat
|
||||||
|
};
|
||||||
|
|
||||||
|
//! @return current manipulator skin mode.
|
||||||
|
ManipulatorSkin SkinMode() const { return mySkinMode; }
|
||||||
|
|
||||||
|
//! Sets skin mode for the manipulator.
|
||||||
|
Standard_EXPORT void SetSkinMode(const ManipulatorSkin theSkinMode);
|
||||||
|
|
||||||
AIS_ManipulatorMode ActiveMode() const { return myCurrentMode; }
|
AIS_ManipulatorMode ActiveMode() const { return myCurrentMode; }
|
||||||
|
|
||||||
Standard_Integer ActiveAxisIndex() const { return myCurrentIndex; }
|
Standard_Integer ActiveAxisIndex() const { return myCurrentIndex; }
|
||||||
@@ -416,6 +436,8 @@ protected:
|
|||||||
Standard_EXPORT Handle(Graphic3d_Group) getGroup(const Standard_Integer theIndex,
|
Standard_EXPORT Handle(Graphic3d_Group) getGroup(const Standard_Integer theIndex,
|
||||||
const AIS_ManipulatorMode theMode) const;
|
const AIS_ManipulatorMode theMode) const;
|
||||||
|
|
||||||
|
Standard_EXPORT void attachToPoint(const gp_Pnt& thePoint);
|
||||||
|
|
||||||
Standard_EXPORT void attachToBox(const Bnd_Box& theBox);
|
Standard_EXPORT void attachToBox(const Bnd_Box& theBox);
|
||||||
|
|
||||||
Standard_EXPORT void adjustSize(const Bnd_Box& theBox);
|
Standard_EXPORT void adjustSize(const Bnd_Box& theBox);
|
||||||
@@ -466,6 +488,7 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
|||||||
void Init(const Standard_ShortReal theInnerRadius,
|
void Init(const Standard_ShortReal theInnerRadius,
|
||||||
const Standard_ShortReal theOuterRadius,
|
const Standard_ShortReal theOuterRadius,
|
||||||
const gp_Ax1& thePosition,
|
const gp_Ax1& thePosition,
|
||||||
|
const Standard_Real theAngle,
|
||||||
const Standard_Integer theSlicesNb = 20,
|
const Standard_Integer theSlicesNb = 20,
|
||||||
const Standard_Integer theStacksNb = 20);
|
const Standard_Integer theStacksNb = 20);
|
||||||
|
|
||||||
@@ -486,6 +509,7 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
|||||||
|
|
||||||
void Init(const Standard_ShortReal theRadius,
|
void Init(const Standard_ShortReal theRadius,
|
||||||
const gp_Pnt& thePosition,
|
const gp_Pnt& thePosition,
|
||||||
|
const ManipulatorSkin theSkinMode,
|
||||||
const Standard_Integer theSlicesNb = 20,
|
const Standard_Integer theSlicesNb = 20,
|
||||||
const Standard_Integer theStacksNb = 20);
|
const Standard_Integer theStacksNb = 20);
|
||||||
|
|
||||||
@@ -501,7 +525,9 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
|||||||
|
|
||||||
~Cube() {}
|
~Cube() {}
|
||||||
|
|
||||||
void Init(const gp_Ax1& thePosition, const Standard_ShortReal myBoxSize);
|
void Init(const gp_Ax1& thePosition,
|
||||||
|
const Standard_ShortReal myBoxSize,
|
||||||
|
const ManipulatorSkin theSkinMode);
|
||||||
|
|
||||||
const Handle(Poly_Triangulation)& Triangulation() const { return myTriangulation; }
|
const Handle(Poly_Triangulation)& Triangulation() const { return myTriangulation; }
|
||||||
|
|
||||||
@@ -533,6 +559,7 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
|||||||
void Init(const Standard_ShortReal theRadius,
|
void Init(const Standard_ShortReal theRadius,
|
||||||
const gp_Ax1& thePosition,
|
const gp_Ax1& thePosition,
|
||||||
const gp_Dir& theXDirection,
|
const gp_Dir& theXDirection,
|
||||||
|
const ManipulatorSkin theSkinMode,
|
||||||
const Standard_Integer theSlicesNb = 5,
|
const Standard_Integer theSlicesNb = 5,
|
||||||
const Standard_Integer theStacksNb = 5);
|
const Standard_Integer theStacksNb = 5);
|
||||||
|
|
||||||
@@ -555,7 +582,8 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
|||||||
|
|
||||||
void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||||
const Handle(Prs3d_Presentation)& thePrs,
|
const Handle(Prs3d_Presentation)& thePrs,
|
||||||
const Handle(Prs3d_ShadingAspect)& theAspect);
|
const Handle(Prs3d_ShadingAspect)& theAspect,
|
||||||
|
const ManipulatorSkin theSkinMode);
|
||||||
|
|
||||||
const gp_Ax1& ReferenceAxis() const { return myReferenceAxis; }
|
const gp_Ax1& ReferenceAxis() const { return myReferenceAxis; }
|
||||||
|
|
||||||
@@ -629,8 +657,12 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
|||||||
|
|
||||||
Standard_ShortReal AxisLength() const { return myLength; }
|
Standard_ShortReal AxisLength() const { return myLength; }
|
||||||
|
|
||||||
|
Standard_ShortReal BoxSize() const { return myBoxSize; }
|
||||||
|
|
||||||
Standard_ShortReal AxisRadius() const { return myAxisRadius; }
|
Standard_ShortReal AxisRadius() const { return myAxisRadius; }
|
||||||
|
|
||||||
|
Standard_ShortReal Indent() const { return myIndent; }
|
||||||
|
|
||||||
void SetAxisRadius(const Standard_ShortReal theValue) { myAxisRadius = theValue; }
|
void SetAxisRadius(const Standard_ShortReal theValue) { myAxisRadius = theValue; }
|
||||||
|
|
||||||
const Handle(Prs3d_Presentation)& TranslatorHighlightPrs() const
|
const Handle(Prs3d_Presentation)& TranslatorHighlightPrs() const
|
||||||
@@ -656,10 +688,9 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
|||||||
|
|
||||||
void SetIndent(const Standard_ShortReal theValue) { myIndent = theValue; }
|
void SetIndent(const Standard_ShortReal theValue) { myIndent = theValue; }
|
||||||
|
|
||||||
Standard_ShortReal Size() const
|
Standard_ShortReal Size() const { return myInnerRadius + myDiskThickness + myIndent * 2; }
|
||||||
{
|
|
||||||
return myLength + myBoxSize + myDiskThickness + myIndent * 2.0f;
|
Standard_ShortReal InnerRadius() const { return myInnerRadius + myIndent * 2.0f; }
|
||||||
}
|
|
||||||
|
|
||||||
gp_Pnt ScalerCenter(const gp_Pnt& theLocation) const
|
gp_Pnt ScalerCenter(const gp_Pnt& theLocation) const
|
||||||
{
|
{
|
||||||
@@ -750,8 +781,15 @@ protected:
|
|||||||
// clang-format off
|
// clang-format off
|
||||||
gp_Ax2 myPosition; //!< Position of the manipulator object. it displays its location and position of its axes.
|
gp_Ax2 myPosition; //!< Position of the manipulator object. it displays its location and position of its axes.
|
||||||
|
|
||||||
|
Disk myCircle; //!< Outer circle
|
||||||
|
Handle(Graphic3d_Group) myCircleGroup;
|
||||||
|
|
||||||
|
Disk mySector; //!< Sector indicating the rotation angle
|
||||||
|
Handle(Graphic3d_Group) mySectorGroup;
|
||||||
|
|
||||||
Standard_Integer myCurrentIndex; //!< Index of active axis.
|
Standard_Integer myCurrentIndex; //!< Index of active axis.
|
||||||
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipulation mode.
|
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipulation mode.
|
||||||
|
ManipulatorSkin mySkinMode; //!< Name of active skin mode.
|
||||||
|
|
||||||
Standard_Boolean myIsActivationOnDetection; //!< Manual activation of modes (not on parts selection).
|
Standard_Boolean myIsActivationOnDetection; //!< Manual activation of modes (not on parts selection).
|
||||||
Standard_Boolean myIsZoomPersistentMode; //!< Zoom persistence mode activation.
|
Standard_Boolean myIsZoomPersistentMode; //!< Zoom persistence mode activation.
|
||||||
|
@@ -2280,6 +2280,13 @@ void AIS_ViewController::handleCameraActions(const Handle(AIS_InteractiveContext
|
|||||||
myGL.Orientation.ToFitAll = false;
|
myGL.Orientation.ToFitAll = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AIS_ListOfInteractive anObjects;
|
||||||
|
theCtx->DisplayedObjects(anObjects);
|
||||||
|
for (AIS_ListIteratorOfListOfInteractive anObjIter(anObjects); anObjIter.More(); anObjIter.Next())
|
||||||
|
{
|
||||||
|
anObjIter.Value()->RecomputeTransformation(theView->Camera());
|
||||||
|
}
|
||||||
|
|
||||||
if (myGL.IsNewGesture)
|
if (myGL.IsNewGesture)
|
||||||
{
|
{
|
||||||
if (myAnchorPointPrs1->HasInteractiveContext())
|
if (myAnchorPointPrs1->HasInteractiveContext())
|
||||||
|
@@ -206,7 +206,7 @@ TCollection_AsciiString defaultActionsManifestInit()
|
|||||||
return aCasRoot + "/XRResources/src/" + THE_ACTIONS_JSON;
|
return aCasRoot + "/XRResources/src/" + THE_ACTIONS_JSON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return OSD_Process::ExecutablePath() + "/occtvr_actions.json";
|
return OSD_Process::ExecutableFolder() + "/occtvr_actions.json";
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
#endif
|
#endif
|
||||||
|
@@ -427,11 +427,11 @@ struct SurfaceCalculator<T, 2>
|
|||||||
{
|
{
|
||||||
static T Area(const typename BVH_Box<T, 2>::BVH_VecNt& theSize)
|
static T Area(const typename BVH_Box<T, 2>::BVH_VecNt& theSize)
|
||||||
{
|
{
|
||||||
const T anArea = theSize.x() * theSize.y();
|
const T anArea = std::abs(theSize.x() * theSize.y());
|
||||||
|
|
||||||
if (anArea < std::numeric_limits<T>::epsilon())
|
if (anArea < std::numeric_limits<T>::epsilon())
|
||||||
{
|
{
|
||||||
return theSize.x() + theSize.y();
|
return std::abs(theSize.x()) + std::abs(theSize.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
return anArea;
|
return anArea;
|
||||||
@@ -443,13 +443,13 @@ struct SurfaceCalculator<T, 3>
|
|||||||
{
|
{
|
||||||
static T Area(const typename BVH_Box<T, 3>::BVH_VecNt& theSize)
|
static T Area(const typename BVH_Box<T, 3>::BVH_VecNt& theSize)
|
||||||
{
|
{
|
||||||
const T anArea =
|
const T anArea = (std::abs(theSize.x() * theSize.y()) + std::abs(theSize.x() * theSize.z())
|
||||||
(theSize.x() * theSize.y() + theSize.x() * theSize.z() + theSize.z() * theSize.y())
|
+ std::abs(theSize.z() * theSize.y()))
|
||||||
* static_cast<T>(2.0);
|
* static_cast<T>(2.0);
|
||||||
|
|
||||||
if (anArea < std::numeric_limits<T>::epsilon())
|
if (anArea < std::numeric_limits<T>::epsilon())
|
||||||
{
|
{
|
||||||
return theSize.x() + theSize.y() + theSize.z();
|
return std::abs(theSize.x()) + std::abs(theSize.y()) + std::abs(theSize.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
return anArea;
|
return anArea;
|
||||||
@@ -461,13 +461,13 @@ struct SurfaceCalculator<T, 4>
|
|||||||
{
|
{
|
||||||
static T Area(const typename BVH_Box<T, 4>::BVH_VecNt& theSize)
|
static T Area(const typename BVH_Box<T, 4>::BVH_VecNt& theSize)
|
||||||
{
|
{
|
||||||
const T anArea =
|
const T anArea = (std::abs(theSize.x() * theSize.y()) + std::abs(theSize.x() * theSize.z())
|
||||||
(theSize.x() * theSize.y() + theSize.x() * theSize.z() + theSize.z() * theSize.y())
|
+ std::abs(theSize.z() * theSize.y()))
|
||||||
* static_cast<T>(2.0);
|
* static_cast<T>(2.0);
|
||||||
|
|
||||||
if (anArea < std::numeric_limits<T>::epsilon())
|
if (anArea < std::numeric_limits<T>::epsilon())
|
||||||
{
|
{
|
||||||
return theSize.x() + theSize.y() + theSize.z();
|
return std::abs(theSize.x()) + std::abs(theSize.y()) + std::abs(theSize.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
return anArea;
|
return anArea;
|
||||||
|
@@ -125,17 +125,18 @@ private:
|
|||||||
|
|
||||||
//! Print message to Module.printMessage callback.
|
//! Print message to Module.printMessage callback.
|
||||||
EM_JS(void, occJSPrintMessage, (const char* theStr, int theGravity), {
|
EM_JS(void, occJSPrintMessage, (const char* theStr, int theGravity), {
|
||||||
|
const aStr = Number(theStr); // bigintToI53Checked(theStr);
|
||||||
if (Module.printMessage != undefined && Module.printMessage != null)
|
if (Module.printMessage != undefined && Module.printMessage != null)
|
||||||
{
|
{
|
||||||
Module.printMessage(UTF8ToString(theStr), theGravity);
|
Module.printMessage(UTF8ToString(aStr), theGravity);
|
||||||
}
|
}
|
||||||
else if (Module.print != undefined && Module.print != null)
|
else if (Module.print != undefined && Module.print != null)
|
||||||
{
|
{
|
||||||
Module.print(UTF8ToString(theStr));
|
Module.print(UTF8ToString(aStr));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// console.info (UTF8ToString(theStr));
|
// console.info (UTF8ToString(aStr));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -447,6 +447,8 @@ void Graphic3d_CView::ReCompute(const Handle(Graphic3d_Structure)& theStruct)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
theStruct->RecomputeTransformation(myCamera);
|
||||||
|
|
||||||
const Graphic3d_TypeOfAnswer anAnswer = acceptDisplay(theStruct->Visual());
|
const Graphic3d_TypeOfAnswer anAnswer = acceptDisplay(theStruct->Visual());
|
||||||
if (anAnswer != Graphic3d_TOA_COMPUTE)
|
if (anAnswer != Graphic3d_TOA_COMPUTE)
|
||||||
{
|
{
|
||||||
@@ -726,6 +728,12 @@ void Graphic3d_CView::Compute()
|
|||||||
aStructIter.Value()->SetHLRValidation(Standard_False);
|
aStructIter.Value()->SetHLRValidation(Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (Graphic3d_MapOfStructure::Iterator aStructIter(myStructsDisplayed); aStructIter.More();
|
||||||
|
aStructIter.Next())
|
||||||
|
{
|
||||||
|
aStructIter.Value()->RecomputeTransformation(myCamera);
|
||||||
|
}
|
||||||
|
|
||||||
if (!ComputedMode())
|
if (!ComputedMode())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -828,6 +836,8 @@ void Graphic3d_CView::Display(const Handle(Graphic3d_Structure)& theStructure)
|
|||||||
anIndex = 0;
|
anIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
theStructure->RecomputeTransformation(myCamera);
|
||||||
|
|
||||||
Graphic3d_TypeOfAnswer anAnswer = acceptDisplay(theStructure->Visual());
|
Graphic3d_TypeOfAnswer anAnswer = acceptDisplay(theStructure->Visual());
|
||||||
if (anAnswer == Graphic3d_TOA_NO)
|
if (anAnswer == Graphic3d_TOA_NO)
|
||||||
{
|
{
|
||||||
|
@@ -89,6 +89,12 @@ public:
|
|||||||
//! Sets camera used by the view.
|
//! Sets camera used by the view.
|
||||||
virtual void SetCamera(const Handle(Graphic3d_Camera)& theCamera) { myCamera = theCamera; }
|
virtual void SetCamera(const Handle(Graphic3d_Camera)& theCamera) { myCamera = theCamera; }
|
||||||
|
|
||||||
|
//! Returns necessity to flip OY in projection matrix
|
||||||
|
virtual Standard_Boolean ToFlipOutput() const { return Standard_False; }
|
||||||
|
|
||||||
|
//! Sets state of flip OY necessity in projection matrix
|
||||||
|
virtual void SetToFlipOutput(const Standard_Boolean) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! Returns default Shading Model of the view; Graphic3d_TypeOfShadingModel_Phong by default.
|
//! Returns default Shading Model of the view; Graphic3d_TypeOfShadingModel_Phong by default.
|
||||||
Graphic3d_TypeOfShadingModel ShadingModel() const { return myRenderParams.ShadingModel; }
|
Graphic3d_TypeOfShadingModel ShadingModel() const { return myRenderParams.ShadingModel; }
|
||||||
|
@@ -131,6 +131,12 @@ public:
|
|||||||
Standard_EXPORT virtual void SetFlippingOptions(const Standard_Boolean theIsEnabled,
|
Standard_EXPORT virtual void SetFlippingOptions(const Standard_Boolean theIsEnabled,
|
||||||
const gp_Ax2& theRefPlane) = 0;
|
const gp_Ax2& theRefPlane) = 0;
|
||||||
|
|
||||||
|
//! Return transformation.
|
||||||
|
const gp_Trsf& Transformation() const { return myTrsf; }
|
||||||
|
|
||||||
|
//! Assign transformation.
|
||||||
|
virtual void SetTransformation(const gp_Trsf& theTrsf) { myTrsf = theTrsf; }
|
||||||
|
|
||||||
//! Return transformation persistence.
|
//! Return transformation persistence.
|
||||||
const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myTrsfPers; }
|
const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myTrsfPers; }
|
||||||
|
|
||||||
@@ -310,6 +316,7 @@ protected:
|
|||||||
Handle(Graphic3d_TransformPers) myTrsfPers; //!< current transform persistence
|
Handle(Graphic3d_TransformPers) myTrsfPers; //!< current transform persistence
|
||||||
Graphic3d_Structure* myStructure; //!< pointer to the parent structure
|
Graphic3d_Structure* myStructure; //!< pointer to the parent structure
|
||||||
Graphic3d_BndBox4f myBounds; //!< bounding box
|
Graphic3d_BndBox4f myBounds; //!< bounding box
|
||||||
|
gp_Trsf myTrsf; //!< group transformation
|
||||||
bool myIsClosed; //!< flag indicating closed volume
|
bool myIsClosed; //!< flag indicating closed volume
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -203,6 +203,12 @@ public:
|
|||||||
(void)theStructure;
|
(void)theStructure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Calculates structure transformation for specific camera position
|
||||||
|
virtual void RecomputeTransformation(const Handle(Graphic3d_Camera)& theProjector)
|
||||||
|
{
|
||||||
|
(void)theProjector;
|
||||||
|
}
|
||||||
|
|
||||||
//! Forces a new construction of the structure <me>
|
//! Forces a new construction of the structure <me>
|
||||||
//! if <me> is displayed and TOS_COMPUTED.
|
//! if <me> is displayed and TOS_COMPUTED.
|
||||||
Standard_EXPORT void ReCompute();
|
Standard_EXPORT void ReCompute();
|
||||||
|
@@ -63,16 +63,28 @@ static android_LogPriority getAndroidLogPriority(const Message_Gravity theGravit
|
|||||||
#include <emscripten/emscripten.h>
|
#include <emscripten/emscripten.h>
|
||||||
|
|
||||||
//! Print message to console.debug().
|
//! Print message to console.debug().
|
||||||
EM_JS(void, occJSConsoleDebug, (const char* theStr), { console.debug(UTF8ToString(theStr)); });
|
EM_JS(void, occJSConsoleDebug, (const char* theStr), {
|
||||||
|
const aStr = Number(theStr); // bigintToI53Checked(theStr);
|
||||||
|
console.debug(UTF8ToString(aStr));
|
||||||
|
});
|
||||||
|
|
||||||
//! Print message to console.info().
|
//! Print message to console.info().
|
||||||
EM_JS(void, occJSConsoleInfo, (const char* theStr), { console.info(UTF8ToString(theStr)); });
|
EM_JS(void, occJSConsoleInfo, (const char* theStr), {
|
||||||
|
const aStr = Number(theStr); // bigintToI53Checked(theStr);
|
||||||
|
console.info(UTF8ToString(aStr));
|
||||||
|
});
|
||||||
|
|
||||||
//! Print message to console.warn().
|
//! Print message to console.warn().
|
||||||
EM_JS(void, occJSConsoleWarn, (const char* theStr), { console.warn(UTF8ToString(theStr)); });
|
EM_JS(void, occJSConsoleWarn, (const char* theStr), {
|
||||||
|
const aStr = Number(theStr); // bigintToI53Checked(theStr);
|
||||||
|
console.warn(UTF8ToString(aStr));
|
||||||
|
});
|
||||||
|
|
||||||
//! Print message to console.error().
|
//! Print message to console.error().
|
||||||
EM_JS(void, occJSConsoleError, (const char* theStr), { console.error(UTF8ToString(theStr)); });
|
EM_JS(void, occJSConsoleError, (const char* theStr), {
|
||||||
|
const aStr = Number(theStr); // bigintToI53Checked(theStr);
|
||||||
|
console.error(UTF8ToString(aStr));
|
||||||
|
});
|
||||||
#else
|
#else
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
|
|
||||||
//! Return WebAssembly heap size in bytes.
|
//! Return WebAssembly heap size in bytes.
|
||||||
EM_JS(size_t, OSD_MemInfo_getModuleHeapLength, (), { return Module.HEAP8.length; });
|
EM_JS(double, OSD_MemInfo_getModuleHeapLength, (), { return Module.HEAP8.length; });
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -168,7 +168,7 @@ void OSD_MemInfo::Update()
|
|||||||
}
|
}
|
||||||
if (IsActive(MemVirtual))
|
if (IsActive(MemVirtual))
|
||||||
{
|
{
|
||||||
myCounters[MemVirtual] = OSD_MemInfo_getModuleHeapLength();
|
myCounters[MemVirtual] = (size_t)OSD_MemInfo_getModuleHeapLength();
|
||||||
}
|
}
|
||||||
#elif (defined(__linux__) || defined(__linux))
|
#elif (defined(__linux__) || defined(__linux))
|
||||||
if (IsActive(MemHeapUsage))
|
if (IsActive(MemHeapUsage))
|
||||||
|
@@ -3137,7 +3137,7 @@ bool OpenGl_Context::GetBufferSubData(unsigned int theTarget,
|
|||||||
}
|
}
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
EM_ASM_(
|
EM_ASM_(
|
||||||
{ Module.ctx.getBufferSubData($0, $1, HEAPU8.subarray($2, $2 + $3)); },
|
{ Module.ctx.getBufferSubData($0, Number($1), HEAPU8.subarray(Number($2), Number($2 + $3))); },
|
||||||
theTarget,
|
theTarget,
|
||||||
theOffset,
|
theOffset,
|
||||||
theData,
|
theData,
|
||||||
|
@@ -666,7 +666,7 @@ void OpenGl_GraduatedTrihedron::Render(const Handle(OpenGl_Workspace)& theWorksp
|
|||||||
|
|
||||||
if (anAxesState & OOZ_XOZ)
|
if (anAxesState & OOZ_XOZ)
|
||||||
{
|
{
|
||||||
renderLine(myAxes[0].Line, theWorkspace, aModelMatrix, myMin.z(), myMin.y(), myMax.z());
|
renderLine(myAxes[0].Line, theWorkspace, aModelMatrix, myMin.x(), myMin.y(), myMax.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anAxesState & OOZ_OYZ)
|
if (anAxesState & OOZ_OYZ)
|
||||||
|
@@ -406,6 +406,12 @@ void OpenGl_Structure::renderGeometry(const Handle(OpenGl_Workspace)& theWorkspa
|
|||||||
{
|
{
|
||||||
const OpenGl_Group* aGroup = aGroupIter.Value();
|
const OpenGl_Group* aGroup = aGroupIter.Value();
|
||||||
|
|
||||||
|
const gp_Trsf& aTrsf = aGroup->Transformation();
|
||||||
|
if (aTrsf.Form() != gp_Identity)
|
||||||
|
{
|
||||||
|
applyTransformation(aCtx, aTrsf, Standard_True);
|
||||||
|
}
|
||||||
|
|
||||||
const Handle(Graphic3d_TransformPers)& aTrsfPers = aGroup->TransformPersistence();
|
const Handle(Graphic3d_TransformPers)& aTrsfPers = aGroup->TransformPersistence();
|
||||||
if (!aTrsfPers.IsNull())
|
if (!aTrsfPers.IsNull())
|
||||||
{
|
{
|
||||||
@@ -421,6 +427,35 @@ void OpenGl_Structure::renderGeometry(const Handle(OpenGl_Workspace)& theWorkspa
|
|||||||
revertPersistence(aCtx, aTrsfPers, true, anOldCastShadows);
|
revertPersistence(aCtx, aTrsfPers, true, anOldCastShadows);
|
||||||
aCtx->ApplyModelViewMatrix();
|
aCtx->ApplyModelViewMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aTrsf.Form() != gp_Identity)
|
||||||
|
{
|
||||||
|
applyTransformation(aCtx, aTrsf, Standard_False);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : applyTransformation
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
void OpenGl_Structure::applyTransformation(const Handle(OpenGl_Context)& theContext,
|
||||||
|
const gp_Trsf& theTrsf,
|
||||||
|
const Standard_Boolean toEnable) const
|
||||||
|
{
|
||||||
|
if (toEnable)
|
||||||
|
{
|
||||||
|
OpenGl_Mat4 aTrsf;
|
||||||
|
theTrsf.GetMat4(aTrsf);
|
||||||
|
theContext->ModelWorldState.Push();
|
||||||
|
OpenGl_Mat4& aModelWorld = theContext->ModelWorldState.ChangeCurrent();
|
||||||
|
aModelWorld = aModelWorld * aTrsf;
|
||||||
|
theContext->ApplyModelViewMatrix();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theContext->ModelWorldState.Pop();
|
||||||
|
theContext->ApplyModelViewMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -144,6 +144,14 @@ protected:
|
|||||||
//! Render the bounding box.
|
//! Render the bounding box.
|
||||||
Standard_EXPORT void renderBoundingBox(const Handle(OpenGl_Workspace)& theWorkspace) const;
|
Standard_EXPORT void renderBoundingBox(const Handle(OpenGl_Workspace)& theWorkspace) const;
|
||||||
|
|
||||||
|
//! Apply transformation into context.
|
||||||
|
//! @param theWorkspace current workspace
|
||||||
|
//! @param theTrsf transformation
|
||||||
|
//! @param toEnable flag to switch ON/OFF transformation
|
||||||
|
Standard_EXPORT void applyTransformation(const Handle(OpenGl_Context)& theContext,
|
||||||
|
const gp_Trsf& theTrsf,
|
||||||
|
const Standard_Boolean toEnable) const;
|
||||||
|
|
||||||
//! Apply transform persistence into context.
|
//! Apply transform persistence into context.
|
||||||
//! It disables shadows on non-3d objects when toEnable is true and restores otherwise.
|
//! It disables shadows on non-3d objects when toEnable is true and restores otherwise.
|
||||||
//! @param[in] theCtx current context
|
//! @param[in] theCtx current context
|
||||||
|
@@ -340,6 +340,15 @@ public: //! @name obsolete Graduated Trihedron functionality
|
|||||||
const Graphic3d_Vec3 theMax)
|
const Graphic3d_Vec3 theMax)
|
||||||
Standard_OVERRIDE;
|
Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Returns necessity to flip OY in projection matrix
|
||||||
|
virtual Standard_Boolean ToFlipOutput() const Standard_OVERRIDE { return myToFlipOutput; }
|
||||||
|
|
||||||
|
//! Sets state of flip OY necessity in projection matrix
|
||||||
|
virtual void SetToFlipOutput(const Standard_Boolean theFlip) Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
myToFlipOutput = theFlip;
|
||||||
|
}
|
||||||
|
|
||||||
protected: //! @name Internal methods for managing GL resources
|
protected: //! @name Internal methods for managing GL resources
|
||||||
//! Initializes OpenGl resource for environment texture.
|
//! Initializes OpenGl resource for environment texture.
|
||||||
void initTextureEnv(const Handle(OpenGl_Context)& theContext);
|
void initTextureEnv(const Handle(OpenGl_Context)& theContext);
|
||||||
|
@@ -309,6 +309,15 @@ public: //! @name object transformation
|
|||||||
//! Updates final transformation (parent + local) of presentable object and its presentations.
|
//! Updates final transformation (parent + local) of presentable object and its presentations.
|
||||||
Standard_EXPORT virtual void UpdateTransformation();
|
Standard_EXPORT virtual void UpdateTransformation();
|
||||||
|
|
||||||
|
//! Calculates object presentation for specific camera position.
|
||||||
|
//! Each of the views in the viewer and every modification such as rotation, for example, entails
|
||||||
|
//! recalculation.
|
||||||
|
//! @param theProjector [in] view orientation
|
||||||
|
virtual void RecomputeTransformation(const Handle(Graphic3d_Camera)& theProjector)
|
||||||
|
{
|
||||||
|
(void)theProjector;
|
||||||
|
}
|
||||||
|
|
||||||
public: //! @name clipping planes
|
public: //! @name clipping planes
|
||||||
//! Get clip planes.
|
//! Get clip planes.
|
||||||
//! @return set of previously added clip planes for all display mode presentations.
|
//! @return set of previously added clip planes for all display mode presentations.
|
||||||
|
@@ -186,6 +186,13 @@ void PrsMgr_Presentation::computeHLR(const Handle(Graphic3d_Camera)& theProjecto
|
|||||||
|
|
||||||
//=================================================================================================
|
//=================================================================================================
|
||||||
|
|
||||||
|
void PrsMgr_Presentation::RecomputeTransformation(const Handle(Graphic3d_Camera)& theProjector)
|
||||||
|
{
|
||||||
|
myPresentableObject->RecomputeTransformation(theProjector);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
PrsMgr_Presentation::~PrsMgr_Presentation()
|
PrsMgr_Presentation::~PrsMgr_Presentation()
|
||||||
{
|
{
|
||||||
Erase();
|
Erase();
|
||||||
|
@@ -100,6 +100,9 @@ protected:
|
|||||||
Handle(Graphic3d_Structure)& theGivenStruct)
|
Handle(Graphic3d_Structure)& theGivenStruct)
|
||||||
Standard_OVERRIDE;
|
Standard_OVERRIDE;
|
||||||
|
|
||||||
|
Standard_EXPORT virtual void RecomputeTransformation(const Handle(Graphic3d_Camera)& theProjector)
|
||||||
|
Standard_OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Handle(PrsMgr_PresentationManager) myPresentationManager;
|
Handle(PrsMgr_PresentationManager) myPresentationManager;
|
||||||
PrsMgr_PresentableObject* myPresentableObject;
|
PrsMgr_PresentableObject* myPresentableObject;
|
||||||
|
@@ -66,6 +66,9 @@
|
|||||||
#include <TDataStd_Name.hxx>
|
#include <TDataStd_Name.hxx>
|
||||||
#include <AppCont_Function.hxx>
|
#include <AppCont_Function.hxx>
|
||||||
#include <math_ComputeKronrodPointsAndWeights.hxx>
|
#include <math_ComputeKronrodPointsAndWeights.hxx>
|
||||||
|
#include <STEPCAFControl_Writer.hxx>
|
||||||
|
#include <STEPCAFControl_Controller.hxx>
|
||||||
|
#include <ShapeAnalysis_ShapeContents.hxx>
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
@@ -4923,6 +4926,155 @@ static Standard_Integer OCC33048(Draw_Interpretor&, Standard_Integer, const char
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
|
static Standard_Integer OCC33657_1(Draw_Interpretor&, Standard_Integer, const char**)
|
||||||
|
{
|
||||||
|
STEPCAFControl_Controller::Init();
|
||||||
|
// Checking constructors working in parallel.
|
||||||
|
OSD_Parallel::For(0, 1000, [](int) {
|
||||||
|
STEPCAFControl_Reader aReader;
|
||||||
|
aReader.SetColorMode(true);
|
||||||
|
STEPCAFControl_Writer aWriter;
|
||||||
|
aWriter.SetDimTolMode(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
|
static Standard_Integer OCC33657_2(Draw_Interpretor& theDI,
|
||||||
|
Standard_Integer theArgC,
|
||||||
|
const char** theArgV)
|
||||||
|
{
|
||||||
|
if (theArgC < 2)
|
||||||
|
{
|
||||||
|
theDI << "Use: " << theArgV[0] << " file\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
STEPCAFControl_Controller::Init();
|
||||||
|
// Checking readers working in parallel.
|
||||||
|
OSD_Parallel::For(0, 100, [&](int) {
|
||||||
|
STEPControl_Reader aReader;
|
||||||
|
aReader.ReadFile(theArgV[1], DESTEP_Parameters{});
|
||||||
|
aReader.TransferRoots();
|
||||||
|
});
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
|
static Standard_Integer OCC33657_3(Draw_Interpretor&, Standard_Integer, const char**)
|
||||||
|
{
|
||||||
|
STEPCAFControl_Controller::Init();
|
||||||
|
const TopoDS_Shape aShape = BRepPrimAPI_MakeBox(10.0, 20.0, 30.0).Shape();
|
||||||
|
// Checking writers working in parallel.
|
||||||
|
OSD_Parallel::For(0, 100, [&](int) {
|
||||||
|
STEPControl_Writer aWriter;
|
||||||
|
aWriter.Transfer(aShape, STEPControl_StepModelType::STEPControl_AsIs, DESTEP_Parameters{});
|
||||||
|
std::ostringstream aStream;
|
||||||
|
aWriter.WriteStream(aStream);
|
||||||
|
});
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
|
static Standard_Integer OCC33657_4(Draw_Interpretor& theDI,
|
||||||
|
Standard_Integer theArgC,
|
||||||
|
const char** theArgV)
|
||||||
|
{
|
||||||
|
if (theArgC < 2)
|
||||||
|
{
|
||||||
|
theDI << "Use: " << theArgV[0] << " file\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
STEPCAFControl_Controller::Init();
|
||||||
|
|
||||||
|
// Acquire shape to write/read.
|
||||||
|
STEPControl_Reader aReader;
|
||||||
|
aReader.ReadFile(theArgV[1], DESTEP_Parameters{});
|
||||||
|
aReader.TransferRoots();
|
||||||
|
TopoDS_Shape aSourceShape = aReader.OneShape();
|
||||||
|
|
||||||
|
// Analyzer to compare the shape with the the same shape after write-read sequence.
|
||||||
|
ShapeAnalysis_ShapeContents aSourceAnalyzer;
|
||||||
|
aSourceAnalyzer.Perform(aSourceShape);
|
||||||
|
|
||||||
|
// Flag is set to false if any error is detected.
|
||||||
|
// Reads and writes to the flag are performed exclusively in relaxed memory order
|
||||||
|
// in order to avoid inter-thread syncronization that can potentially omit some problems.
|
||||||
|
std::atomic_bool anErrorOccurred(false);
|
||||||
|
|
||||||
|
OSD_Parallel::For(0, 100, [&](int) {
|
||||||
|
if (anErrorOccurred.load(std::memory_order_relaxed))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Writing.
|
||||||
|
STEPControl_Writer aWriter;
|
||||||
|
aWriter.Transfer(aSourceShape,
|
||||||
|
STEPControl_StepModelType::STEPControl_AsIs,
|
||||||
|
DESTEP_Parameters{});
|
||||||
|
std::stringstream aStream;
|
||||||
|
aWriter.WriteStream(aStream);
|
||||||
|
|
||||||
|
// Reading.
|
||||||
|
STEPControl_Reader aReader;
|
||||||
|
aReader.ReadStream("", DESTEP_Parameters{}, aStream);
|
||||||
|
aReader.TransferRoots();
|
||||||
|
const TopoDS_Shape aResultShape = aReader.OneShape();
|
||||||
|
ShapeAnalysis_ShapeContents aResultAnalyzer;
|
||||||
|
aResultAnalyzer.Perform(aResultShape);
|
||||||
|
|
||||||
|
// Making sure that shape is unchanged.
|
||||||
|
if (aSourceAnalyzer.NbSolids() != aResultAnalyzer.NbSolids())
|
||||||
|
{
|
||||||
|
theDI << "Error: Wrong number of solids in the result shape.\nExpected: "
|
||||||
|
<< aSourceAnalyzer.NbSolids() << "\nActual" << aResultAnalyzer.NbSolids() << "\n";
|
||||||
|
anErrorOccurred.store(true, std::memory_order_relaxed);
|
||||||
|
}
|
||||||
|
if (aSourceAnalyzer.NbShells() != aResultAnalyzer.NbShells())
|
||||||
|
{
|
||||||
|
theDI << "Error: Wrong number of shells in the result shape.\nExpected: "
|
||||||
|
<< aSourceAnalyzer.NbShells() << "\nActual" << aResultAnalyzer.NbShells() << "\n";
|
||||||
|
anErrorOccurred.store(true, std::memory_order_relaxed);
|
||||||
|
}
|
||||||
|
if (aSourceAnalyzer.NbFaces() != aResultAnalyzer.NbFaces())
|
||||||
|
{
|
||||||
|
theDI << "Error: Wrong number of faces in the result shape.\nExpected: "
|
||||||
|
<< aSourceAnalyzer.NbFaces() << "\nActual" << aResultAnalyzer.NbFaces() << "\n";
|
||||||
|
anErrorOccurred.store(true, std::memory_order_relaxed);
|
||||||
|
}
|
||||||
|
if (aSourceAnalyzer.NbWires() != aResultAnalyzer.NbWires())
|
||||||
|
{
|
||||||
|
theDI << "Error: Wrong number of wires in the result shape.\nExpected: "
|
||||||
|
<< aSourceAnalyzer.NbWires() << "\nActual" << aResultAnalyzer.NbWires() << "\n";
|
||||||
|
anErrorOccurred.store(true, std::memory_order_relaxed);
|
||||||
|
}
|
||||||
|
if (aSourceAnalyzer.NbEdges() != aResultAnalyzer.NbEdges())
|
||||||
|
{
|
||||||
|
theDI << "Error: Wrong number of edges in the result shape.\nExpected: "
|
||||||
|
<< aSourceAnalyzer.NbEdges() << "\nActual" << aResultAnalyzer.NbEdges() << "\n";
|
||||||
|
anErrorOccurred.store(true, std::memory_order_relaxed);
|
||||||
|
}
|
||||||
|
if (aSourceAnalyzer.NbVertices() != aResultAnalyzer.NbVertices())
|
||||||
|
{
|
||||||
|
theDI << "Error: Wrong number of vertices in the result shape.\nExpected: "
|
||||||
|
<< aSourceAnalyzer.NbVertices() << "\nActual" << aResultAnalyzer.NbVertices() << "\n";
|
||||||
|
anErrorOccurred.store(true, std::memory_order_relaxed);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return anErrorOccurred;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : QACheckBends
|
// function : QACheckBends
|
||||||
// purpose :
|
// purpose :
|
||||||
@@ -5283,5 +5435,30 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands)
|
|||||||
OCC26441,
|
OCC26441,
|
||||||
group);
|
group);
|
||||||
|
|
||||||
|
theCommands.Add(
|
||||||
|
"OCC33657_1",
|
||||||
|
"Check performance of STEPCAFControl_Reader/Writer constructors in multithreading environment.",
|
||||||
|
__FILE__,
|
||||||
|
OCC33657_1,
|
||||||
|
group);
|
||||||
|
|
||||||
|
theCommands.Add("OCC33657_2",
|
||||||
|
"Check performance of STEPControl_Reader in multithreading environment.",
|
||||||
|
__FILE__,
|
||||||
|
OCC33657_2,
|
||||||
|
group);
|
||||||
|
|
||||||
|
theCommands.Add("OCC33657_3",
|
||||||
|
"Check performance of STEPControl_Writer in multithreading environment.",
|
||||||
|
__FILE__,
|
||||||
|
OCC33657_3,
|
||||||
|
group);
|
||||||
|
|
||||||
|
theCommands.Add("OCC33657_4",
|
||||||
|
"Check performance of STEPControl_Reader/Writer in multithreading environment.",
|
||||||
|
__FILE__,
|
||||||
|
OCC33657_4,
|
||||||
|
group);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -93,6 +93,7 @@ Standard_TypeDef.hxx
|
|||||||
Standard_TypeMismatch.hxx
|
Standard_TypeMismatch.hxx
|
||||||
Standard_Underflow.hxx
|
Standard_Underflow.hxx
|
||||||
Standard_UUID.hxx
|
Standard_UUID.hxx
|
||||||
Standard_Version.hxx
|
Standard_VersionInfo.cxx
|
||||||
|
Standard_VersionInfo.hxx
|
||||||
Standard_WarningsDisable.hxx
|
Standard_WarningsDisable.hxx
|
||||||
Standard_WarningsRestore.hxx
|
Standard_WarningsRestore.hxx
|
||||||
|
55
src/Standard/Standard_VersionInfo.cxx
Normal file
55
src/Standard/Standard_VersionInfo.cxx
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
// Copyright (c) 2025 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 <Standard_VersionInfo.hxx>
|
||||||
|
|
||||||
|
#include <Standard_Version.hxx>
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
|
const char* OCCT_DevelopmentVersion()
|
||||||
|
{
|
||||||
|
#ifdef OCC_VERSION_DEVELOPMENT
|
||||||
|
return OCC_VERSION_DEVELOPMENT;
|
||||||
|
#else
|
||||||
|
return "";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
|
double OCCT_Version_Double()
|
||||||
|
{
|
||||||
|
return OCC_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
|
const char* OCCT_Version_String()
|
||||||
|
{
|
||||||
|
return OCC_VERSION_STRING;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
|
const char* OCCT_Version_String_Complete()
|
||||||
|
{
|
||||||
|
return OCC_VERSION_COMPLETE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
|
const char* OCCT_Version_String_Extended()
|
||||||
|
{
|
||||||
|
return OCC_VERSION_STRING_EXT;
|
||||||
|
}
|
48
src/Standard/Standard_VersionInfo.hxx
Normal file
48
src/Standard/Standard_VersionInfo.hxx
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
// Copyright (c) 2025 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 _Standard_VersionInfo_HeaderFile
|
||||||
|
#define _Standard_VersionInfo_HeaderFile
|
||||||
|
|
||||||
|
#include <Standard_Macro.hxx>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
//! Returns development version of Open CASCADE Technology.
|
||||||
|
//! "" - in case of official release,
|
||||||
|
//! "dev" - in case of development version between releases,
|
||||||
|
//! "beta..." or "rc..." - in case of beta releases or release candidates,
|
||||||
|
//! "project..." - in case of version containing project-specific fixes.
|
||||||
|
Standard_EXPORT const char* OCCT_DevelopmentVersion();
|
||||||
|
|
||||||
|
//! Returns version of Open CASCADE Technology as a double "major.minor"
|
||||||
|
Standard_EXPORT double OCCT_Version_Double();
|
||||||
|
|
||||||
|
//! Returns version of Open CASCADE Technology as a string "major.minor"
|
||||||
|
Standard_EXPORT const char* OCCT_Version_String();
|
||||||
|
|
||||||
|
//! Returns complete version of Open CASCADE Technology as a string "major.minor.maintenance"
|
||||||
|
Standard_EXPORT const char* OCCT_Version_String_Complete();
|
||||||
|
|
||||||
|
//! Returns extended version of Open CASCADE Technology as a string
|
||||||
|
//! "major.minor.maintenance.devext". In case if no development version is defined, returns the
|
||||||
|
//! same as OCCT_Version_String_Complete().
|
||||||
|
Standard_EXPORT const char* OCCT_Version_String_Extended();
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _Standard_VersionInfo_HeaderFile */
|
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <Standard_ErrorHandler.hxx>
|
#include <Standard_ErrorHandler.hxx>
|
||||||
#include <Standard_Failure.hxx>
|
#include <Standard_Failure.hxx>
|
||||||
|
#include <Standard_Mutex.hxx>
|
||||||
|
|
||||||
#include <Message.hxx>
|
#include <Message.hxx>
|
||||||
#include <Message_Messenger.hxx>
|
#include <Message_Messenger.hxx>
|
||||||
@@ -46,6 +47,11 @@
|
|||||||
#define CHRONOMESURE
|
#define CHRONOMESURE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
static Standard_Mutex THE_GLOBAL_READ_MUTEX;
|
||||||
|
}
|
||||||
|
|
||||||
void StepFile_Interrupt(Standard_CString theErrorMessage, const Standard_Boolean theIsFail)
|
void StepFile_Interrupt(Standard_CString theErrorMessage, const Standard_Boolean theIsFail)
|
||||||
{
|
{
|
||||||
if (theErrorMessage == NULL)
|
if (theErrorMessage == NULL)
|
||||||
@@ -113,6 +119,7 @@ static Standard_Integer StepFile_Read(const char* the
|
|||||||
|
|
||||||
sout << " ... STEP File Read ...\n";
|
sout << " ... STEP File Read ...\n";
|
||||||
|
|
||||||
|
Standard_Mutex::Sentry aLocker(THE_GLOBAL_READ_MUTEX);
|
||||||
Standard_Integer nbhead, nbrec, nbpar;
|
Standard_Integer nbhead, nbrec, nbpar;
|
||||||
aFileDataModel.GetFileNbR(&nbhead, &nbrec, &nbpar); // renvoi par lex/yacc
|
aFileDataModel.GetFileNbR(&nbhead, &nbrec, &nbpar); // renvoi par lex/yacc
|
||||||
Handle(StepData_StepReaderData) undirec =
|
Handle(StepData_StepReaderData) undirec =
|
||||||
|
@@ -12,7 +12,5 @@ TKGeomAlgo
|
|||||||
TKHLR
|
TKHLR
|
||||||
CSF_user32
|
CSF_user32
|
||||||
CSF_gdi32
|
CSF_gdi32
|
||||||
CSF_OpenGlLibs
|
|
||||||
CSF_XwLibs
|
|
||||||
CSF_FREETYPE
|
CSF_FREETYPE
|
||||||
CSF_TBB
|
CSF_TBB
|
||||||
|
@@ -134,13 +134,19 @@ typedef Aspect_NeutralWindow ViewerTest_Window;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__EMSCRIPTEN__)
|
#if defined(__EMSCRIPTEN__)
|
||||||
|
#if defined(_LP64)
|
||||||
|
EM_JS(char*, occJSNumberToPtr, (double thePtr), { return BigInt(thePtr); });
|
||||||
|
#else
|
||||||
|
EM_JS(char*, occJSNumberToPtr, (double thePtr), { return thePtr; });
|
||||||
|
#endif
|
||||||
|
|
||||||
//! Return DOM id of default WebGL canvas from Module.canvas.
|
//! Return DOM id of default WebGL canvas from Module.canvas.
|
||||||
EM_JS(char*, occJSModuleCanvasId, (), {
|
EM_JS(char*, occJSModuleCanvasId, (), {
|
||||||
const aCanvasId = Module.canvas.id;
|
const aCanvasId = Module.canvas.id;
|
||||||
const aNbBytes = lengthBytesUTF8(aCanvasId) + 1;
|
const aNbBytes = lengthBytesUTF8(aCanvasId) + 1;
|
||||||
const aStrPtr = Module._malloc(aNbBytes);
|
const aStrPtr = Module._malloc(aNbBytes);
|
||||||
stringToUTF8(aCanvasId, aStrPtr, aNbBytes);
|
stringToUTF8(aCanvasId, aStrPtr, aNbBytes);
|
||||||
return aStrPtr;
|
return occJSNumberToPtr(aStrPtr);
|
||||||
});
|
});
|
||||||
|
|
||||||
//! Return DOM id of default WebGL canvas from Module.canvas.
|
//! Return DOM id of default WebGL canvas from Module.canvas.
|
||||||
@@ -10830,7 +10836,8 @@ static Standard_Integer VRenderParams(Draw_Interpretor& theDI,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theDI << "off" << " ";
|
theDI << "off"
|
||||||
|
<< " ";
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -10911,15 +10918,18 @@ static Standard_Integer VRenderParams(Draw_Interpretor& theDI,
|
|||||||
{
|
{
|
||||||
if ((aParams.FontHinting & Font_Hinting_Normal) != 0)
|
if ((aParams.FontHinting & Font_Hinting_Normal) != 0)
|
||||||
{
|
{
|
||||||
theDI << "normal" << " ";
|
theDI << "normal"
|
||||||
|
<< " ";
|
||||||
}
|
}
|
||||||
else if ((aParams.FontHinting & Font_Hinting_Normal) != 0)
|
else if ((aParams.FontHinting & Font_Hinting_Normal) != 0)
|
||||||
{
|
{
|
||||||
theDI << "light" << " ";
|
theDI << "light"
|
||||||
|
<< " ";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theDI << "off" << " ";
|
theDI << "off"
|
||||||
|
<< " ";
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -10958,15 +10968,18 @@ static Standard_Integer VRenderParams(Draw_Interpretor& theDI,
|
|||||||
{
|
{
|
||||||
if ((aParams.FontHinting & Font_Hinting_ForceAutohint) != 0)
|
if ((aParams.FontHinting & Font_Hinting_ForceAutohint) != 0)
|
||||||
{
|
{
|
||||||
theDI << "force" << " ";
|
theDI << "force"
|
||||||
|
<< " ";
|
||||||
}
|
}
|
||||||
else if ((aParams.FontHinting & Font_Hinting_NoAutohint) != 0)
|
else if ((aParams.FontHinting & Font_Hinting_NoAutohint) != 0)
|
||||||
{
|
{
|
||||||
theDI << "disallow" << " ";
|
theDI << "disallow"
|
||||||
|
<< " ";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theDI << "auto" << " ";
|
theDI << "auto"
|
||||||
|
<< " ";
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -11027,6 +11040,20 @@ static Standard_Integer VRenderParams(Draw_Interpretor& theDI,
|
|||||||
++anArgIter;
|
++anArgIter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (aFlag == "-flip")
|
||||||
|
{
|
||||||
|
if (toPrint)
|
||||||
|
{
|
||||||
|
theDI << (aView->View()->ToFlipOutput() ? "on " : "off ");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Standard_Boolean isToFlipOutput = Standard_False;
|
||||||
|
if (anArgIter + 1 < theArgNb && Draw::ParseOnOff(theArgVec[anArgIter + 1], isToFlipOutput))
|
||||||
|
{
|
||||||
|
aView->View()->SetToFlipOutput(isToFlipOutput);
|
||||||
|
++anArgIter;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (aFlag == "-rendscale" || aFlag == "-renderscale" || aFlag == "-renderresolutionscale")
|
else if (aFlag == "-rendscale" || aFlag == "-renderscale" || aFlag == "-renderresolutionscale")
|
||||||
{
|
{
|
||||||
if (toPrint)
|
if (toPrint)
|
||||||
@@ -12078,12 +12105,13 @@ static int VManipulator(Draw_Interpretor& theDi, Standard_Integer theArgsNb, con
|
|||||||
TCollection_AsciiString aName;
|
TCollection_AsciiString aName;
|
||||||
// parameters
|
// parameters
|
||||||
Standard_Integer toAutoActivate = -1, toFollowTranslation = -1, toFollowRotation = -1,
|
Standard_Integer toAutoActivate = -1, toFollowTranslation = -1, toFollowRotation = -1,
|
||||||
toFollowDragging = -1, isZoomable = -1;
|
toFollowDragging = -1, isZoomable = -1, isFlat = -1;
|
||||||
Standard_Real aGap = -1.0, aSize = -1.0;
|
Standard_Real aGap = -1.0, aSize = -1.0;
|
||||||
NCollection_Sequence<ManipAxisModeOnOff> aParts;
|
NCollection_Sequence<ManipAxisModeOnOff> aParts;
|
||||||
gp_XYZ aLocation(RealLast(), RealLast(), RealLast()), aVDir, anXDir;
|
gp_XYZ aLocation(RealLast(), RealLast(), RealLast()), aVDir, anXDir;
|
||||||
//
|
//
|
||||||
bool toDetach = false;
|
bool toDetach = false;
|
||||||
|
bool toAddObject = false;
|
||||||
AIS_Manipulator::OptionsForAttach anAttachOptions;
|
AIS_Manipulator::OptionsForAttach anAttachOptions;
|
||||||
Handle(AIS_InteractiveObject) anAttachObject;
|
Handle(AIS_InteractiveObject) anAttachObject;
|
||||||
Handle(V3d_View) aViewAffinity;
|
Handle(V3d_View) aViewAffinity;
|
||||||
@@ -12186,6 +12214,10 @@ static int VManipulator(Draw_Interpretor& theDi, Standard_Integer theArgsNb, con
|
|||||||
{
|
{
|
||||||
isZoomable = Draw::ParseOnOffNoIterator(theArgsNb, theArgVec, anArgIter) ? 1 : 0;
|
isZoomable = Draw::ParseOnOffNoIterator(theArgsNb, theArgVec, anArgIter) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
else if (anArg == "-flat")
|
||||||
|
{
|
||||||
|
isFlat = Draw::ParseOnOffNoIterator(theArgsNb, theArgVec, anArgIter) ? 1 : 0;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
else if (anArg == "-adjustposition" || anArg == "-noadjustposition")
|
else if (anArg == "-adjustposition" || anArg == "-noadjustposition")
|
||||||
{
|
{
|
||||||
@@ -12273,6 +12305,10 @@ static int VManipulator(Draw_Interpretor& theDi, Standard_Integer theArgsNb, con
|
|||||||
aTrsf.SetRotation(gp_Ax1(gp_Pnt(aRotPnt), gp_Dir(aRotAxis)), aTmpReal);
|
aTrsf.SetRotation(gp_Ax1(gp_Pnt(aRotPnt), gp_Dir(aRotAxis)), aTmpReal);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
else if (anArg == "-addobject")
|
||||||
|
{
|
||||||
|
toAddObject = true;
|
||||||
|
}
|
||||||
else if (anArg == "-detach")
|
else if (anArg == "-detach")
|
||||||
{
|
{
|
||||||
toDetach = true;
|
toDetach = true;
|
||||||
@@ -12412,6 +12448,16 @@ static int VManipulator(Draw_Interpretor& theDi, Standard_Integer theArgsNb, con
|
|||||||
ViewerTest::GetAISContext()->Display(aManipulator, Standard_False);
|
ViewerTest::GetAISContext()->Display(aManipulator, Standard_False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isFlat != -1)
|
||||||
|
{
|
||||||
|
aManipulator->SetSkinMode((AIS_Manipulator::ManipulatorSkin)isFlat);
|
||||||
|
|
||||||
|
if (ViewerTest::GetAISContext()->IsDisplayed(aManipulator))
|
||||||
|
{
|
||||||
|
ViewerTest::GetAISContext()->Remove(aManipulator, Standard_False);
|
||||||
|
ViewerTest::GetAISContext()->Display(aManipulator, Standard_False);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// detach existing manipulator object
|
// detach existing manipulator object
|
||||||
@@ -12429,9 +12475,18 @@ static int VManipulator(Draw_Interpretor& theDi, Standard_Integer theArgsNb, con
|
|||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
|
|
||||||
if (!anAttachObject.IsNull())
|
if (!anAttachObject.IsNull())
|
||||||
|
{
|
||||||
|
if (toAddObject && aManipulator->IsAttached())
|
||||||
|
{
|
||||||
|
Handle(AIS_ManipulatorObjectSequence) anAttachObjects = aManipulator->Objects();
|
||||||
|
anAttachObjects->Append(anAttachObject);
|
||||||
|
aManipulator->Attach(anAttachObjects, anAttachOptions);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
aManipulator->Attach(anAttachObject, anAttachOptions);
|
aManipulator->Attach(anAttachObject, anAttachOptions);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!aViewAffinity.IsNull())
|
if (!aViewAffinity.IsNull())
|
||||||
{
|
{
|
||||||
for (ViewerTest_ViewerCommandsViewMap::Iterator anIter(ViewerTest_myViews); anIter.More();
|
for (ViewerTest_ViewerCommandsViewMap::Iterator anIter(ViewerTest_myViews); anIter.More();
|
||||||
@@ -14382,7 +14437,7 @@ vrenderparams [-raster] [-shadingModel {unlit|facet|gouraud|phong|pbr|pbr_facet}
|
|||||||
[-shadows {on|off}=on] [-shadowMapResolution value=1024] [-shadowMapBias value=0.005]
|
[-shadows {on|off}=on] [-shadowMapResolution value=1024] [-shadowMapBias value=0.005]
|
||||||
[-depthPrePass {on|off}=off] [-alphaToCoverage {on|off}=on]
|
[-depthPrePass {on|off}=off] [-alphaToCoverage {on|off}=on]
|
||||||
[-frustumCulling {on|off|noupdate}=on] [-lineFeather width=1.0]
|
[-frustumCulling {on|off|noupdate}=on] [-lineFeather width=1.0]
|
||||||
[-sync {default|views}] [-reset]
|
[-sync {default|views}] [-reset] [-flip {on|off}=off]
|
||||||
-raster Disables GPU ray-tracing.
|
-raster Disables GPU ray-tracing.
|
||||||
-shadingModel Controls shading model.
|
-shadingModel Controls shading model.
|
||||||
-msaa Specifies number of samples for MSAA.
|
-msaa Specifies number of samples for MSAA.
|
||||||
@@ -14404,6 +14459,7 @@ vrenderparams [-raster] [-shadingModel {unlit|facet|gouraud|phong|pbr|pbr_facet}
|
|||||||
sets state to check structures culled previously.
|
sets state to check structures culled previously.
|
||||||
-sync Sets active View parameters as Viewer defaults / to other Views.
|
-sync Sets active View parameters as Viewer defaults / to other Views.
|
||||||
-reset Resets active View parameters to Viewer defaults.
|
-reset Resets active View parameters to Viewer defaults.
|
||||||
|
-flip Flips View Vertically.
|
||||||
|
|
||||||
Diagnostic output (on-screen overlay):
|
Diagnostic output (on-screen overlay):
|
||||||
vrenderparams [-perfCounters none|fps|cpu|layers|structures|groups|arrays|triangles|points
|
vrenderparams [-perfCounters none|fps|cpu|layers|structures|groups|arrays|triangles|points
|
||||||
@@ -14490,6 +14546,7 @@ Options:
|
|||||||
'-enableModes {0|1}' enable modes when attaching
|
'-enableModes {0|1}' enable modes when attaching
|
||||||
'-view {active | [name of view]}' display manipulator only in defined view,
|
'-view {active | [name of view]}' display manipulator only in defined view,
|
||||||
by default it is displayed in all views of the current viewer
|
by default it is displayed in all views of the current viewer
|
||||||
|
'-addObject allows attach manipulator to multiple objects (replace by default)
|
||||||
'-detach' detach manipulator
|
'-detach' detach manipulator
|
||||||
'-startTransform mouse_x mouse_y' - invoke start of transformation
|
'-startTransform mouse_x mouse_y' - invoke start of transformation
|
||||||
'-transform mouse_x mouse_y' - invoke transformation
|
'-transform mouse_x mouse_y' - invoke transformation
|
||||||
@@ -14507,6 +14564,7 @@ Options:
|
|||||||
'-pos x y z [nx ny nz [xx xy xz]' - set position of manipulator
|
'-pos x y z [nx ny nz [xx xy xz]' - set position of manipulator
|
||||||
'-size value' - set size of manipulator
|
'-size value' - set size of manipulator
|
||||||
'-zoomable {0|1}' - set zoom persistence
|
'-zoomable {0|1}' - set zoom persistence
|
||||||
|
'-flat {0|1}' - set flat skin mode",
|
||||||
)" /* [vmanipulator] */);
|
)" /* [vmanipulator] */);
|
||||||
|
|
||||||
addCmd("vselprops", VSelectionProperties, /* [vselprops] */ R"(
|
addCmd("vselprops", VSelectionProperties, /* [vselprops] */ R"(
|
||||||
|
@@ -168,13 +168,9 @@ TDF_Label XCAFDoc_ColorTool::AddColor(const Quantity_ColorRGBA& theColor) const
|
|||||||
if (XCAFDoc_ColorTool_AutoNaming)
|
if (XCAFDoc_ColorTool_AutoNaming)
|
||||||
{
|
{
|
||||||
// set name according to color value
|
// set name according to color value
|
||||||
const NCollection_Vec4<float>& anRgbaF = theColor;
|
|
||||||
const NCollection_Vec4<unsigned int> anRgba(anRgbaF * 255.0f);
|
|
||||||
char aColorHex[32];
|
|
||||||
Sprintf(aColorHex, "%02X%02X%02X%02X", anRgba.r(), anRgba.g(), anRgba.b(), anRgba.a());
|
|
||||||
const TCollection_AsciiString aName =
|
const TCollection_AsciiString aName =
|
||||||
TCollection_AsciiString(Quantity_Color::StringName(theColor.GetRGB().Name())) + " (#"
|
TCollection_AsciiString(Quantity_Color::StringName(theColor.GetRGB().Name())) + " ("
|
||||||
+ aColorHex + ")";
|
+ Quantity_ColorRGBA::ColorToHex(theColor) + ")";
|
||||||
TDataStd_Name::Set(aLab, aName);
|
TDataStd_Name::Set(aLab, aName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,6 +32,11 @@
|
|||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(XSControl_WorkSession, IFSelect_WorkSession)
|
IMPLEMENT_STANDARD_RTTIEXT(XSControl_WorkSession, IFSelect_WorkSession)
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
static Standard_Mutex WS_GLOBAL_MUTEX; //!< Mutex to prevent data races during reading and writing.
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================================
|
//=================================================================================================
|
||||||
|
|
||||||
XSControl_WorkSession::XSControl_WorkSession()
|
XSControl_WorkSession::XSControl_WorkSession()
|
||||||
@@ -67,6 +72,7 @@ void XSControl_WorkSession::ClearData(const Standard_Integer mode)
|
|||||||
|
|
||||||
Standard_Boolean XSControl_WorkSession::SelectNorm(const Standard_CString normname)
|
Standard_Boolean XSControl_WorkSession::SelectNorm(const Standard_CString normname)
|
||||||
{
|
{
|
||||||
|
const Standard_Mutex::Sentry aMutexLock(WS_GLOBAL_MUTEX);
|
||||||
// Old norm and results
|
// Old norm and results
|
||||||
myTransferReader->Clear(-1);
|
myTransferReader->Clear(-1);
|
||||||
// ???? En toute rigueur, menage a faire dans XWS : virer les items
|
// ???? En toute rigueur, menage a faire dans XWS : virer les items
|
||||||
@@ -424,6 +430,7 @@ Standard_Integer XSControl_WorkSession::TransferReadRoots(const Message_Progress
|
|||||||
|
|
||||||
Handle(Interface_InterfaceModel) XSControl_WorkSession::NewModel()
|
Handle(Interface_InterfaceModel) XSControl_WorkSession::NewModel()
|
||||||
{
|
{
|
||||||
|
const Standard_Mutex::Sentry aMutexLock(WS_GLOBAL_MUTEX);
|
||||||
Handle(Interface_InterfaceModel) newmod;
|
Handle(Interface_InterfaceModel) newmod;
|
||||||
if (myController.IsNull())
|
if (myController.IsNull())
|
||||||
return newmod;
|
return newmod;
|
||||||
@@ -446,6 +453,7 @@ IFSelect_ReturnStatus XSControl_WorkSession::TransferWriteShape(
|
|||||||
const Standard_Boolean compgraph,
|
const Standard_Boolean compgraph,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
|
const Standard_Mutex::Sentry aMutexLock(WS_GLOBAL_MUTEX);
|
||||||
IFSelect_ReturnStatus status;
|
IFSelect_ReturnStatus status;
|
||||||
if (myController.IsNull())
|
if (myController.IsNull())
|
||||||
return IFSelect_RetError;
|
return IFSelect_RetError;
|
||||||
|
@@ -196,6 +196,7 @@ private:
|
|||||||
//! Clears binders
|
//! Clears binders
|
||||||
Standard_EXPORT void ClearBinders();
|
Standard_EXPORT void ClearBinders();
|
||||||
|
|
||||||
|
private:
|
||||||
Handle(XSControl_Controller) myController;
|
Handle(XSControl_Controller) myController;
|
||||||
Handle(XSControl_TransferReader) myTransferReader;
|
Handle(XSControl_TransferReader) myTransferReader;
|
||||||
Handle(XSControl_TransferWriter) myTransferWriter;
|
Handle(XSControl_TransferWriter) myTransferWriter;
|
||||||
|
4
tests/bugs/step/bug33657_1
Normal file
4
tests/bugs/step/bug33657_1
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Check performance of STEPCAFControl_Reader/Writer constructors in multithreading environment.
|
||||||
|
# If no crash occures, its fine.
|
||||||
|
pload QAcommands
|
||||||
|
OCC33657_1
|
4
tests/bugs/step/bug33657_2
Normal file
4
tests/bugs/step/bug33657_2
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Check performance of STEPControl_Reader in multithreading environment.
|
||||||
|
# If no crash occures, its fine.
|
||||||
|
pload QAcommands
|
||||||
|
OCC33657_2 [locate_data_file bug21802_as1-oc-214.stp]
|
4
tests/bugs/step/bug33657_3
Normal file
4
tests/bugs/step/bug33657_3
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Check performance of STEPControl_Writer in multithreading environment.
|
||||||
|
# If no crash occures, its fine.
|
||||||
|
pload QAcommands
|
||||||
|
OCC33657_1
|
3
tests/bugs/step/bug33657_4
Normal file
3
tests/bugs/step/bug33657_4
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Check performance of STEPControl_Reader/Writer in multithreading environment.
|
||||||
|
pload QAcommands
|
||||||
|
OCC33657_4 [locate_data_file bug21802_as1-oc-214.stp]
|
41
tests/v3d/bugs/bug32116
Normal file
41
tests/v3d/bugs/bug32116
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "0032116: Visualization - AIS_Manipulator is unusable when attaching to objects with Graphic3d_TMF_ZoomPers"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
pload MODELING VISUALIZATION
|
||||||
|
|
||||||
|
box b1 10 10 10 10 20 30
|
||||||
|
box b2 50 50 50 10 20 30
|
||||||
|
|
||||||
|
vinit View1
|
||||||
|
vdisplay b1 -dispmode 1 -trsfPers zoom -trsfPersPos 0 0 0
|
||||||
|
vdisplay b2 -dispmode 1 -trsfPers zoom -trsfPersPos 10 10 10
|
||||||
|
vfit
|
||||||
|
|
||||||
|
vmanipulator m -attach b1 -addObject
|
||||||
|
vmanipulator m -attach b2 -addObject
|
||||||
|
|
||||||
|
set mouse_pick {90 225}
|
||||||
|
set mouse_drag {90 150}
|
||||||
|
|
||||||
|
vmoveto {*}$mouse_pick
|
||||||
|
vselect {*}$mouse_pick
|
||||||
|
vmanipulator m -startTransform {*}$mouse_pick
|
||||||
|
vmanipulator m -transform {*}$mouse_drag
|
||||||
|
vmanipulator m -stopTransform
|
||||||
|
vmoveto {*}$mouse_drag
|
||||||
|
|
||||||
|
if { [vreadpixel {*}$mouse_drag -rgb -name] != "CYAN" } { puts "Error: wrong manipulator position" }
|
||||||
|
if { [vreadpixel 115 170 -rgb -name] != "DARKGOLDENROD" } { puts "Error: wrong b1 tranformation" }
|
||||||
|
if { [vreadpixel 400 10 -rgb -name] != "DARKGOLDENROD" } { puts "Error: wrong b2 tranformation" }
|
||||||
|
|
||||||
|
vdump ${imagedir}/${casename}_1.png
|
||||||
|
|
||||||
|
vmoveto 0 0
|
||||||
|
vzoom 0.2
|
||||||
|
|
||||||
|
if { [vreadpixel 210 170 -rgb -name] != "DARKGOLDENROD" } { puts "Error: wrong b1 tranformation" }
|
||||||
|
if { [vreadpixel 310 120 -rgb -name] != "DARKGOLDENROD" } { puts "Error: wrong b2 tranformation" }
|
||||||
|
|
||||||
|
vdump ${imagedir}/${casename}_2.png
|
50
tests/v3d/manipulator/flat
Normal file
50
tests/v3d/manipulator/flat
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
puts "==========================="
|
||||||
|
puts "AIS_Manipulator - flat skin"
|
||||||
|
puts "==========================="
|
||||||
|
|
||||||
|
pload MODELING VISUALIZATION
|
||||||
|
|
||||||
|
set anImage1 $imagedir/${casename}_1.png
|
||||||
|
set anImage2 $imagedir/${casename}_2.png
|
||||||
|
set anImage3 $imagedir/${casename}_3.png
|
||||||
|
|
||||||
|
# create manipulated and helper objects
|
||||||
|
box b 0 0 0 20 20 20
|
||||||
|
|
||||||
|
# display manipulated objects
|
||||||
|
vdisplay b -dispmode 1
|
||||||
|
vright
|
||||||
|
vrotate -mouseStart 400 200 -mouseMove 300 300
|
||||||
|
vzoom 3
|
||||||
|
|
||||||
|
# attach manipulator
|
||||||
|
vmanipulator m -attach b -zoomable 1 -flat 1
|
||||||
|
|
||||||
|
# test translation transform
|
||||||
|
set mouse_pick {180 215}
|
||||||
|
set mouse_drag {065 350}
|
||||||
|
|
||||||
|
vmoveto 0 0
|
||||||
|
vmoveto {*}$mouse_pick
|
||||||
|
vdump $anImage1
|
||||||
|
|
||||||
|
vselect {*}$mouse_pick
|
||||||
|
vmanipulator m -startTransform {*}$mouse_pick
|
||||||
|
vmanipulator m -transform {*}$mouse_drag
|
||||||
|
vmanipulator m -stopTransform
|
||||||
|
vselect 0 0
|
||||||
|
vdump $anImage2
|
||||||
|
|
||||||
|
# test plane dragging transform
|
||||||
|
set mouse_pick {115 280}
|
||||||
|
set mouse_drag {320 040}
|
||||||
|
|
||||||
|
vmoveto 0 0
|
||||||
|
vmoveto {*}$mouse_pick
|
||||||
|
vdump $anImage3
|
||||||
|
|
||||||
|
vselect {*}$mouse_pick
|
||||||
|
vmanipulator m -startTransform {*}$mouse_pick
|
||||||
|
vmanipulator m -transform {*}$mouse_drag
|
||||||
|
vmanipulator m -stopTransform
|
||||||
|
vselect 0 0
|
@@ -18,8 +18,8 @@ vzoom 0.5
|
|||||||
vmanipulator m -attach b
|
vmanipulator m -attach b
|
||||||
|
|
||||||
#set mouse coordinates for actions
|
#set mouse coordinates for actions
|
||||||
set mouse_pick {205 155}
|
set mouse_pick {206 155}
|
||||||
set mouse_drag1 {205 55}
|
set mouse_drag1 {206 55}
|
||||||
set mouse_pick2 {250 10}
|
set mouse_pick2 {250 10}
|
||||||
set mouse_pick3 {250 200}
|
set mouse_pick3 {250 200}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user