1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

..

24 Commits

Author SHA1 Message Date
oan
ad4694485b 0033436: Data Exchange, DE_Wrapper - DEXCAFCascade_ConfigurationNode::BuildProvider() not initialize provider
Pass pointer to DEXCAFCascade_ConfigurationNode to DEXCAFCascade_Provider;
Remove forcible manual reset of Provider's node in DE_Wrapper::FindProvider() to verify that all specializations of configuration node work properly without necessity of workarounds.
2023-07-28 10:22:05 +01:00
dpasukhi
ae4d7bdae4 // implement scale attribute into ShapeTool 2023-07-11 08:51:44 +01:00
ichesnok
c9e1adee31 Fix 2023-06-28 11:39:00 +01:00
ichesnok
be6e4c39e4 // fix 2023-06-20 22:33:56 +01:00
dpasukhi
bc456bd3d2 // implemented start and end time code 2023-06-20 22:33:56 +01:00
dpasukhi
fe9a338c22 // fixed logic problems 2023-06-20 22:33:55 +01:00
dpasukhi
d5aa331d56 // fixed compilation problem 2023-06-20 22:33:55 +01:00
dpasukhi
0422f36fda // completed base animation XCAF getting/setting object
Going to test on CAD format import
2023-06-20 22:33:55 +01:00
dpasukhi
0421a6be39 // Continued expansion of Animation storage functionality
Updated Operation classes to smart pointer classes
First iteration of Animation getting and setting object
First version of XCAF tool to deal with Animation
Implemented new GUID for clear definition of Animation attributes
2023-06-20 22:33:55 +01:00
dpasukhi
6b6b04e2ce // implement conversion into/from array2
implement getting typeName
2023-06-20 22:33:55 +01:00
dpasukhi
20e7e98e18 0033397: Data Exchange - Implementing support for the Animation storage
Implement basis structure.
Filled basic animation structures.
2023-06-20 22:33:55 +01:00
oan
0a15182153 0033250: Configuration - Missing Limits header file
Added new include limits to fix build problem
2023-06-20 22:33:02 +01:00
oan
d1cce26f56 Add option -d to enable Debug mode instead of custom script variable 2023-06-14 00:57:02 +01:00
oan
25b32bc9b5 Unify build scripts for CI/CD without fips 2023-06-13 17:48:49 +01:00
msv
0ed464551e 0033304: Modeling Data - Floating point signal when converting a B-spline curve to analytical form
Protect the static function ConicDefinition from calling sqrt with negative argument.
2022-12-27 22:19:11 +03:00
dpasukhi
9621410faa 0033246: Data Exchange, DE Wrapper - Checking license leads to performance problem
ReWork UpdateLoad functionality:
UpdateLoad calls only if provider is found.
UpdateLoad calls only for chosen type of translation (read/write)
Add new method to UpdateLoad all registered nodes.
2022-12-05 14:36:00 +03:00
dpasukhi
df85ce0635 0033232: Data Exchange, DE_Wrapper - Implement ability to change global session
Add ability to set/get global session
2022-12-02 11:53:37 +03:00
dpasukhi
21efa6d053 0033230: Data Exchange, DE Wrapper - Update API to find CAD provider
Moved FindProvider method to public section
Made FindProvider as virtual to make it possible to overwrite.
2022-12-02 11:53:36 +03:00
dpasukhi
ad13308eb4 0033228: Data Exchange, DE Wrapper - Make the document argument of the method Read const handle
Rewrite document argument for DE_Wrapper Read method
2022-12-02 11:53:36 +03:00
msv
41fe9319fd Changes due to relocation of ASRV source code to bitbucket cloud. 2022-11-30 17:19:12 +03:00
msv
364f396a14 Correct wasm_build.sh to support new structure of freetype directory 2022-11-25 10:25:40 +03:00
msv
1b29197cc9 Build customization for ASRV. 2022-11-25 10:25:39 +03:00
dpasukhi
185d29b92f 0033198: Using a third-party Draco to compile in DEBUG mode
Added new CMake variables to build using DRACO
Windows OS works with Debug and Release configuration DRACO
Linux works with Release configuration DRACO
2022-11-12 01:19:44 +03:00
smoskvin
2923ef0df8 fixed compilation by the genproj tool 2022-11-11 11:26:00 +03:00
69 changed files with 2999 additions and 176 deletions

31
README-ASRV.txt Normal file
View File

@@ -0,0 +1,31 @@
Instruction for building OCCT for ASRV
======================================
Build using regular native compiler
-----------------------------------
1. Make sure the directory 3rdparty is next to occt. It must contain the following products:
freetype
tcltk
2. Change current directory to adm/scripts.
3. On Windows run the script cmake_gen.bat.
On Linux run 'cmake_gen.sh' for release build and 'cmake_gen.sh -d' for debug build.
4. Go to build directory and build and install OCCT.
On Windows run:
build.bat
build.bat vc14 64 d
install.bat
install.bat vc14 64 d
On Linux run:
make -j4 install
Build using Emscripten to generate libs for Web assembly
--------------------------------------------------------
1. Make sure you have installed Emscripten. For that you can make sure occ-web3d directory
is next to occt. It must contain fips\fips-sdks\emsdk.
2. Make sure the directory 3rdparty is next to occt. It must contain the following products:
freetype wasm build
3. Change current directory to adm/scripts.
4. Run the script wasm_build.bat (wasm_build.sh on Linux).
5. Copy installed files from work/wasm to the 3rdparty under occt77-wasm.

View File

@@ -3,10 +3,6 @@
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
if (NOT DEFINED INSTALL_DRACO)
set (INSTALL_DRACO OFF CACHE BOOL "${INSTALL_DRACO_DESCR}")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_DIR)
set (3RDPARTY_DRACO_DIR "" CACHE PATH "The directory containing Draco")
endif()
@@ -15,14 +11,24 @@ if (NOT DEFINED 3RDPARTY_DRACO_INCLUDE_DIR)
set (3RDPARTY_DRACO_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the Draco")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY OR NOT 3RDPARTY_DRACO_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
set (3RDPARTY_DRACO_LIBRARY "" CACHE FILEPATH "Draco library" FORCE)
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY)
set (3RDPARTY_DRACO_LIBRARY "" CACHE FILEPATH "Draco library")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DIR)
set (3RDPARTY_DRACO_LIBRARY_DIR "" CACHE PATH "The directory containing Draco library")
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DEBUG)
set (3RDPARTY_DRACO_LIBRARY_DEBUG "" CACHE FILEPATH "Draco debug library")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DIR_DEBUG)
set (3RDPARTY_DRACO_LIBRARY_DIR_DEBUG "" CACHE PATH "The directory containing Draco debug library")
endif()
endif()
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
if (NOT 3RDPARTY_DRACO_DIR OR NOT EXISTS "${3RDPARTY_DRACO_DIR}")
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" draco DRACO_DIR_NAME)
@@ -32,20 +38,19 @@ if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
endif()
endif()
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
set (DRACO_INCLUDE_PATH "${3RDPARTY_DRACO_DIR}/include")
set (DRACO_LIBRARY_PATH "${3RDPARTY_DRACO_DIR}/lib")
endif()
# header
if (NOT 3RDPARTY_DRACO_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_DRACO_INCLUDE_DIR}")
set (HEADER_NAMES draco)
if (NOT 3RDPARTY_DRACO_INCLUDE_DIR)
if (DRACO_INCLUDE_PATH AND EXISTS "${DRACO_INCLUDE_PATH}")
set (3RDPARTY_DRACO_INCLUDE_DIR "${DRACO_INCLUDE_PATH}" CACHE FILEPATH "The directory containing headers of DRACO" FORCE)
endif()
endif()
# set 3RDPARTY_DRACO_INCLUDE_DIR as notfound, otherwise find_path can't assign a new value to 3RDPARTY_DRACO_INCLUDE_DIR
set (3RDPARTY_DRACO_INCLUDE_DIR "3RDPARTY_DRACO_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "The directory containing headers of the Draco" FORCE)
if (NOT 3RDPARTY_DRACO_LIBRARY_DIR)
if (DRACO_LIBRARY_PATH AND EXISTS "${DRACO_LIBRARY_PATH}")
set (3RDPARTY_DRACO_LIBRARY_DIR "${DRACO_LIBRARY_PATH}" CACHE FILEPATH "The directory containing DRACO library" FORCE)
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
find_path (3RDPARTY_DRACO_INCLUDE_DIR NAMES ${HEADER_NAMES}
PATHS ${3RDPARTY_DRACO_DIR}
PATH_SUFFIXES "include"
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
endif()
endif()
@@ -57,11 +62,11 @@ endif()
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
if (NOT 3RDPARTY_DRACO_LIBRARY OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .a)
set (3RDPARTY_DRACO_LIBRARY "3RDPARTY_DRACO_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to Draco library" FORCE)
find_library (3RDPARTY_DRACO_LIBRARY NAMES ${CSF_Draco}
PATHS "${3RDPARTY_DRACO_LIBRARY_DIR}"
PATHS "${3RDPARTY_DRACO_DIR}"
PATH_SUFFIXES lib
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
@@ -70,27 +75,19 @@ if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
set (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY_DIR}" CACHE FILEPATH "The directory containing Draco library" FORCE)
endif()
endif()
endif()
if (3RDPARTY_DRACO_LIBRARY_DIR AND EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_DRACO_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_DRACO_LIBRARY_DIR)
endif()
if (WIN32 AND (NOT 3RDPARTY_DRACO_LIBRARY_DEBUG OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY_DEBUG}"))
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .a)
set (3RDPARTY_DRACO_LIBRARY_DEBUG "3RDPARTY_DRACO_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "The path to debug Draco library" FORCE)
if (INSTALL_DRACO)
get_filename_component(3RDPARTY_DRACO_LIBRARY_REALPATH ${3RDPARTY_DRACO_LIBRARY} REALPATH)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR_LIB}")
else()
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_LIB}")
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_LIB}i")
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_LIB}d")
find_library (3RDPARTY_DRACO_LIBRARY_DEBUG NAMES ${CSF_Draco}
PATHS "${3RDPARTY_DRACO_DIR}"
PATH_SUFFIXES libd
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
if (3RDPARTY_DRACO_LIBRARY_DEBUG AND EXISTS "${3RDPARTY_DRACO_LIBRARY_DEBUG}")
get_filename_component (3RDPARTY_DRACO_LIBRARY_DIR_DEBUG "${3RDPARTY_DRACO_LIBRARY_DEBUG}" PATH)
set (3RDPARTY_DRACO_LIBRARY_DIR_DEBUG "${3RDPARTY_DRACO_LIBRARY_DIR_DEBUG}" CACHE FILEPATH "The directory containing debug Draco library" FORCE)
endif()
endif()
endif()

View File

@@ -370,6 +370,10 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
add_definitions (-DHAVE_GLES2)
endif()
if ("${CURRENT_CSF}" STREQUAL "${CSF_Draco}")
set (CURRENT_CSF "")
set (USED_DRACO 1)
endif()
set (LIBRARY_FROM_CACHE 0)
separate_arguments (CURRENT_CSF)
foreach (CSF_LIBRARY ${CURRENT_CSF})
@@ -397,7 +401,7 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
endforeach()
endforeach()
if (NOT ${LIBRARY_FROM_CACHE})
if (NOT ${LIBRARY_FROM_CACHE} AND NOT "${CURRENT_CSF}" STREQUAL "")
# prepare a list from a string with whitespaces
separate_arguments (CURRENT_CSF)
list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${CURRENT_CSF})
@@ -408,6 +412,28 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
endif()
endforeach()
if (USE_DRACO)
if (USED_DRACO)
set (USED_LIB_RELEASE ${3RDPARTY_DRACO_LIBRARY})
if (WIN32)
set (USED_LIB_DEBUG ${3RDPARTY_DRACO_LIBRARY_DEBUG})
else()
set (USED_LIB_DEBUG ${3RDPARTY_DRACO_LIBRARY})
endif()
set (USED_LIB_CONF)
if (EXISTS ${USED_LIB_DEBUG})
set (USED_LIB_CONF "$<$<CONFIG:DEBUG>:${USED_LIB_DEBUG}>;${USED_LIB_CONF}")
endif()
if (EXISTS ${USED_LIB_RELEASE})
set (USED_LIB_CONF "$<$<CONFIG:RELEASE>:${USED_LIB_RELEASE}>;${USED_LIB_CONF}")
set (USED_LIB_CONF "$<$<CONFIG:RELWITHDEBINFO>:${USED_LIB_RELEASE}>;${USED_LIB_CONF}")
endif()
if (DEFINED USED_LIB_CONF)
set_property (TARGET ${PROJECT_NAME} APPEND PROPERTY LINK_LIBRARIES "${USED_LIB_CONF}")
endif()
endif()
endif()
if (APPLE)
list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT X11 IS_X11_FOUND)
if (NOT ${IS_X11_FOUND} EQUAL -1)

View File

@@ -1,2 +0,0 @@
*custom.bat
*custom.sh

View File

@@ -0,0 +1,50 @@
rem Environment configuration template for cmake_gen.bat (to be renamed as cmake_gen_custom.bat)
set "OCCT3RDPARTY=%SrcRoot%\..\3rdparty"
set VS=14
set VSDATA=2015
rem Leave VSPLATFORM empty to build for x86 platform
set VSPLATFORM=Win64
rem ------------------------------------
rem Uncomment to customize building steps
rem ------------------------------------
rem set "BUILD_DIR=build-vs%VS%-%VSPLATFORM%"
set "INSTALL_DIR=%SrcRoot%\..\3rdparty\occt77-vc14-64"
set BUILD_CPP_STANDARD=C++14
rem set BUILD_DOC_Overview=OFF
rem set BUILD_Inspector=OFF
rem set BUILD_LIBRARY_TYPE=Shared
rem set BUILD_RELEASE_DISABLE_EXCEPTIONS=ON
rem set BUILD_WITH_DEBUG=OFF
rem set BUILD_ENABLE_FPE_SIGNAL_HANDLER=ON
rem set BUILD_USE_PCH=OFF
rem set BUILD_FORCE_RelWithDebInfo=OFF
rem Use semicolon-separated list of toolkits if you want to disable all modules
rem and build only some toolkits.
rem set BUILD_ADDITIONAL_TOOLKITS=
rem Set a directory recognized as a patch for OCCT.
rem set BUILD_PATCH=
rem set BUILD_MODULE_ApplicationFramework=ON
rem set BUILD_MODULE_DataExchange=ON
rem set BUILD_MODULE_Draw=ON
rem set BUILD_MODULE_ModelingAlgorithms=ON
rem set BUILD_MODULE_ModelingData=ON
rem set BUILD_MODULE_Visualization=ON
rem set USE_D3D=OFF
rem set USE_FFMPEG=OFF
set USE_FREEIMAGE=ON
rem set USE_GLES2=OFF
rem set USE_RAPIDJSON=OFF
rem set USE_DRACO=OFF
rem set USE_TBB=OFF
rem set USE_VTK=OFF

View File

@@ -0,0 +1,45 @@
# Environment configuration template for cmake_gen.sh (to be renamed as cmake_gen_custom.sh)
OCCT3RDPARTY="$SrcRoot/../3rdparty"
FREETYPE_DIR="$OCCT3RDPARTY/freetype-2.7.1"
# ------------------------------------
# Uncomment to customize building steps
# ------------------------------------
#BUILD_DIR=build
INSTALL_DIR="$SrcRoot/../3rdparty/occt77"
BUILD_CPP_STANDARD=C++14
#BUILD_DOC_Overview=OFF
#BUILD_Inspector=OFF
#BUILD_LIBRARY_TYPE=Shared
#BUILD_RELEASE_DISABLE_EXCEPTIONS=ON
#BUILD_WITH_DEBUG=OFF
#BUILD_ENABLE_FPE_SIGNAL_HANDLER=ON
# Use semicolon-separated list of toolkits if you want to disable all modules
# and build only some toolkits.
#BUILD_ADDITIONAL_TOOLKITS=
# Set a directory recognized as a patch for OCCT.
#BUILD_PATCH=
#BUILD_MODULE_ApplicationFramework=ON
#BUILD_MODULE_DataExchange=ON
#BUILD_MODULE_Draw=ON
#BUILD_MODULE_ModelingAlgorithms=ON
#BUILD_MODULE_ModelingData=ON
#BUILD_MODULE_Visualization=ON
#USE_FFMPEG=OFF
USE_FREEIMAGE=ON
#USE_GLES2=OFF
#USE_RAPIDJSON=OFF
#USE_DRACO=OFF
#USE_TBB=OFF
#USE_VTK=OFF
# This is to add any additional arguments to cmake
#AUX_ARGS=

View File

@@ -15,6 +15,8 @@ set "BUILD_DIR=build-vs%VS%-%VSPLATFORM%"
set "OCCT3RDPARTY="
set "INSTALL_DIR=%SrcRoot%\install"
set BUILD_CPP_STANDARD=C++11
set BUILD_ADDITIONAL_TOOLKITS=
set BUILD_DOC_Overview=OFF
set BUILD_Inspector=OFF
@@ -55,6 +57,7 @@ if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
pushd "%BUILD_DIR%"
cmake -G "%arch_compile%" ^
-D BUILD_CPP_STANDARD:STRING="%BUILD_CPP_STANDARD%" ^
-D 3RDPARTY_DIR:STRING="%OCCT3RDPARTY%" ^
-D BUILD_ADDITIONAL_TOOLKITS:STRING="%BUILD_ADDITIONAL_TOOLKITS%" ^
-D BUILD_DOC_Overview:BOOL=%BUILD_DOC_Overview% ^

View File

@@ -14,12 +14,13 @@ DEB=
CMAKE_BUILD_TYPE=Release
if [ "$1" = "-d" ]; then
DEB=d
BUILD_DIR=${BUILD_DIR}-deb
CMAKE_BUILD_TYPE=Debug
fi
INSTALL_DIR_BIN=lin64/gcc/bin$DEB
INSTALL_DIR_LIB=lin64/gcc/lib$DEB
BUILD_CPP_STANDARD=C++11
BUILD_ADDITIONAL_TOOLKITS=
BUILD_DOC_Overview=OFF
BUILD_Inspector=OFF
@@ -54,6 +55,7 @@ if [ ! -d "$BUILD_DIR" ]; then mkdir -p "$BUILD_DIR"; fi
pushd "$BUILD_DIR"
cmake -G "Unix Makefiles" \
-D BUILD_CPP_STANDARD:STRING="$BUILD_CPP_STANDARD" \
-D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
-D 3RDPARTY_DIR:PATH="$OCCT3RDPARTY" \
-D 3RDPARTY_FREETYPE_DIR:PATH="$FREETYPE_DIR" \

View File

@@ -26,6 +26,12 @@ set "toDebug=0"
set "toBuildSample=0"
set "sourceMapBase="
set "aBuildType=Release"
if /I ["%1"] == ["-d"] (
set "toDebug=1"
set "aBuildType=Debug"
)
rem OCCT Modules to build
set "BUILD_ModelingData=ON"
set "BUILD_ModelingAlgorithms=ON"
@@ -44,9 +50,38 @@ rem Archive tool
set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on"
set "THE_7Z_PATH=%ProgramW6432%\7-Zip\7z.exe"
set "aPlatformAndCompiler="
set "aWorkDir="
set "aDestDir="
set "aLogFile="
set "aSrcRootSmpl=%aCasSrc%\samples\webgl"
set "aWorkDirSmpl="
set "aDestDirSmpl="
set "aLogFileSmpl="
rem Configuration file
if exist "%~dp0wasm_custom.bat" call "%~dp0wasm_custom.bat"
set "aBuildTypePrefix="
set "anExtraCxxFlags="
if /I ["%USE_PTHREADS%"] == ["ON"] (
set "anExtraCxxFlags=-pthread"
set "aBuildTypePrefix=%aBuildTypePrefix%-pthread"
)
if ["%toDebug%"] == ["1"] (
set "aBuildTypePrefix=%aBuildTypePrefix%-debug"
)
if ["%aPlatformAndCompiler%"] == [""] ( set "aPlatformAndCompiler=wasm32%aBuildTypePrefix%" )
if ["%aWorkDir%"] == [""] ( set "aWorkDir=%aBuildRoot%\occt-%aPlatformAndCompiler%-make" )
if ["%aDestDir%"] == [""] ( set "aDestDir=%aBuildRoot%\occt-%aPlatformAndCompiler%" )
if ["%aLogFile%"] == [""] ( set "aLogFile=%aBuildRoot%\occt-%aPlatformAndCompiler%-build.log" )
if ["%aWorkDirSmpl%"] == [""] ( set "aWorkDirSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%-make" )
if ["%aDestDirSmpl%"] == [""] ( set "aDestDirSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%" )
if ["%aLogFileSmpl%"] == [""] ( set "aLogFileSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%-build.log" )
call "%EMSDK_ROOT%\emsdk_env.bat"
set "aToolchain=%EMSDK%/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
if not ["%aCmakeBin%"] == [""] ( set "PATH=%aCmakeBin%;%PATH%" )
@@ -58,23 +93,8 @@ for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_DEVELOP
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" )
set "aBuildType=Release"
set "aBuildTypePrefix="
set "anExtraCxxFlags="
if /I ["%USE_PTHREADS%"] == ["ON"] (
set "anExtraCxxFlags=-pthread"
set "aBuildTypePrefix=%aBuildTypePrefix%-pthread"
)
if ["%toDebug%"] == ["1"] (
set "aBuildType=Debug"
set "aBuildTypePrefix=%aBuildTypePrefix%-debug"
)
call :cmakeGenerate
if errorlevel 1 (
if not ["%1"] == ["-nopause"] (
pause
)
exit /B 1
goto :eof
)
@@ -115,10 +135,6 @@ if not ["%1"] == ["-nopause"] (
goto :eof
:cmakeGenerate
set "aPlatformAndCompiler=wasm32%aBuildTypePrefix%"
set "aWorkDir=%aBuildRoot%\occt-%aPlatformAndCompiler%-make"
set "aDestDir=%aBuildRoot%\occt-%aPlatformAndCompiler%"
set "aLogFile=%aBuildRoot%\occt-%aPlatformAndCompiler%-build.log"
if ["%toCMake%"] == ["1"] (
if ["%toClean%"] == ["1"] (
rmdir /S /Q %aWorkDir%"
@@ -128,10 +144,6 @@ if ["%toCMake%"] == ["1"] (
if not exist "%aWorkDir%" ( mkdir "%aWorkDir%" )
if exist "%aLogFile%" ( del "%aLogFile%" )
set "aSrcRootSmpl=%aCasSrc%\samples\webgl"
set "aWorkDirSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%-make"
set "aDestDirSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%"
set "aLogFileSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%-build.log"
if ["%toBuildSample%"] == ["1"] (
if ["%toCMake%"] == ["1"] (
if ["%toClean%"] == ["1"] (

View File

@@ -4,6 +4,11 @@
# wasm_custom.sh should be configured with paths to CMake, 3rd-parties and Emscripten SDK.
# FreeType should be specified as mandatory dependency.
CMAKE_BUILD_TYPE=Release
if [ "$1" = "-d" ]; then
CMAKE_BUILD_TYPE=Debug
fi
export aScriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
export aSrcRoot="${aScriptDir}/../.."
export aBuildRoot=work
@@ -21,6 +26,12 @@ export BUILD_Visualization=ON
export BUILD_ApplicationFramework=ON
export BUILD_DataExchange=ON
export aPlatformAndCompiler=wasm
export aWorkDir="${aSrcRoot}/${aBuildRoot}/${aPlatformAndCompiler}-make"
export aDestDir="${aSrcRoot}/${aBuildRoot}/${aPlatformAndCompiler}"
export aLogFile="${aSrcRoot}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
if [ -f "${aScriptDir}/wasm_custom.sh" ] ; then
. "${aScriptDir}/wasm_custom.sh"
fi
@@ -33,19 +44,14 @@ export aGitBranch=`git symbolic-ref --short HEAD`
echo "Compilation OCCT branch : $aGitBranch"
export aPlatformAndCompiler=wasm
export aWorkDir="${aSrcRoot}/${aBuildRoot}/${aPlatformAndCompiler}-make"
if [ ! -d "${aWorkDir}" ]; then
mkdir -p "${aWorkDir}"
fi
export aDestDir="${aSrcRoot}/${aBuildRoot}/${aPlatformAndCompiler}"
if [ ! -d "${aDestDir}" ]; then
mkdir -p "${aDestDir}"
fi
export aLogFile="${aSrcRoot}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
if [ -f "${aLogFile}" ]; then
rm "${aLogFile}"
fi
@@ -60,14 +66,14 @@ if [ "${toCMake}" = "1" ]; then
echo "Configuring OCCT for WASM..."
echo cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="${aToolchain}" \
-DCMAKE_BUILD_TYPE:STRING="Release" \
-DCMAKE_BUILD_TYPE:STRING="$CMAKE_BUILD_TYPE" \
-DBUILD_LIBRARY_TYPE:STRING="Static" \
-DINSTALL_DIR:PATH="${aDestDir}" \
-DINSTALL_DIR_INCLUDE:STRING="inc" \
-DINSTALL_DIR_RESOURCE:STRING="src" \
-D3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include/freetype2" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include/freetype2" \
-DBUILD_MODULE_FoundationClasses:BOOL="ON" \
-DBUILD_MODULE_ModelingData:BOOL="${BUILD_ModelingData}" \
-DBUILD_MODULE_ModelingAlgorithms:BOOL="${BUILD_ModelingAlgorithms}" \
@@ -78,14 +84,14 @@ echo cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="${aToolchain}" \
-DBUILD_DOC_Overview:BOOL="OFF" "${aSrcRoot}"
cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="${aToolchain}" \
-DCMAKE_BUILD_TYPE:STRING="Release" \
-DCMAKE_BUILD_TYPE:STRING="$CMAKE_BUILD_TYPE" \
-DBUILD_LIBRARY_TYPE:STRING="Static" \
-DINSTALL_DIR:PATH="${aDestDir}" \
-DINSTALL_DIR_INCLUDE:STRING="inc" \
-DINSTALL_DIR_RESOURCE:STRING="src" \
-D3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include/freetype2" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include/freetype2" \
-DBUILD_MODULE_FoundationClasses:BOOL="ON" \
-DBUILD_MODULE_ModelingData:BOOL="${BUILD_ModelingData}" \
-DBUILD_MODULE_ModelingAlgorithms:BOOL="${BUILD_ModelingAlgorithms}" \

View File

@@ -0,0 +1,30 @@
rem Environment configuration template for wasm_build.bat (to be renamed as wasm_custom.bat)
set "aFreeType=%aCasSrc%\..\3rdparty\freetype-2.7.1-wasm"
set "EMSDK_ROOT=%aCasSrc%\..\emsdk"
rem set "aRapidJson=%aCasSrc%\..\3rdparty\rapidjson-1.1.0"
rem set "aDraco=%aCasSrc%\..\3rdparty\draco-1.4.1-wasm32"
rem set "aCmakeBin=%ProgramW6432%\CMake\bin"
set "aDestDir=%aCasSrc%\..\3rdparty\occt77-wasm"
rem Uncomment to customize building steps
rem set "aBuildRoot=work"
rem set "toCMake=1"
rem set "toClean=0"
rem set "toMake=1"
rem set "toInstall=1"
set "toPack=0"
set "toBuildSample=0"
rem Source map base (should point to server where C++ sources will be copied)
rem enables -g4 debug building option for WebGL sample and allows navigating C++ source code within JavaScript debugger.
rem set "sourceMapBase=http://localhost:9090/"
set "BUILD_ModelingData=OFF"
set "BUILD_ModelingAlgorithms=OFF"
rem set "BUILD_Visualization=ON"
set "BUILD_ApplicationFramework=OFF"
set "BUILD_DataExchange=OFF"
set "USE_RAPIDJSON=OFF"
set "USE_DRACO=OFF"
set "USE_PTHREADS=OFF"

View File

@@ -0,0 +1,20 @@
# environment configuration template for occ_build_wasm.sh (to be renamed as wasm_custom_env.sh)
export aFreeType="$aSrcRoot/../3rdparty/freetype-2.7.1-wasm"
export EMSDK_ROOT="$aSrcRoot/../emsdk"
export aDestDir="${aSrcRoot}/../3rdparty/occt77-wasm"
# Uncomment to customize building steps
#export aBuildRoot=work
#export toCMake=1
#export toClean=0
#export toMake=1
#export toInstall=1
export BUILD_ModelingData=OFF
export BUILD_ModelingAlgorithms=OFF
#export BUILD_Visualization=ON
export BUILD_ApplicationFramework=OFF
export BUILD_DataExchange=OFF
export aNbJobs=10

View File

@@ -13,7 +13,7 @@
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// branch2
#include <Adaptor2d_Curve2d.hxx>
#include <Geom2d_BezierCurve.hxx>

View File

@@ -13,7 +13,7 @@
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// branch2
#include <Adaptor3d_Curve.hxx>
#include <Geom_BezierCurve.hxx>

View File

@@ -88,8 +88,11 @@ bool DE_ConfigurationNode::Save(const TCollection_AsciiString& theResourcePath)
// function : UpdateLoad
// purpose :
//=======================================================================
bool DE_ConfigurationNode::UpdateLoad()
bool DE_ConfigurationNode::UpdateLoad(const Standard_Boolean theToImport,
const Standard_Boolean theToKeep)
{
(void)theToImport;
(void)theToKeep;
return true;
}

View File

@@ -85,9 +85,12 @@ public:
//! @return new object with the same field values
Standard_EXPORT virtual Handle(DE_ConfigurationNode) Copy() const = 0;
//! Update loading status. Checking for the license.
//! Update loading status. Checking for the ability to read and write.
//! @param[in] theToImport flag to updates for import. Standard_True-import, Standard_False-export
//! @param[in] theToKeep flag to save update result
//! @return Standard_True, if node can be used
Standard_EXPORT virtual bool UpdateLoad();
Standard_EXPORT virtual bool UpdateLoad(const Standard_Boolean theToImport,
const Standard_Boolean theToKeep);
public:

View File

@@ -34,6 +34,9 @@ namespace
static const TCollection_AsciiString aScope ("global");
return aScope;
}
//! Global configuration of current DE Session
static Handle(DE_Wrapper) THE_GLOBAL_CONFIGURATION;
}
//=======================================================================
@@ -41,6 +44,7 @@ namespace
// purpose :
//=======================================================================
DE_Wrapper::DE_Wrapper()
:myKeepUpdates(Standard_False)
{}
//=======================================================================
@@ -64,6 +68,7 @@ DE_Wrapper::DE_Wrapper(const Handle(DE_Wrapper)& theWrapper)
Bind(aVendorIter.Value());
}
}
theWrapper->myKeepUpdates = myKeepUpdates;
}
//=======================================================================
@@ -72,8 +77,23 @@ DE_Wrapper::DE_Wrapper(const Handle(DE_Wrapper)& theWrapper)
//=======================================================================
Handle(DE_Wrapper) DE_Wrapper::GlobalWrapper()
{
static const Handle(DE_Wrapper)& aConfiguration = new DE_Wrapper();
return aConfiguration;
if (THE_GLOBAL_CONFIGURATION.IsNull())
{
THE_GLOBAL_CONFIGURATION = new DE_Wrapper();
}
return THE_GLOBAL_CONFIGURATION;
}
//=======================================================================
// function : SetGlobalWrapper
// purpose :
//=======================================================================
void DE_Wrapper::SetGlobalWrapper(const Handle(DE_Wrapper)& theWrapper)
{
if (!theWrapper.IsNull())
{
THE_GLOBAL_CONFIGURATION = theWrapper;
}
}
//=======================================================================
@@ -81,7 +101,7 @@ Handle(DE_Wrapper) DE_Wrapper::GlobalWrapper()
// purpose :
//=======================================================================
Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
Handle(TDocStd_Document)& theDocument,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
@@ -94,7 +114,7 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
return Read(thePath, theDocument, theProgress);
}
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_True, aProvider))
if (!FindProvider(thePath, Standard_True, aProvider))
{
return Standard_False;
}
@@ -119,7 +139,7 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
return Write(thePath, theDocument, theProgress);
}
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_False, aProvider))
if (!FindProvider(thePath, Standard_False, aProvider))
{
return Standard_False;
}
@@ -131,7 +151,7 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
// purpose :
//=======================================================================
Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
Handle(TDocStd_Document)& theDocument,
const Handle(TDocStd_Document)& theDocument,
const Message_ProgressRange& theProgress)
{
if (theDocument.IsNull())
@@ -139,7 +159,7 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
return Standard_False;
}
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_True, aProvider))
if (!FindProvider(thePath, Standard_True, aProvider))
{
return Standard_False;
}
@@ -159,7 +179,7 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
return Standard_False;
}
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_False, aProvider))
if (!FindProvider(thePath, Standard_False, aProvider))
{
return Standard_False;
}
@@ -180,7 +200,7 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
return Read(thePath, theShape, theProgress);
}
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_True, aProvider))
if (!FindProvider(thePath, Standard_True, aProvider))
{
return Standard_False;
}
@@ -201,7 +221,7 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
return Write(thePath, theShape, theProgress);
}
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_False, aProvider))
if (!FindProvider(thePath, Standard_False, aProvider))
{
return Standard_False;
}
@@ -218,7 +238,7 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
{
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_True, aProvider))
if (!FindProvider(thePath, Standard_True, aProvider))
{
return Standard_False;
}
@@ -234,7 +254,7 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_False, aProvider))
if (!FindProvider(thePath, Standard_False, aProvider))
{
return Standard_False;
}
@@ -427,7 +447,6 @@ void DE_Wrapper::ChangePriority(const TCollection_AsciiString& theFormat,
if (aVendorMap.FindFromKey(aVendorName, aNode))
{
aNode->SetEnabled(Standard_True);
aNode->UpdateLoad();
aNewVendorMap.Add(aVendorName, aNode);
}
}
@@ -482,10 +501,10 @@ Handle(DE_Wrapper) DE_Wrapper::Copy() const
}
//=======================================================================
// function : findProvider
// function : FindProvider
// purpose :
//=======================================================================
Standard_Boolean DE_Wrapper::findProvider(const TCollection_AsciiString& thePath,
Standard_Boolean DE_Wrapper::FindProvider(const TCollection_AsciiString& thePath,
const Standard_Boolean theToImport,
Handle(DE_Provider)& theProvider) const
{
@@ -514,11 +533,11 @@ Standard_Boolean DE_Wrapper::findProvider(const TCollection_AsciiString& thePath
((theToImport && aNode->IsImportSupported()) ||
(!theToImport && aNode->IsExportSupported())) &&
(aNode->CheckExtension(anExtr) ||
(theToImport && aNode->CheckContent(aBuffer))))
(theToImport && aNode->CheckContent(aBuffer))) &&
aNode->UpdateLoad(theToImport, myKeepUpdates))
{
theProvider = aNode->BuildProvider();
aNode->GlobalParameters = GlobalParameters;
theProvider->SetNode(aNode);
return Standard_True;
}
}
@@ -526,6 +545,28 @@ Standard_Boolean DE_Wrapper::findProvider(const TCollection_AsciiString& thePath
return Standard_False;
}
//=======================================================================
// function : ReLoadNodes
// purpose :
//=======================================================================
Standard_EXPORT void DE_Wrapper::UpdateLoad(const Standard_Boolean theToForceUpdate) const
{
for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
aFormatIter.More(); aFormatIter.Next())
{
for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value());
aVendorIter.More(); aVendorIter.Next())
{
const Handle(DE_ConfigurationNode)& aNode = aVendorIter.Value();
aNode->UpdateLoad(Standard_True, Standard_True);
aNode->UpdateLoad(Standard_False, Standard_True);
if (!theToForceUpdate)
continue;
aNode->SetEnabled(aNode->IsExportSupported() || aNode->IsImportSupported());
}
}
}
//=======================================================================
// function : sort
// purpose :

View File

@@ -61,10 +61,15 @@ public:
//! @param[in] theWrapper object to copy
Standard_EXPORT DE_Wrapper(const Handle(DE_Wrapper)& theWrapper);
//! Gets global configuration singleton
//! Gets global configuration singleton.
//! If wrapper is not set, create it by default as base class object.
//! @return point to global configuration
Standard_EXPORT static Handle(DE_Wrapper) GlobalWrapper();
//! Sets global configuration singleton
//! @param[in] theWrapper object to set as global configuration
Standard_EXPORT static void SetGlobalWrapper(const Handle(DE_Wrapper)& theWrapper);
public:
//! Reads a CAD file, according internal configuration
@@ -74,7 +79,7 @@ public:
//! @param theProgress[in] progress indicator
//! @return true if Read operation has ended correctly
Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
Handle(TDocStd_Document)& theDocument,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -95,7 +100,7 @@ public:
//! @param theProgress[in] progress indicator
//! @return true if Read operation has ended correctly
Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
Handle(TDocStd_Document)& theDocument,
const Handle(TDocStd_Document)& theDocument,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Writes a CAD file, according internal configuration
@@ -211,13 +216,33 @@ public:
Standard_EXPORT void ChangePriority(const TColStd_ListOfAsciiString& theVendorPriority,
const Standard_Boolean theToDisable = Standard_False);
//! Find available provider from the configuration.
//! If there are several providers, choose the one with the highest priority.
//! @param[in] thePath path to the CAD file
//! @param[in] theToImport flag to finds for import. Standard_True-import, Standard_False-export
//! @param[out] theProvider created new provider
//! @return Standard_True if provider found and created
Standard_EXPORT virtual Standard_Boolean FindProvider(const TCollection_AsciiString& thePath,
const Standard_Boolean theToImport,
Handle(DE_Provider)& theProvider) const;
//! Updates all registered nodes, save all result.
//! @param[in] theToForceUpdate flag to turn on/of nodes according opportunity to transfer
Standard_EXPORT void UpdateLoad(const Standard_Boolean theToForceUpdate = Standard_False) const;
//! Gets flag to save updates operation while transfer checks
Standard_Boolean KeepUpdates() const { return myKeepUpdates; }
//! Sets flag to save updates operation while transfer checks
void SetKeepUpdates(const Standard_Boolean theToKeepUpdates) { myKeepUpdates = theToKeepUpdates; }
//! Gets format map, contains vendor map with nodes
//! @return internal map of formats
Standard_EXPORT const DE_ConfigurationFormatMap& Nodes() const;
//! Copies values of all fields
//! @return new object with the same field values
Standard_EXPORT Handle(DE_Wrapper) Copy() const;
Standard_EXPORT virtual Handle(DE_Wrapper) Copy() const;
protected:
@@ -227,22 +252,13 @@ protected:
//! @param[in] theResource resource to get priority
void sort(const Handle(DE_ConfigurationContext)& theResource);
//! Find available provider from the configuration.
//! If there are several providers, choose the one with the highest priority.
//! @param[in] thePath path to the CAD file
//! @param[in] theToImport flag to finds for import. Standard_True-import, Standard_False-export
//! @param[out] theProvider created new provider
//! @return Standard_True if provider found and created
Standard_Boolean findProvider(const TCollection_AsciiString& thePath,
const Standard_Boolean theToImport,
Handle(DE_Provider)& theProvider) const;
public:
DE_ConfigurationNode::DE_SectionGlobal GlobalParameters; //!< Internal parameters for the all translators
private:
Standard_Boolean myKeepUpdates; //!< Flag to save updates operation while transfer checks
DE_ConfigurationFormatMap myConfiguration; //!< Internal map of formats
};

View File

@@ -34,9 +34,7 @@ namespace
//=======================================================================
DEBRepCascade_ConfigurationNode::DEBRepCascade_ConfigurationNode() :
DE_ConfigurationNode()
{
UpdateLoad();
}
{}
//=======================================================================
// function : DEBRepCascade_ConfigurationNode
@@ -46,7 +44,6 @@ DEBRepCascade_ConfigurationNode::DEBRepCascade_ConfigurationNode(const Handle(DE
:DE_ConfigurationNode(theNode)
{
InternalParameters = theNode->InternalParameters;
UpdateLoad();
}
//=======================================================================

View File

@@ -34,9 +34,7 @@ namespace
//=======================================================================
DEXCAFCascade_ConfigurationNode::DEXCAFCascade_ConfigurationNode() :
DE_ConfigurationNode()
{
UpdateLoad();
}
{}
//=======================================================================
// function : DEXCAFCascade_ConfigurationNode
@@ -46,7 +44,6 @@ DEXCAFCascade_ConfigurationNode::DEXCAFCascade_ConfigurationNode(const Handle(DE
:DE_ConfigurationNode(theNode)
{
InternalParameters = theNode->InternalParameters;
UpdateLoad();
}
//=======================================================================
@@ -128,7 +125,7 @@ Handle(DE_ConfigurationNode) DEXCAFCascade_ConfigurationNode::Copy() const
//=======================================================================
Handle(DE_Provider) DEXCAFCascade_ConfigurationNode::BuildProvider()
{
return new DEXCAFCascade_Provider();
return new DEXCAFCascade_Provider (this);
}
//=======================================================================

View File

@@ -429,6 +429,8 @@ static Standard_Boolean ConicDefinition
term2 = -gdet/(cprim*pdet);
if (IsEllip) {
if (term1 <= eps || term2 <= eps)
return Standard_False;
Xax = cost;
Yax = sint;
Rmin = sqrt ( term1);
@@ -439,12 +441,16 @@ static Standard_Boolean ConicDefinition
}
}
else if (term1 <= eps){
if (-term1 <= eps || term2 <= eps)
return Standard_False;
Xax = -sint;
Yax = cost;
Rmin = sqrt (-term1);
Rmax = sqrt (term2);
}
else {
if (term1 <= eps || -term2 <= eps)
return Standard_False;
Xax = cost;
Yax = sint;
Rmin = sqrt (-term2);

View File

@@ -34,9 +34,7 @@ namespace
//=======================================================================
IGESCAFControl_ConfigurationNode::IGESCAFControl_ConfigurationNode() :
DE_ConfigurationNode()
{
UpdateLoad();
}
{}
//=======================================================================
// function : IGESCAFControl_ConfigurationNode
@@ -46,7 +44,6 @@ IGESCAFControl_ConfigurationNode::IGESCAFControl_ConfigurationNode(const Handle(
:DE_ConfigurationNode(theNode)
{
InternalParameters = theNode->InternalParameters;
UpdateLoad();
}
//=======================================================================

View File

@@ -33,9 +33,7 @@ namespace
//=======================================================================
RWGltf_ConfigurationNode::RWGltf_ConfigurationNode() :
DE_ConfigurationNode()
{
UpdateLoad();
}
{}
//=======================================================================
// function : RWGltf_ConfigurationNode
@@ -45,7 +43,6 @@ RWGltf_ConfigurationNode::RWGltf_ConfigurationNode(const Handle(RWGltf_Configura
:DE_ConfigurationNode(theNode)
{
InternalParameters = theNode->InternalParameters;
UpdateLoad();
}
//=======================================================================

View File

@@ -370,6 +370,16 @@ Standard_Boolean RWMesh_CafReader::addShapeIntoDoc (CafDocumentTools& theTools,
return Standard_False;
}
if (toMakeAssembly)
{
TDF_Label aRefLabel;
theTools.ShapeTool->GetReferredShape(aNewLabel, aRefLabel);
if (!aRefLabel.IsNull())
{
theTools.OriginalShapeMap.Bind(theShape, aRefLabel);
}
}
// if new label is a reference get referred shape
TDF_Label aNewRefLabel = aNewLabel;
theTools.ShapeTool->GetReferredShape (aNewLabel, aNewRefLabel);

View File

@@ -56,6 +56,7 @@ public:
Handle(XCAFDoc_ColorTool) ColorTool;
Handle(XCAFDoc_VisMaterialTool) VisMaterialTool;
NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher> ComponentMap;
NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher> OriginalShapeMap;
};
public:

View File

@@ -33,9 +33,7 @@ namespace
//=======================================================================
RWObj_ConfigurationNode::RWObj_ConfigurationNode() :
DE_ConfigurationNode()
{
UpdateLoad();
}
{}
//=======================================================================
// function : RWObj_ConfigurationNode
@@ -45,7 +43,6 @@ RWObj_ConfigurationNode::RWObj_ConfigurationNode(const Handle(RWObj_Configuratio
:DE_ConfigurationNode(theNode)
{
InternalParameters = theNode->InternalParameters;
UpdateLoad();
}
//=======================================================================

View File

@@ -27,9 +27,7 @@ static const TCollection_AsciiString THE_CONFIGURATION_SCOPE = "provider";
//=======================================================================
RWPly_ConfigurationNode::RWPly_ConfigurationNode() :
DE_ConfigurationNode()
{
UpdateLoad();
}
{}
//=======================================================================
// function : RWPly_ConfigurationNode
@@ -39,7 +37,6 @@ RWPly_ConfigurationNode::RWPly_ConfigurationNode(const Handle(RWPly_Configuratio
:DE_ConfigurationNode(theNode)
{
InternalParameters = theNode->InternalParameters;
UpdateLoad();
}
//=======================================================================

View File

@@ -34,9 +34,7 @@ namespace
//=======================================================================
RWStl_ConfigurationNode::RWStl_ConfigurationNode() :
DE_ConfigurationNode()
{
UpdateLoad();
}
{}
//=======================================================================
// function : STEPCAFControl_ConfigurationNode
@@ -46,7 +44,6 @@ RWStl_ConfigurationNode::RWStl_ConfigurationNode(const Handle(RWStl_Configuratio
:DE_ConfigurationNode(theNode)
{
InternalParameters = theNode->InternalParameters;
UpdateLoad();
}
//=======================================================================

View File

@@ -34,9 +34,7 @@ namespace
//=======================================================================
STEPCAFControl_ConfigurationNode::STEPCAFControl_ConfigurationNode() :
DE_ConfigurationNode()
{
UpdateLoad();
}
{}
//=======================================================================
// function : STEPCAFControl_ConfigurationNode
@@ -45,9 +43,7 @@ STEPCAFControl_ConfigurationNode::STEPCAFControl_ConfigurationNode() :
STEPCAFControl_ConfigurationNode::STEPCAFControl_ConfigurationNode(const Handle(STEPCAFControl_ConfigurationNode)& theNode)
:DE_ConfigurationNode(theNode),
InternalParameters(theNode->InternalParameters)
{
UpdateLoad();
}
{}
//=======================================================================
// function : Load

View File

@@ -18,6 +18,7 @@
// paralleling with Intel TBB
#ifdef HAVE_TBB
#pragma comment (lib, "tbbmalloc.lib")
#include <tbb/scalable_allocator.h>
using namespace tbb;
#else

View File

@@ -34,7 +34,7 @@
// Primary definitions
#define OCC_VERSION_MAJOR 7
#define OCC_VERSION_MINOR 8
#define OCC_VERSION_MINOR 7
#define OCC_VERSION_MAINTENANCE 0
//! This macro must be commented in official release, and set to non-empty
@@ -42,12 +42,12 @@
//! - "dev" for development version between releases
//! - "beta..." or "rc..." for beta releases or release candidates
//! - "project..." for version containing project-specific fixes
#define OCC_VERSION_DEVELOPMENT "dev"
//#define OCC_VERSION_DEVELOPMENT "dev"
// Derived (manually): version as real and string (major.minor)
#define OCC_VERSION 7.8
#define OCC_VERSION_STRING "7.8"
#define OCC_VERSION_COMPLETE "7.8.0"
#define OCC_VERSION 7.7
#define OCC_VERSION_STRING "7.7"
#define OCC_VERSION_COMPLETE "7.7.0"
//! Derived: extended version as string ("major.minor.maintenance.dev")
#ifdef OCC_VERSION_DEVELOPMENT

View File

@@ -9,6 +9,7 @@ TKShHealing
TKMesh
TKService
TKHLR
TKTopAlgo
CSF_TclLibs
CSF_TclTkLibs
CSF_XwLibs

View File

@@ -1,6 +1,7 @@
XCAFApp
XCAFAnimObjects
XCAFDimTolObjects
XCAFNoteObjects
XCAFDoc
XCAFPrs
XCAFView
XCAFView

View File

@@ -21,6 +21,7 @@
#include <algorithm>
#include <iostream>
#include <limits>
namespace
{

View File

@@ -33,9 +33,7 @@ namespace
//=======================================================================
Vrml_ConfigurationNode::Vrml_ConfigurationNode() :
DE_ConfigurationNode()
{
UpdateLoad();
}
{}
//=======================================================================
// function : STEPCAFControl_ConfigurationNode
@@ -45,7 +43,6 @@ Vrml_ConfigurationNode::Vrml_ConfigurationNode(const Handle(Vrml_ConfigurationNo
:DE_ConfigurationNode(theNode)
{
InternalParameters = theNode->InternalParameters;
UpdateLoad();
}
//=======================================================================

20
src/XCAFAnimObjects/FILES Normal file
View File

@@ -0,0 +1,20 @@
XCAFAnimObjects_AnimObject.cxx
XCAFAnimObjects_AnimObject.hxx
XCAFAnimObjects_CustomOperation.cxx
XCAFAnimObjects_CustomOperation.hxx
XCAFAnimObjects_InterpolationType.hxx
XCAFAnimObjects_Operation.cxx
XCAFAnimObjects_Operation.hxx
XCAFAnimObjects_OperationType.hxx
XCAFAnimObjects_Orient.cxx
XCAFAnimObjects_Orient.hxx
XCAFAnimObjects_Rotate.cxx
XCAFAnimObjects_Rotate.hxx
XCAFAnimObjects_Scale.cxx
XCAFAnimObjects_Scale.hxx
XCAFAnimObjects_Skew.cxx
XCAFAnimObjects_Skew.hxx
XCAFAnimObjects_Transform.cxx
XCAFAnimObjects_Transform.hxx
XCAFAnimObjects_Translate.cxx
XCAFAnimObjects_Translate.hxx

View File

@@ -0,0 +1,33 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <XCAFAnimObjects_AnimObject.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XCAFAnimObjects_AnimObject, Standard_Transient)
//=======================================================================
//function : XCAFAnimObjects_AnimObject
//purpose :
//=======================================================================
XCAFAnimObjects_AnimObject::XCAFAnimObjects_AnimObject() :
myInterpolationType(XCAFAnimObjects_InterpolationType_Step)
{}
//=======================================================================
//function : XCAFAnimObjects_AnimObject
//purpose :
//=======================================================================
XCAFAnimObjects_AnimObject::XCAFAnimObjects_AnimObject(const Handle(XCAFAnimObjects_AnimObject)& theObject) :
myInterpolationType(XCAFAnimObjects_InterpolationType_Step),
myOrderedOperations(theObject->myOrderedOperations)
{}

View File

@@ -0,0 +1,59 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XCAFAnimObjects_AnimObject_HeaderFile
#define _XCAFAnimObjects_AnimObject_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
#include <NCollection_List.hxx>
#include <XCAFAnimObjects_InterpolationType.hxx>
class XCAFAnimObjects_Operation;
//!
class XCAFAnimObjects_AnimObject : public Standard_Transient
{
public:
DEFINE_STANDARD_RTTIEXT(XCAFAnimObjects_AnimObject, Standard_Transient)
public:
//!
Standard_EXPORT XCAFAnimObjects_AnimObject();
//!
Standard_EXPORT XCAFAnimObjects_AnimObject(const Handle(XCAFAnimObjects_AnimObject)& theObject);
//!
void AppendNewOperation(const Handle(XCAFAnimObjects_Operation)& theOperation) { myOrderedOperations.Append(theOperation); }
//!
XCAFAnimObjects_InterpolationType GetInterpolationType() const { return myInterpolationType; }
//!
void SetInterpolationType(const XCAFAnimObjects_InterpolationType theType) { myInterpolationType = theType; }
//!
const NCollection_List<Handle(XCAFAnimObjects_Operation)>& GetOrderedOperations() const { return myOrderedOperations; }
//!
NCollection_List<Handle(XCAFAnimObjects_Operation)>& ChangeOrderedOperations() { return myOrderedOperations; }
private:
XCAFAnimObjects_InterpolationType myInterpolationType;
NCollection_List<Handle(XCAFAnimObjects_Operation)> myOrderedOperations;
};
#endif // _XCAFAnimObjects_AnimObject_HeaderFile

View File

@@ -0,0 +1,52 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include "XCAFAnimObjects_CustomOperation.hxx"
//=======================================================================
//function : XCAFAnimObjects_CustomOperation
//purpose :
//=======================================================================
XCAFAnimObjects_CustomOperation::XCAFAnimObjects_CustomOperation(const NCollection_Array1<double>& thePresentation,
const TCollection_AsciiString& theCustomTypeName) :
XCAFAnimObjects_Operation(false),
myTypeName(theCustomTypeName),
myPresentation(1, 1, thePresentation.Lower(), thePresentation.Upper())
{
for (int anInd = thePresentation.Lower(); anInd <= thePresentation.Upper(); anInd++)
{
myPresentation.SetValue(1, anInd, thePresentation.Value(anInd));
}
}
//=======================================================================
//function : XCAFAnimObjects_CustomOperation
//purpose :
//=======================================================================
XCAFAnimObjects_CustomOperation::XCAFAnimObjects_CustomOperation(const NCollection_Array2<double>& thePresentation,
const NCollection_Array1<double>& theTimeStamps,
const TCollection_AsciiString& theCustomTypeName) :
XCAFAnimObjects_Operation(theTimeStamps),
myTypeName(theCustomTypeName),
myPresentation(thePresentation)
{}
//=======================================================================
//function : XCAFAnimObjects_CustomOperation
//purpose :
//=======================================================================
XCAFAnimObjects_CustomOperation::XCAFAnimObjects_CustomOperation(const Handle(XCAFAnimObjects_CustomOperation)& theOperation) :
XCAFAnimObjects_Operation(theOperation),
myTypeName(theOperation->myTypeName),
myPresentation(theOperation->myPresentation)
{}

View File

@@ -0,0 +1,56 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XCAFAnimObjects_CustomOperation_HeaderFile
#define _XCAFAnimObjects_CustomOperation_HeaderFile
#include <XCAFAnimObjects_Operation.hxx>
#include <NCollection_Array2.hxx>
#include <TCollection_AsciiString.hxx>
//!
class XCAFAnimObjects_CustomOperation : public XCAFAnimObjects_Operation
{
public:
//!
Standard_EXPORT XCAFAnimObjects_CustomOperation(const NCollection_Array1<double>& thePresentation,
const TCollection_AsciiString& theCustomTypeName);
//!
Standard_EXPORT XCAFAnimObjects_CustomOperation(const NCollection_Array2<double>& thePresentation,
const NCollection_Array1<double>& theTimeStamps,
const TCollection_AsciiString& theCustomTypeName);
//!
Standard_EXPORT XCAFAnimObjects_CustomOperation(const Handle(XCAFAnimObjects_CustomOperation)& theOperation);
//!
XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Custom; }
//!
NCollection_Array2<double> GeneralPresentation() const Standard_OVERRIDE { return myPresentation; }
//!
TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return myTypeName; }
//!
const NCollection_Array2<double>& CustomPresentation() const { return myPresentation; }
private:
TCollection_AsciiString myTypeName; //!<
NCollection_Array2<double> myPresentation; //!<
};
#endif // _XCAFAnimObjects_CustomOperation_HeaderFile

View File

@@ -0,0 +1,27 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XCAFAnimObjects_InterpolationType_HeaderFile
#define _XCAFAnimObjects_InterpolationType_HeaderFile
//! Interpolation is a description of behavior between timestamps
enum XCAFAnimObjects_InterpolationType
{
XCAFAnimObjects_InterpolationType_Custom = 0, //!< User-defined interpolation
XCAFAnimObjects_InterpolationType_Step, //!< No interpolation, just apply timestamps step by step
XCAFAnimObjects_InterpolationType_Linear, //!< Linear dependency from t_(i) to t_(i+1)
XCAFAnimObjects_InterpolationType_CubicSpline, //!< Cubic dependency from t_(i) to t_(i+1)
XCAFAnimObjects_InterpolationType_Static //!< No animation in this time period, use the closest static value
};
#endif // _XCAFAnimObjects_InterpolationType_HeaderFile

View File

@@ -0,0 +1,43 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <XCAFAnimObjects_Operation.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XCAFAnimObjects_Operation, Standard_Transient)
//=======================================================================
//function : XCAFAnimObjects_Operation
//purpose :
//=======================================================================
XCAFAnimObjects_Operation::XCAFAnimObjects_Operation(const bool theIsInverse) :
myIsInverse(theIsInverse)
{}
//=======================================================================
//function : XCAFAnimObjects_Operation
//purpose :
//=======================================================================
XCAFAnimObjects_Operation::XCAFAnimObjects_Operation(const NCollection_Array1<double>& theTimeStamps,
const bool theIsInverse) :
myIsInverse(theIsInverse),
myTimeStamps(theTimeStamps)
{}
//=======================================================================
//function : XCAFAnimObjects_Operation
//purpose :
//=======================================================================
XCAFAnimObjects_Operation::XCAFAnimObjects_Operation(const Handle(XCAFAnimObjects_Operation)& theOperation) :
myIsInverse(theOperation->myIsInverse),
myTimeStamps(theOperation->myTimeStamps)
{}

View File

@@ -0,0 +1,67 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XCAFAnimObjects_Operation_HeaderFile
#define _XCAFAnimObjects_Operation_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
#include <NCollection_Array1.hxx>
#include <NCollection_Array2.hxx>
#include <TCollection_AsciiString.hxx>
#include <XCAFAnimObjects_OperationType.hxx>
//!
class XCAFAnimObjects_Operation : public Standard_Transient
{
public:
//!
Standard_EXPORT XCAFAnimObjects_Operation(const bool theIsInverse = false);
//!
Standard_EXPORT XCAFAnimObjects_Operation(const NCollection_Array1<double>& theTimeStamps,
const bool theIsInverse = false);
//!
Standard_EXPORT XCAFAnimObjects_Operation(const Handle(XCAFAnimObjects_Operation)& theOperation);
//!
const NCollection_Array1<double>& TimeStamps() const { return myTimeStamps; }
//!
bool HasTimeStamps() const { return !myTimeStamps.IsEmpty(); }
//!
Standard_EXPORT virtual XCAFAnimObjects_OperationType GetType() const = 0;
//!
Standard_EXPORT virtual TCollection_AsciiString GetTypeName() const = 0;
//!
bool IsInverse() const { return myIsInverse; }
//!
void SetInverse(const bool theIsInverse) { myIsInverse = theIsInverse; }
//!
Standard_EXPORT virtual NCollection_Array2<double> GeneralPresentation() const = 0;
DEFINE_STANDARD_RTTIEXT(XCAFAnimObjects_Operation, Standard_Transient)
private:
bool myIsInverse; //!
NCollection_Array1<double> myTimeStamps; //!<
};
#endif // _XCAFAnimObjects_Operation_HeaderFile

View File

@@ -0,0 +1,29 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XCAFAnimObjects_OperationType_HeaderFile
#define _XCAFAnimObjects_OperationType_HeaderFile
//!
enum XCAFAnimObjects_OperationType
{
XCAFAnimObjects_OperationType_Custom = 0, //!<
XCAFAnimObjects_OperationType_Orient, //!<
XCAFAnimObjects_OperationType_Rotate, //!<
XCAFAnimObjects_OperationType_Scale, //!<
XCAFAnimObjects_OperationType_Skew, //!<
XCAFAnimObjects_OperationType_Transform, //!<
XCAFAnimObjects_OperationType_Translate //!<
};
#endif // _XCAFAnimObjects_OperationType_HeaderFile

View File

@@ -0,0 +1,90 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <XCAFAnimObjects_Orient.hxx>
#include <Message.hxx>
//=======================================================================
//function : XCAFAnimObjects_Orient
//purpose :
//=======================================================================
XCAFAnimObjects_Orient::XCAFAnimObjects_Orient(const gp_Quaternion& theOrient) :
XCAFAnimObjects_Operation(false),
myOrientPresentation(1, 1)
{
myOrientPresentation.SetValue(1, theOrient);
}
//=======================================================================
//function : XCAFAnimObjects_Orient
//purpose :
//=======================================================================
XCAFAnimObjects_Orient::XCAFAnimObjects_Orient(const NCollection_Array1<gp_Quaternion>& theOrient,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
myOrientPresentation(theOrient)
{}
//=======================================================================
//function : XCAFAnimObjects_Orient
//purpose :
//=======================================================================
XCAFAnimObjects_Orient::XCAFAnimObjects_Orient(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
myOrientPresentation(1, theGeneralPresentation.NbRows())
{
if (theGeneralPresentation.NbColumns() != 4)
{
Message::SendWarning() << "Warning: XCAFAnimObjects_Orient: Incorrect Quaternion general presentation";
return;
}
for (int aRowInd = 1; aRowInd <= theGeneralPresentation.NbRows(); aRowInd++)
{
gp_Quaternion aQuat(theGeneralPresentation.Value(aRowInd, 1),
theGeneralPresentation.Value(aRowInd, 2),
theGeneralPresentation.Value(aRowInd, 3),
theGeneralPresentation.Value(aRowInd, 4));
myOrientPresentation.SetValue(aRowInd, aQuat);
}
}
//=======================================================================
//function : XCAFAnimObjects_Orient
//purpose :
//=======================================================================
XCAFAnimObjects_Orient::XCAFAnimObjects_Orient(const Handle(XCAFAnimObjects_Orient)& theOperation) :
XCAFAnimObjects_Operation(theOperation),
myOrientPresentation(theOperation->myOrientPresentation)
{}
//=======================================================================
//function : GeneralPresentation
//purpose :
//=======================================================================
NCollection_Array2<double> XCAFAnimObjects_Orient::GeneralPresentation() const
{
NCollection_Array2<double> aRes(1, myOrientPresentation.Length(), 1, 4);
for (int aRowInd = 1; aRowInd <= myOrientPresentation.Length(); aRowInd++)
{
const gp_Quaternion& aQuat = myOrientPresentation.Value(aRowInd);
aRes.SetValue(aRowInd, 1, aQuat.X());
aRes.SetValue(aRowInd, 2, aQuat.Y());
aRes.SetValue(aRowInd, 3, aQuat.Z());
aRes.SetValue(aRowInd, 4, aQuat.W());
}
return aRes;
}

View File

@@ -0,0 +1,56 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XCAFAnimObjects_Orient_HeaderFile
#define _XCAFAnimObjects_Orient_HeaderFile
#include <XCAFAnimObjects_Operation.hxx>
#include <gp_Quaternion.hxx>
//!
class XCAFAnimObjects_Orient : public XCAFAnimObjects_Operation
{
public:
//!
Standard_EXPORT XCAFAnimObjects_Orient(const gp_Quaternion& theOrient);
//!
Standard_EXPORT XCAFAnimObjects_Orient(const NCollection_Array1<gp_Quaternion>& theOrient,
const NCollection_Array1<double>& theTimeStamps);
//!
Standard_EXPORT XCAFAnimObjects_Orient(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps);
//!
Standard_EXPORT XCAFAnimObjects_Orient(const Handle(XCAFAnimObjects_Orient)& theOperation);
//!
XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Orient; }
//!
TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Orient"; }
//!
Standard_EXPORT NCollection_Array2<double> GeneralPresentation() const Standard_OVERRIDE;
//!
const NCollection_Array1<gp_Quaternion>& OrientPresentation() const { return myOrientPresentation; }
private:
NCollection_Array1<gp_Quaternion> myOrientPresentation; //!<
};
#endif // _XCAFAnimObjects_Orient_HeaderFile

View File

@@ -0,0 +1,86 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include "XCAFAnimObjects_Rotate.hxx"
#include <Message.hxx>
//=======================================================================
//function : XCAFAnimObjects_Rotate
//purpose :
//=======================================================================
XCAFAnimObjects_Rotate::XCAFAnimObjects_Rotate(const NCollection_Array1<double>& theRotate,
const NCollection_Array1<double>& theTimeStamps,
const XCAFAnimObjects_Rotate_Type theRotateType) :
XCAFAnimObjects_Operation(theTimeStamps),
myRotateType(theRotateType),
myRotatePresentation(1, 1, theRotate.Lower(), theRotate.Upper())
{
for (int anInd = theRotate.Lower(); anInd <= theRotate.Upper(); anInd++)
{
myRotatePresentation.SetValue(1, anInd, theRotate.Value(anInd));
}
Standard_Integer aNbDouble = 3;
if (theRotateType >= XCAFAnimObjects_Rotate_Type_XY &&
theRotateType <= XCAFAnimObjects_Rotate_Type_ZY)
{
aNbDouble = 2;
}
if (theRotateType >= XCAFAnimObjects_Rotate_Type_X &&
theRotateType <= XCAFAnimObjects_Rotate_Type_Z)
{
aNbDouble = 1;
}
if (theRotate.Length() != aNbDouble)
{
Message::SendWarning() << "Warning: XCAFAnimObjects_Rotate: Incorrect Rotate presentation";
}
}
//=======================================================================
//function : XCAFAnimObjects_Rotate
//purpose :
//=======================================================================
XCAFAnimObjects_Rotate::XCAFAnimObjects_Rotate(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps,
const XCAFAnimObjects_Rotate_Type theRotateType) :
XCAFAnimObjects_Operation(theTimeStamps),
myRotateType(theRotateType),
myRotatePresentation(theGeneralPresentation)
{
Standard_Integer aNbDouble = 3;
if (theRotateType >= XCAFAnimObjects_Rotate_Type_XY &&
theRotateType <= XCAFAnimObjects_Rotate_Type_ZY)
{
aNbDouble = 2;
}
if (theRotateType >= XCAFAnimObjects_Rotate_Type_X &&
theRotateType <= XCAFAnimObjects_Rotate_Type_Z)
{
aNbDouble = 1;
}
if (theGeneralPresentation.NbColumns() != aNbDouble)
{
Message::SendWarning() << "Warning: XCAFAnimObjects_Rotate: Incorrect Rotate presentation";
}
}
//=======================================================================
//function : XCAFAnimObjects_Rotate
//purpose :
//=======================================================================
XCAFAnimObjects_Rotate::XCAFAnimObjects_Rotate(const Handle(XCAFAnimObjects_Rotate)& theOperation) :
XCAFAnimObjects_Operation(theOperation),
myRotateType(theOperation->myRotateType),
myRotatePresentation(theOperation->myRotatePresentation)
{}

View File

@@ -0,0 +1,84 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XCAFAnimObjects_Rotate_HeaderFile
#define _XCAFAnimObjects_Rotate_HeaderFile
#include <XCAFAnimObjects_Operation.hxx>
#include <gp_Quaternion.hxx>
//!
class XCAFAnimObjects_Rotate : public XCAFAnimObjects_Operation
{
public:
//!
enum XCAFAnimObjects_Rotate_Type
{
XCAFAnimObjects_Rotate_Type_XYZ = 0,
XCAFAnimObjects_Rotate_Type_XZY,
XCAFAnimObjects_Rotate_Type_YZX,
XCAFAnimObjects_Rotate_Type_YXZ,
XCAFAnimObjects_Rotate_Type_ZXY,
XCAFAnimObjects_Rotate_Type_ZYX,
XCAFAnimObjects_Rotate_Type_XY,
XCAFAnimObjects_Rotate_Type_XZ,
XCAFAnimObjects_Rotate_Type_YX,
XCAFAnimObjects_Rotate_Type_YZ,
XCAFAnimObjects_Rotate_Type_ZX,
XCAFAnimObjects_Rotate_Type_ZY,
XCAFAnimObjects_Rotate_Type_X,
XCAFAnimObjects_Rotate_Type_Y,
XCAFAnimObjects_Rotate_Type_Z
};
public:
//!
Standard_EXPORT XCAFAnimObjects_Rotate(const NCollection_Array1<double>& theRotate,
const NCollection_Array1<double>& theTimeStamps,
const XCAFAnimObjects_Rotate_Type theRotateType = XCAFAnimObjects_Rotate_Type_XYZ);
//!
Standard_EXPORT XCAFAnimObjects_Rotate(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps,
const XCAFAnimObjects_Rotate_Type theRotateType = XCAFAnimObjects_Rotate_Type_XYZ);
//!
Standard_EXPORT XCAFAnimObjects_Rotate(const Handle(XCAFAnimObjects_Rotate)& theOperation);
//!
XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Rotate; }
//!
XCAFAnimObjects_Rotate_Type GetRotateType() const { return myRotateType; }
//!
void SetRotateType(const XCAFAnimObjects_Rotate_Type theRotateType) { myRotateType = theRotateType; }
//!
TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Rotate"; }
//!
NCollection_Array2<double> GeneralPresentation() const { return myRotatePresentation; }
//!
const NCollection_Array2<double>& RotatePresentation() const { return myRotatePresentation; }
private:
XCAFAnimObjects_Rotate_Type myRotateType; //!<
NCollection_Array2<double> myRotatePresentation; //!<
};
#endif // _XCAFAnimObjects_Rotate_HeaderFile

View File

@@ -0,0 +1,87 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include "XCAFAnimObjects_Scale.hxx"
#include <Message.hxx>
//=======================================================================
//function : XCAFAnimObjects_Scale
//purpose :
//=======================================================================
XCAFAnimObjects_Scale::XCAFAnimObjects_Scale(const gp_XYZ& theScale) :
XCAFAnimObjects_Operation(false),
myScalePresentation(1, 1)
{
myScalePresentation.SetValue(1, theScale);
}
//=======================================================================
//function : XCAFAnimObjects_Scale
//purpose :
//=======================================================================
XCAFAnimObjects_Scale::XCAFAnimObjects_Scale(const NCollection_Array1<gp_XYZ>& theScale,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
myScalePresentation(theScale)
{}
//=======================================================================
//function : XCAFAnimObjects_Scale
//purpose :
//=======================================================================
XCAFAnimObjects_Scale::XCAFAnimObjects_Scale(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
myScalePresentation(1, theGeneralPresentation.NbRows())
{
if (theGeneralPresentation.NbColumns() != 3)
{
Message::SendWarning() << "Warning: XCAFAnimObjects_Scale: Incorrect XYZ general presentation";
return;
}
for (int aRowInd = 1; aRowInd <= theGeneralPresentation.NbRows(); aRowInd++)
{
gp_XYZ aXYZ(theGeneralPresentation.Value(aRowInd, 1),
theGeneralPresentation.Value(aRowInd, 2),
theGeneralPresentation.Value(aRowInd, 3));
myScalePresentation.SetValue(aRowInd, aXYZ);
}
}
//=======================================================================
//function : XCAFAnimObjects_Scale
//purpose :
//=======================================================================
XCAFAnimObjects_Scale::XCAFAnimObjects_Scale(const Handle(XCAFAnimObjects_Scale)& theOperation) :
XCAFAnimObjects_Operation(theOperation),
myScalePresentation(theOperation->myScalePresentation)
{}
//=======================================================================
//function : GeneralPresentation
//purpose :
//=======================================================================
NCollection_Array2<double> XCAFAnimObjects_Scale::GeneralPresentation() const
{
NCollection_Array2<double> aRes(1, myScalePresentation.Length(), 1, 3);
for (int aRowInd = 1; aRowInd <= myScalePresentation.Length(); aRowInd++)
{
const gp_XYZ& aXYZ = myScalePresentation.Value(aRowInd);
aRes.SetValue(aRowInd, 1, aXYZ.X());
aRes.SetValue(aRowInd, 2, aXYZ.Y());
aRes.SetValue(aRowInd, 3, aXYZ.Z());
}
return aRes;
}

View File

@@ -0,0 +1,56 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XCAFAnimObjects_Scale_HeaderFile
#define _XCAFAnimObjects_Scale_HeaderFile
#include <XCAFAnimObjects_Operation.hxx>
#include <gp_XYZ.hxx>
//!
class XCAFAnimObjects_Scale : public XCAFAnimObjects_Operation
{
public:
//!
Standard_EXPORT XCAFAnimObjects_Scale(const gp_XYZ& theScale);
//!
Standard_EXPORT XCAFAnimObjects_Scale(const NCollection_Array1<gp_XYZ>& theScale,
const NCollection_Array1<double>& theTimeStamps);
//!
Standard_EXPORT XCAFAnimObjects_Scale(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps);
//!
Standard_EXPORT XCAFAnimObjects_Scale(const Handle(XCAFAnimObjects_Scale)& theOperation);
//!
XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Scale; }
//!
TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Scale"; }
//!
Standard_EXPORT NCollection_Array2<double> GeneralPresentation() const Standard_OVERRIDE;
//!
const NCollection_Array1<gp_XYZ>& ScalePresentation() const { return myScalePresentation; }
private:
NCollection_Array1<gp_XYZ> myScalePresentation; //!<
};
#endif // _XCAFAnimObjects_Scale_HeaderFile

View File

@@ -0,0 +1,87 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include "XCAFAnimObjects_Skew.hxx"
#include <Message.hxx>
//=======================================================================
//function : XCAFAnimObjects_Skew
//purpose :
//=======================================================================
XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const gp_XYZ& theSkew) :
XCAFAnimObjects_Operation(false),
mySkewPresentation(1, 1)
{
mySkewPresentation.SetValue(1, theSkew);
}
//=======================================================================
//function : XCAFAnimObjects_Skew
//purpose :
//=======================================================================
XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const NCollection_Array1<gp_XYZ>& theSkew,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
mySkewPresentation(theSkew)
{}
//=======================================================================
//function : XCAFAnimObjects_Skew
//purpose :
//=======================================================================
XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
mySkewPresentation(1, theGeneralPresentation.NbRows())
{
if (theGeneralPresentation.NbColumns() != 3)
{
Message::SendWarning() << "Warning: XCAFAnimObjects_Skew: Incorrect Skew general presentation";
return;
}
for (int aRowInd = 1; aRowInd <= theGeneralPresentation.NbRows(); aRowInd++)
{
gp_XYZ aSkew(theGeneralPresentation.Value(aRowInd, 1),
theGeneralPresentation.Value(aRowInd, 2),
theGeneralPresentation.Value(aRowInd, 3));
mySkewPresentation.SetValue(aRowInd, aSkew);
}
}
//=======================================================================
//function : XCAFAnimObjects_Skew
//purpose :
//=======================================================================
XCAFAnimObjects_Skew::XCAFAnimObjects_Skew(const Handle(XCAFAnimObjects_Skew)& theOperation) :
XCAFAnimObjects_Operation(theOperation),
mySkewPresentation(theOperation->mySkewPresentation)
{}
//=======================================================================
//function : GeneralPresentation
//purpose :
//=======================================================================
NCollection_Array2<double> XCAFAnimObjects_Skew::GeneralPresentation() const
{
NCollection_Array2<double> aRes(1, mySkewPresentation.Length(), 1, 3);
for (int aRowInd = 1; aRowInd <= mySkewPresentation.Length(); aRowInd++)
{
const gp_XYZ& aSkew = mySkewPresentation.Value(aRowInd);
aRes.SetValue(aRowInd, 1, aSkew.X());
aRes.SetValue(aRowInd, 2, aSkew.Y());
aRes.SetValue(aRowInd, 3, aSkew.Z());
}
return aRes;
}

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XCAFAnimObjects_Skew_HeaderFile
#define _XCAFAnimObjects_Skew_HeaderFile
#include <XCAFAnimObjects_Operation.hxx>
#include <gp_XYZ.hxx>
//!
class XCAFAnimObjects_Skew : public XCAFAnimObjects_Operation
{
public:
//!
Standard_EXPORT XCAFAnimObjects_Skew(const gp_XYZ& theSkew);
//!
Standard_EXPORT XCAFAnimObjects_Skew(const NCollection_Array1<gp_XYZ>& theSkew,
const NCollection_Array1<double>& theTimeStamps);
//!
Standard_EXPORT XCAFAnimObjects_Skew(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps);
//!
Standard_EXPORT XCAFAnimObjects_Skew(const Handle(XCAFAnimObjects_Skew)& theOperation);
//!
XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Skew; }
//!
TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Skew"; }
//!
Standard_EXPORT NCollection_Array2<double> GeneralPresentation() const Standard_OVERRIDE;
//!
const NCollection_Array1<gp_XYZ>& SkewPresentation() const { return mySkewPresentation; }
private:
NCollection_Array1<gp_XYZ> mySkewPresentation; //!<
};
#endif // _XCAFAnimObjects_Skew_HeaderFile

View File

@@ -0,0 +1,114 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include "XCAFAnimObjects_Transform.hxx"
#include <Message.hxx>
//=======================================================================
//function : XCAFAnimObjects_Transform
//purpose :
//=======================================================================
XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const NCollection_Mat4<double>& theTransform) :
XCAFAnimObjects_Operation(false),
myTransformPresentation(1, 1)
{
myTransformPresentation.SetValue(1, theTransform);
}
//=======================================================================
//function : XCAFAnimObjects_Transform
//purpose :
//=======================================================================
XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const NCollection_Array1<NCollection_Mat4<double>>& theTransform,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
myTransformPresentation(theTransform)
{}
//=======================================================================
//function : XCAFAnimObjects_Transform
//purpose :
//=======================================================================
XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
myTransformPresentation(1, theGeneralPresentation.NbRows())
{
if (theGeneralPresentation.NbColumns() != 16)
{
Message::SendWarning() << "Warning: XCAFAnimObjects_Transform: Incorrect Mat4x4 general presentation";
return;
}
for (int aRowInd = 1; aRowInd <= theGeneralPresentation.NbRows(); aRowInd++)
{
NCollection_Mat4<double> aTransform;
aTransform.SetRow(0, NCollection_Vec4<double>(theGeneralPresentation.Value(aRowInd, 1),
theGeneralPresentation.Value(aRowInd, 2),
theGeneralPresentation.Value(aRowInd, 3),
theGeneralPresentation.Value(aRowInd, 4)));
aTransform.SetRow(1, NCollection_Vec4<double>(theGeneralPresentation.Value(aRowInd, 5),
theGeneralPresentation.Value(aRowInd, 6),
theGeneralPresentation.Value(aRowInd, 7),
theGeneralPresentation.Value(aRowInd, 8)));
aTransform.SetRow(2, NCollection_Vec4<double>(theGeneralPresentation.Value(aRowInd, 9),
theGeneralPresentation.Value(aRowInd, 10),
theGeneralPresentation.Value(aRowInd, 11),
theGeneralPresentation.Value(aRowInd, 12)));
aTransform.SetRow(3, NCollection_Vec4<double>(theGeneralPresentation.Value(aRowInd, 13),
theGeneralPresentation.Value(aRowInd, 14),
theGeneralPresentation.Value(aRowInd, 15),
theGeneralPresentation.Value(aRowInd, 16)));
myTransformPresentation.SetValue(aRowInd, aTransform);
}
}
//=======================================================================
//function : XCAFAnimObjects_Transform
//purpose :
//=======================================================================
XCAFAnimObjects_Transform::XCAFAnimObjects_Transform(const Handle(XCAFAnimObjects_Transform)& theOperation) :
XCAFAnimObjects_Operation(theOperation),
myTransformPresentation(theOperation->myTransformPresentation)
{}
//=======================================================================
//function : GeneralPresentation
//purpose :
//=======================================================================
NCollection_Array2<double> XCAFAnimObjects_Transform::GeneralPresentation() const
{
NCollection_Array2<double> aRes(1, myTransformPresentation.Length(), 1, 16);
for (int aRowInd = 1; aRowInd <= myTransformPresentation.Length(); aRowInd++)
{
const NCollection_Mat4<double>& aTransform = myTransformPresentation.Value(aRowInd);
aRes.SetValue(aRowInd, 1, aTransform.GetValue(0, 0));
aRes.SetValue(aRowInd, 2, aTransform.GetValue(0, 1));
aRes.SetValue(aRowInd, 3, aTransform.GetValue(0, 2));
aRes.SetValue(aRowInd, 4, aTransform.GetValue(0, 3));
aRes.SetValue(aRowInd, 5, aTransform.GetValue(1, 0));
aRes.SetValue(aRowInd, 6, aTransform.GetValue(1, 1));
aRes.SetValue(aRowInd, 7, aTransform.GetValue(1, 2));
aRes.SetValue(aRowInd, 8, aTransform.GetValue(1, 3));
aRes.SetValue(aRowInd, 9, aTransform.GetValue(2, 0));
aRes.SetValue(aRowInd, 10, aTransform.GetValue(2, 1));
aRes.SetValue(aRowInd, 11, aTransform.GetValue(2, 2));
aRes.SetValue(aRowInd, 12, aTransform.GetValue(2, 3));
aRes.SetValue(aRowInd, 13, aTransform.GetValue(3, 0));
aRes.SetValue(aRowInd, 14, aTransform.GetValue(3, 1));
aRes.SetValue(aRowInd, 15, aTransform.GetValue(3, 2));
aRes.SetValue(aRowInd, 16, aTransform.GetValue(3, 3));
}
return aRes;
}

View File

@@ -0,0 +1,56 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XCAFAnimObjects_Transform_HeaderFile
#define _XCAFAnimObjects_Transform_HeaderFile
#include <XCAFAnimObjects_Operation.hxx>
#include <NCollection_Mat4.hxx>
//!
class XCAFAnimObjects_Transform : public XCAFAnimObjects_Operation
{
public:
//!
Standard_EXPORT XCAFAnimObjects_Transform(const NCollection_Mat4<double>& theTransform);
//!
Standard_EXPORT XCAFAnimObjects_Transform(const NCollection_Array1<NCollection_Mat4<double>>& theTransform,
const NCollection_Array1<double>& theTimeStamps);
//!
Standard_EXPORT XCAFAnimObjects_Transform(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps);
//!
Standard_EXPORT XCAFAnimObjects_Transform(const Handle(XCAFAnimObjects_Transform)& theOperation);
//!
XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Transform; }
//!
TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Transform"; }
//!
Standard_EXPORT NCollection_Array2<double> GeneralPresentation() const Standard_OVERRIDE;
//!
const NCollection_Array1<NCollection_Mat4<double>>& TransformPresentation() const { return myTransformPresentation; }
private:
NCollection_Array1<NCollection_Mat4<double>> myTransformPresentation; //!<
};
#endif // _XCAFAnimObjects_Transform_HeaderFile

View File

@@ -0,0 +1,88 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include "XCAFAnimObjects_Translate.hxx"
#include <Message.hxx>
//=======================================================================
//function : XCAFAnimObjects_Translate
//purpose :
//=======================================================================
XCAFAnimObjects_Translate::XCAFAnimObjects_Translate(const gp_XYZ& theTranslate) :
XCAFAnimObjects_Operation(false),
myTranslatePresentation(1, 1)
{
myTranslatePresentation.SetValue(1, theTranslate);
}
//=======================================================================
//function : XCAFAnimObjects_Translate
//purpose :
//=======================================================================
XCAFAnimObjects_Translate::XCAFAnimObjects_Translate(const NCollection_Array1<gp_XYZ>& theTranslate,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
myTranslatePresentation(theTranslate)
{}
//=======================================================================
//function : XCAFAnimObjects_Translate
//purpose :
//=======================================================================
XCAFAnimObjects_Translate::XCAFAnimObjects_Translate(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps) :
XCAFAnimObjects_Operation(theTimeStamps),
myTranslatePresentation(1, theGeneralPresentation.NbRows())
{
if (theGeneralPresentation.NbColumns() != 3)
{
Message::SendWarning() << "Warning: XCAFAnimObjects_Translate: Incorrect XYZ general presentation";
return;
}
for (int aRowInd = 1; aRowInd <= theGeneralPresentation.NbRows(); aRowInd++)
{
gp_XYZ aXYZ(theGeneralPresentation.Value(aRowInd, 1),
theGeneralPresentation.Value(aRowInd, 2),
theGeneralPresentation.Value(aRowInd, 3));
myTranslatePresentation.SetValue(aRowInd, aXYZ);
}
}
//=======================================================================
//function : XCAFAnimObjects_Translate
//purpose :
//=======================================================================
XCAFAnimObjects_Translate::XCAFAnimObjects_Translate(const Handle(XCAFAnimObjects_Translate)& theOperation) :
XCAFAnimObjects_Operation(theOperation),
myTranslatePresentation(theOperation->myTranslatePresentation)
{}
//=======================================================================
//function : GeneralPresentation
//purpose :
//=======================================================================
NCollection_Array2<double> XCAFAnimObjects_Translate::GeneralPresentation() const
{
NCollection_Array2<double> aRes(1, myTranslatePresentation.Length(), 1, 3);
for (int aRowInd = 1; aRowInd <= myTranslatePresentation.Length(); aRowInd++)
{
const gp_XYZ& aXYZ = myTranslatePresentation.Value(aRowInd);
aRes.SetValue(aRowInd, 1, aXYZ.X());
aRes.SetValue(aRowInd, 2, aXYZ.Y());
aRes.SetValue(aRowInd, 3, aXYZ.Z());
}
return aRes;
}

View File

@@ -0,0 +1,56 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XCAFAnimObjects_Translate_HeaderFile
#define _XCAFAnimObjects_Translate_HeaderFile
#include <XCAFAnimObjects_Operation.hxx>
#include <gp_XYZ.hxx>
//!
class XCAFAnimObjects_Translate : public XCAFAnimObjects_Operation
{
public:
//!
Standard_EXPORT XCAFAnimObjects_Translate(const gp_XYZ& theTranslate);
//!
Standard_EXPORT XCAFAnimObjects_Translate(const NCollection_Array1<gp_XYZ>& theTranslate,
const NCollection_Array1<double>& theTimeStamps);
//!
Standard_EXPORT XCAFAnimObjects_Translate(const NCollection_Array2<double>& theGeneralPresentation,
const NCollection_Array1<double>& theTimeStamps);
//!
Standard_EXPORT XCAFAnimObjects_Translate(const Handle(XCAFAnimObjects_Translate)& theOperation);
//!
XCAFAnimObjects_OperationType GetType() const Standard_OVERRIDE { return XCAFAnimObjects_OperationType_Translate; }
//!
TCollection_AsciiString GetTypeName() const Standard_OVERRIDE { return "Translate"; }
//!
Standard_EXPORT NCollection_Array2<double> GeneralPresentation() const Standard_OVERRIDE;
//!
const NCollection_Array1<gp_XYZ>& TranslatePresentation() const { return myTranslatePresentation; }
private:
NCollection_Array1<gp_XYZ> myTranslatePresentation; //!<
};
#endif // _XCAFAnimObjects_Translate_HeaderFile

View File

@@ -2,6 +2,10 @@ FILES
GUID.txt
XCAFDoc.cxx
XCAFDoc.hxx
XCAFDoc_Animation.cxx
XCAFDoc_Animation.hxx
XCAFDoc_AnimationTool.cxx
XCAFDoc_AnimationTool.hxx
XCAFDoc_AssemblyItemId.cxx
XCAFDoc_AssemblyItemId.hxx
XCAFDoc_AssemblyItemRef.cxx

View File

@@ -322,6 +322,16 @@ const Standard_GUID& XCAFDoc::LockGUID()
return ID;
}
//=======================================================================
//function : AnimRefShapeGUID
//purpose :
//=======================================================================
const Standard_GUID& XCAFDoc::AnimRefShapeGUID()
{
static const Standard_GUID ID("0BE692B6-2E38-4FDC-A349-27615CF8784F");
return ID;
}
//=======================================================================
//function : AttributeInfo
//purpose :

View File

@@ -114,6 +114,9 @@ public:
//! Returns GUID for UAttribute identifying lock flag
Standard_EXPORT static const Standard_GUID& LockGUID();
//! Return GUIDs for TreeNode representing connections Animation-Shape
Standard_EXPORT static const Standard_GUID& AnimRefShapeGUID();
//! Prints attribute information into a string.
//! @param theAtt an XDE attribute
//! @return the generated info value

View File

@@ -0,0 +1,450 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <XCAFDoc_Animation.hxx>
#include <Standard_GUID.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TDataStd_Integer.hxx>
#include <TDataStd_IntegerArray.hxx>
#include <TDataStd_Name.hxx>
#include <TDataStd_RealArray.hxx>
#include <TDataStd_UAttribute.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_Label.hxx>
#include <XCAFAnimObjects_AnimObject.hxx>
#include <XCAFAnimObjects_CustomOperation.hxx>
#include <XCAFAnimObjects_Orient.hxx>
#include <XCAFAnimObjects_Rotate.hxx>
#include <XCAFAnimObjects_Scale.hxx>
#include <XCAFAnimObjects_Skew.hxx>
#include <XCAFAnimObjects_Transform.hxx>
#include <XCAFAnimObjects_Translate.hxx>
IMPLEMENT_DERIVED_ATTRIBUTE(XCAFDoc_Animation, TDataStd_GenericEmpty)
namespace
{
//=======================================================================
//function : AnimRotateRefGUID
//purpose :
//=======================================================================
const Standard_GUID& AnimRotateRefGUID()
{
static const Standard_GUID ID("09135874-3B7E-4379-8BDB-E781422B8DD7");
return ID;
}
//=======================================================================
//function : AnimCustomRefGUID
//purpose :
//=======================================================================
const Standard_GUID& AnimCustomRefGUID()
{
static const Standard_GUID ID("1D0BC396-328D-45CC-B968-FD58DB7109A0");
return ID;
}
//=======================================================================
//function : AnimOrientRefGUID
//purpose :
//=======================================================================
const Standard_GUID& AnimOrientRefGUID()
{
static const Standard_GUID ID("F601BE38-D3F8-4594-90C8-04B790ACD08A");
return ID;
}
//=======================================================================
//function : AnimScaleRefGUID
//purpose :
//=======================================================================
const Standard_GUID& AnimScaleRefGUID()
{
static const Standard_GUID ID("40602308-A430-4912-A480-66DF8788338B");
return ID;
}
//=======================================================================
//function : AnimSkewRefGUID
//purpose :
//=======================================================================
const Standard_GUID& AnimSkewRefGUID()
{
static const Standard_GUID ID("9A260C95-B2D6-472D-AEB4-D802C7528FEE");
return ID;
}
//=======================================================================
//function : AnimTransformRefGUID
//purpose :
//=======================================================================
const Standard_GUID& AnimTransformRefGUID()
{
static const Standard_GUID ID("F26898A6-C7A8-4FC8-B328-4B442F935E7A");
return ID;
}
//=======================================================================
//function : AnimTranslateRefGUID
//purpose :
//=======================================================================
const Standard_GUID& AnimTranslateRefGUID()
{
static const Standard_GUID ID("A8777A51-B13E-417A-82A0-6176246DD441");
return ID;
}
//=======================================================================
//function : AnimInterpolationRefGUID
//purpose :
//=======================================================================
const Standard_GUID& AnimInterpolationRefGUID()
{
static const Standard_GUID ID("4C565EBB-70C2-4934-B451-0B45C3460412");
return ID;
}
//=======================================================================
//function : AnimInvertRefGUID
//purpose :
//=======================================================================
const Standard_GUID& AnimInvertRefGUID()
{
static const Standard_GUID ID("7898D79A-6CCE-434C-A494-A37FC1931CC2");
return ID;
}
//=======================================================================
//function : AnimInvertRefGUID
//purpose :
//=======================================================================
const Standard_GUID& AnimValuesDimensionGUID()
{
static const Standard_GUID ID("95CBDC47-5A79-4229-9851-B6F04EAEE482");
return ID;
}
//=======================================================================
//function : AnimValuesGUID
//purpose :
//=======================================================================
const Standard_GUID& AnimValuesGUID()
{
static const Standard_GUID ID("C3CDFA73-1C9B-4674-BCAA-D1B7038AFE86");
return ID;
}
//=======================================================================
//function : AnimValuesGUID
//purpose :
//=======================================================================
const Standard_GUID& AnimTimeStampsValuesGUID()
{
static const Standard_GUID ID("AAF6F1A2-F764-4A4B-8984-BF7CF09B7646");
return ID;
}
//=======================================================================
//function : AnimValuesGUID
//purpose :
//=======================================================================
const Standard_GUID& AnimRotateSubTypeGUID()
{
static const Standard_GUID ID("A1E22D67-CD3E-4F8D-BD75-1DF04EF45266");
return ID;
}
}
//=======================================================================
//function : XCAFDoc_Animation
//purpose :
//=======================================================================
XCAFDoc_Animation::XCAFDoc_Animation()
{}
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
const Standard_GUID& XCAFDoc_Animation::GetID()
{
static Standard_GUID DGTID("D755686B-872E-421E-8871-E98BE8051644");
return DGTID;
}
//=======================================================================
//function : Set
//purpose :
//=======================================================================
Handle(XCAFDoc_Animation) XCAFDoc_Animation::Set(const TDF_Label& theLabel)
{
Handle(XCAFDoc_Animation) anAnimAttr;
if (!theLabel.FindAttribute(XCAFDoc_Animation::GetID(), anAnimAttr)) {
anAnimAttr = new XCAFDoc_Animation();
theLabel.AddAttribute(anAnimAttr);
}
return anAnimAttr;
}
//=======================================================================
//function : SetObject
//purpose :
//=======================================================================
void XCAFDoc_Animation::SetObject(const Handle(XCAFAnimObjects_AnimObject)& theObject)
{
Backup();
// Setting name
const static TCollection_ExtendedString anObjName("Animation");
TDataStd_Name::Set(Label(), anObjName);
// Setting Interpolation type
TDataStd_Integer::Set(Label(), AnimInterpolationRefGUID(), theObject->GetInterpolationType());
Standard_Integer anOperInd = 1;
// Setting ordered operations
for (NCollection_List<Handle(XCAFAnimObjects_Operation)>::Iterator anIter(theObject->GetOrderedOperations());
anIter.More(); anIter.Next(), anOperInd++)
{
const TDF_Label aChild = Label().FindChild(anOperInd, true);
aChild.ForgetAllAttributes(); // Clear old values
const Handle(XCAFAnimObjects_Operation)& anOperation = anIter.Value();
// Setting inverse flag
if (anOperation->IsInverse())
{
TDataStd_UAttribute::Set(aChild, AnimInvertRefGUID());
}
// Setting operation type and name
TDataStd_Name::Set(aChild, anOperation->GetTypeName());
switch (anOperation->GetType())
{
case XCAFAnimObjects_OperationType_Custom:
TDataStd_UAttribute::Set(aChild, AnimCustomRefGUID());
break;
case XCAFAnimObjects_OperationType_Orient:
TDataStd_UAttribute::Set(aChild, AnimOrientRefGUID());
break;
case XCAFAnimObjects_OperationType_Rotate:
{
TDataStd_UAttribute::Set(aChild, AnimRotateRefGUID());
const Handle(XCAFAnimObjects_Rotate) aRotate = Handle(XCAFAnimObjects_Rotate)::DownCast(anOperation);
TDataStd_Integer::Set(aChild, AnimRotateSubTypeGUID(), aRotate->GetRotateType());
break;
}
case XCAFAnimObjects_OperationType_Scale:
TDataStd_UAttribute::Set(aChild, AnimScaleRefGUID());
break;
case XCAFAnimObjects_OperationType_Skew:
TDataStd_UAttribute::Set(aChild, AnimSkewRefGUID());
break;
case XCAFAnimObjects_OperationType_Transform:
TDataStd_UAttribute::Set(aChild, AnimTransformRefGUID());
break;
case XCAFAnimObjects_OperationType_Translate:
TDataStd_UAttribute::Set(aChild, AnimTranslateRefGUID());
break;
}
// Setting operation values
const NCollection_Array2<double> anOperPresentation = anOperation->GeneralPresentation();
Handle(TDataStd_IntegerArray) aDimArr = TDataStd_IntegerArray::Set(aChild, AnimValuesDimensionGUID(), 1, 2);
aDimArr->SetValue(1, anOperPresentation.RowLength());
aDimArr->SetValue(2, anOperPresentation.ColLength());
const int aNbValues = anOperPresentation.Length();
Handle(TDataStd_RealArray) aValuesArr = TDataStd_RealArray::Set(aChild, AnimValuesGUID(), 1, aNbValues);
int anOperValueInd = 1;
for (NCollection_Array2<double>::Iterator aOperValIter(anOperPresentation);
aOperValIter.More(); aOperValIter.Next())
{
aValuesArr->SetValue(anOperValueInd++, aOperValIter.Value());
}
if (anOperation->HasTimeStamps())
{
const NCollection_Array1<double>& aTimeStamps = anOperation->TimeStamps();
Handle(TDataStd_RealArray) aTimeStampsAttr =
TDataStd_RealArray::Set(aChild, AnimTimeStampsValuesGUID(), aTimeStamps.Lower(), aTimeStamps.Upper());
for (int aTimeStampInd = 1; aTimeStampInd <= aTimeStamps.Length(); aTimeStampInd++)
{
aTimeStampsAttr->SetValue(aTimeStampInd, aTimeStamps.Value(aTimeStampInd));
}
}
}
}
//=======================================================================
//function : GetObject
//purpose :
//=======================================================================
Handle(XCAFAnimObjects_AnimObject) XCAFDoc_Animation::GetObject() const
{
Handle(XCAFAnimObjects_AnimObject) anObj = new XCAFAnimObjects_AnimObject();
Handle(TDataStd_Integer) anIntType;
if (Label().FindAttribute(AnimInterpolationRefGUID(), anIntType))
{
const XCAFAnimObjects_InterpolationType aType =
static_cast<XCAFAnimObjects_InterpolationType>(anIntType->Get());
anObj->SetInterpolationType(aType);
}
NCollection_List<Handle(XCAFAnimObjects_Operation)> anOrderedOperations;
for (TDF_ChildIterator aChildIterator(Label());
aChildIterator.More(); aChildIterator.Next())
{
const TDF_Label& anOperL = aChildIterator.Value();
XCAFAnimObjects_OperationType anOperType = XCAFAnimObjects_OperationType_Custom;
Handle(TDataStd_UAttribute) anOperTypeAttr;
if (anOperL.FindAttribute(AnimCustomRefGUID(), anOperTypeAttr))
{
anOperType = XCAFAnimObjects_OperationType_Custom;
}
else if (anOperL.FindAttribute(AnimOrientRefGUID(), anOperTypeAttr))
{
anOperType = XCAFAnimObjects_OperationType_Orient;
}
else if (anOperL.FindAttribute(AnimRotateRefGUID(), anOperTypeAttr))
{
anOperType = XCAFAnimObjects_OperationType_Rotate;
}
else if (anOperL.FindAttribute(AnimScaleRefGUID(), anOperTypeAttr))
{
anOperType = XCAFAnimObjects_OperationType_Scale;
}
else if (anOperL.FindAttribute(AnimSkewRefGUID(), anOperTypeAttr))
{
anOperType = XCAFAnimObjects_OperationType_Skew;
}
else if (anOperL.FindAttribute(AnimTransformRefGUID(), anOperTypeAttr))
{
anOperType = XCAFAnimObjects_OperationType_Transform;
}
else if (anOperL.FindAttribute(AnimTranslateRefGUID(), anOperTypeAttr))
{
anOperType = XCAFAnimObjects_OperationType_Translate;
}
if (anOperTypeAttr.IsNull())
{
continue;
}
Handle(TDataStd_IntegerArray) aDimAtrArr;
if (!anOperL.FindAttribute(AnimValuesDimensionGUID(), aDimAtrArr) ||
aDimAtrArr->Length() != 2)
{
continue;
}
Handle(TDataStd_RealArray) aValuesAtrArr;
if (!anOperL.FindAttribute(AnimValuesGUID(), aValuesAtrArr) ||
(aDimAtrArr->Value(1) * aDimAtrArr->Value(2)) != aValuesAtrArr->Length())
{
continue;
}
NCollection_Array2<double> aValuesArr(1, aDimAtrArr->Value(2), 1, aDimAtrArr->Value(1));
int aValuesInd = 1;
for (NCollection_Array2<double>::Iterator aOperValIter(aValuesArr);
aOperValIter.More(); aOperValIter.Next(), aValuesInd++)
{
aOperValIter.ChangeValue() = aValuesAtrArr->Value(aValuesInd);
}
Handle(TDataStd_RealArray) aTimeStampsAttr;
NCollection_Array1<double> aTimeStampsArr;
if (anOperL.FindAttribute(AnimTimeStampsValuesGUID(), aTimeStampsAttr) &&
aTimeStampsAttr->Length() == aValuesArr.NbRows())
{
aTimeStampsArr.Resize(1, aTimeStampsAttr->Length(), false);
for (int anTimeStampInd = 1; anTimeStampInd <= aTimeStampsAttr->Length(); anTimeStampInd++)
{
aTimeStampsArr.SetValue(anTimeStampInd, aTimeStampsAttr->Value(anTimeStampInd));
}
}
Handle(TDataStd_UAttribute) anInvertAttr;
const bool anIsInvert = anOperL.FindAttribute(AnimInvertRefGUID(), anInvertAttr);
Handle(XCAFAnimObjects_Operation) aNewOperObj;
switch (anOperType)
{
case XCAFAnimObjects_OperationType_Custom:
{
Handle(TDataStd_Name) aOperNameAttr;
if (!anOperL.FindAttribute(TDataStd_Name::GetID(), aOperNameAttr))
{
continue;
}
const TCollection_AsciiString aOperName = aOperNameAttr->Get();
aNewOperObj = new XCAFAnimObjects_CustomOperation(aValuesArr, aTimeStampsArr, aOperName);
break;
}
case XCAFAnimObjects_OperationType_Orient:
{
aNewOperObj = new XCAFAnimObjects_Orient(aValuesArr, aTimeStampsArr);
break;
}
case XCAFAnimObjects_OperationType_Rotate:
{
Handle(TDataStd_Integer) aRotateTypeAttr;
if (!anOperL.FindAttribute(AnimRotateSubTypeGUID(), aRotateTypeAttr))
{
continue;
}
const XCAFAnimObjects_Rotate::XCAFAnimObjects_Rotate_Type aRotateType =
static_cast<XCAFAnimObjects_Rotate::XCAFAnimObjects_Rotate_Type>(aRotateTypeAttr->Get());
aNewOperObj = new XCAFAnimObjects_Rotate(aValuesArr, aTimeStampsArr, aRotateType);
break;
}
case XCAFAnimObjects_OperationType_Scale:
{
aNewOperObj = new XCAFAnimObjects_Scale(aValuesArr, aTimeStampsArr);
break;
}
case XCAFAnimObjects_OperationType_Skew:
{
aNewOperObj = new XCAFAnimObjects_Skew(aValuesArr, aTimeStampsArr);
break;
}
case XCAFAnimObjects_OperationType_Transform:
{
aNewOperObj = new XCAFAnimObjects_Transform(aValuesArr, aTimeStampsArr);
break;
}
case XCAFAnimObjects_OperationType_Translate:
{
aNewOperObj = new XCAFAnimObjects_Translate(aValuesArr, aTimeStampsArr);
break;
}
}
if (aNewOperObj.IsNull())
{
continue;
}
aNewOperObj->SetInverse(anIsInvert);
anOrderedOperations.Append(aNewOperObj);
}
anObj->ChangeOrderedOperations() = anOrderedOperations;
return anObj;
}
//=======================================================================
//function : ID
//purpose :
//=======================================================================
const Standard_GUID& XCAFDoc_Animation::ID() const
{
return GetID();
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void XCAFDoc_Animation::DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth) const
{
(void)theOStream;
(void)theDepth;
}

View File

@@ -0,0 +1,55 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XCAFDoc_Animation_HeaderFile
#define _XCAFDoc_Animation_HeaderFile
#include <TDataStd_GenericEmpty.hxx>
class Standard_GUID;
class TDF_Label;
class XCAFAnimObjects_AnimObject;
// resolve name collisions with WinAPI headers
#ifdef GetObject
#undef GetObject
#endif
//!
class XCAFDoc_Animation : public TDataStd_GenericEmpty
{
public:
Standard_EXPORT XCAFDoc_Animation();
Standard_EXPORT static const Standard_GUID& GetID();
Standard_EXPORT static Handle(XCAFDoc_Animation) Set (const TDF_Label& theLabel);
Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
//! Updates parent's label and its sub-labels with data taken from theDimensionObject.
//! Old data associated with the label will be lost.
Standard_EXPORT void SetObject (const Handle(XCAFAnimObjects_AnimObject)& theDimensionObject);
//! Returns dimension object data taken from the parent's label and its sub-labels.
Standard_EXPORT Handle(XCAFAnimObjects_AnimObject) GetObject() const;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
DEFINE_DERIVED_ATTRIBUTE(XCAFDoc_Animation,TDataStd_GenericEmpty)
};
#endif

View File

@@ -0,0 +1,437 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <XCAFDoc_AnimationTool.hxx>
#include <Standard_GUID.hxx>
#include <TDataStd_AsciiString.hxx>
#include <TDataStd_Name.hxx>
#include <TDataStd_Real.hxx>
#include <TDataStd_TreeNode.hxx>
#include <TDataStd_UAttribute.hxx>
#include <TDF_ChildIterator.hxx>
#include <XCAFDoc.hxx>
#include <XCAFDoc_Animation.hxx>
#include <XCAFDoc_GraphNode.hxx>
IMPLEMENT_DERIVED_ATTRIBUTE_WITH_TYPE(XCAFDoc_AnimationTool, TDataStd_GenericEmpty, "xcaf", "AnimationTool")
namespace
{
//=======================================================================
//function : GetGlobalFPSGUID
//purpose :
//=======================================================================
const Standard_GUID& GetGlobalFPSGUID()
{
static Standard_GUID aGlobalFPSID("C7E7AF70-2FB3-40FD-BD38-CC79D9343D7A");
return aGlobalFPSID;
}
//=======================================================================
//function : GetStartTimeCodeGUID
//purpose :
//=======================================================================
const Standard_GUID& GetStartTimeCodeGUID()
{
static Standard_GUID aStartTimeCodeGUID("379BC1C5-E9DA-4B57-9938-B2612158722A");
return aStartTimeCodeGUID;
}
//=======================================================================
//function : GetEndTimeCodeGUID
//purpose :
//=======================================================================
const Standard_GUID& GetEndTimeCodeGUID()
{
static Standard_GUID aEndTimeCodeGUID("EF5305A3-961D-48AE-9A78-AC744A110A26");
return aEndTimeCodeGUID;
}
//=======================================================================
//function : GetFileLengthUnitGUID
//purpose :
//=======================================================================
const Standard_GUID& GetFileLengthUnitGUID()
{
static Standard_GUID aFileLengthUnitGUID("492f5372-9a28-4611-a663-d8394f98df00");
return aFileLengthUnitGUID;
}
//=======================================================================
//function : GetFileLengthUnitGUID
//purpose :
//=======================================================================
const Standard_GUID& GetUpAxisGUID()
{
static Standard_GUID anUpAxisGUID("05d55dd9-7175-44a7-97aa-43909ad6f9c7");
return anUpAxisGUID;
}
}
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
const Standard_GUID& XCAFDoc_AnimationTool::GetID()
{
static Standard_GUID anAnimationToolID("9E9914DD-154A-4E17-B89B-3E33CCF67BD0");
return anAnimationToolID;
}
//=======================================================================
//function : Set
//purpose :
//=======================================================================
Handle(XCAFDoc_AnimationTool) XCAFDoc_AnimationTool::Set(const TDF_Label& theLabel)
{
Handle(XCAFDoc_AnimationTool) anAnimTool;
if (!theLabel.FindAttribute(XCAFDoc_AnimationTool::GetID(), anAnimTool))
{
anAnimTool = new XCAFDoc_AnimationTool();
theLabel.AddAttribute(anAnimTool);
}
return anAnimTool;
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
XCAFDoc_AnimationTool::XCAFDoc_AnimationTool()
{}
//=======================================================================
//function : ID
//purpose :
//=======================================================================
const Standard_GUID& XCAFDoc_AnimationTool::ID() const
{
return GetID();
}
//=======================================================================
//function : BaseLabel
//purpose :
//=======================================================================
TDF_Label XCAFDoc_AnimationTool::BaseLabel() const
{
return Label();
}
//=======================================================================
//function : IsAnimation
//purpose :
//=======================================================================
bool XCAFDoc_AnimationTool::IsAnimation(const TDF_Label& theLabel) const
{
Handle(XCAFDoc_Animation) anAnimAtr;
if (theLabel.FindAttribute(XCAFDoc_Animation::GetID(), anAnimAtr))
{
return true;
}
return false;
}
//=======================================================================
//function : SetAnimation
//purpose :
//=======================================================================
void XCAFDoc_AnimationTool::SetAnimation(const TDF_Label& theShLabel,
const TDF_Label& theAnimLabel) const
{
// set reference
Handle(TDataStd_TreeNode) aRefNode, aMainNode;
aMainNode = TDataStd_TreeNode::Set(theAnimLabel, XCAFDoc::AnimRefShapeGUID());
aRefNode = TDataStd_TreeNode::Set(theShLabel, XCAFDoc::AnimRefShapeGUID());
aRefNode->Remove();
aMainNode->Prepend(aRefNode);
}
//=======================================================================
//function : GetGlobalFPS
//purpose :
//=======================================================================
bool XCAFDoc_AnimationTool::GetGlobalFPS(double& theFPS) const
{
Handle(TDataStd_Real) aFPSAttr;
if (BaseLabel().FindAttribute(GetGlobalFPSGUID(), aFPSAttr))
{
theFPS = aFPSAttr->Get();
return true;
}
return false;
}
//=======================================================================
//function : SetGlobalFPS
//purpose :
//=======================================================================
void XCAFDoc_AnimationTool::SetGlobalFPS(const double theFPS) const
{
Handle(TDataStd_Real) aFPSAttr;
if (BaseLabel().FindAttribute(GetGlobalFPSGUID(), aFPSAttr))
{
aFPSAttr->Set(theFPS);
return;
}
TDataStd_Real::Set(BaseLabel(), GetGlobalFPSGUID(), theFPS);
}
//=======================================================================
//function : GetStartTimeCode
//purpose :
//=======================================================================
bool XCAFDoc_AnimationTool::GetStartTimeCode(double& theCode) const
{
Handle(TDataStd_Real) aCodeAttr;
if (BaseLabel().FindAttribute(GetStartTimeCodeGUID(), aCodeAttr))
{
theCode = aCodeAttr->Get();
return true;
}
return false;
}
//=======================================================================
//function : SetStartTimeCode
//purpose :
//=======================================================================
void XCAFDoc_AnimationTool::SetStartTimeCode(const double theCode) const
{
Handle(TDataStd_Real) aCodeAttr;
if (BaseLabel().FindAttribute(GetStartTimeCodeGUID(), aCodeAttr))
{
aCodeAttr->Set(theCode);
return;
}
TDataStd_Real::Set(BaseLabel(), GetStartTimeCodeGUID(), theCode);
}
//=======================================================================
//function : GetEndTimeCode
//purpose :
//=======================================================================
bool XCAFDoc_AnimationTool::GetEndTimeCode(double& theCode) const
{
Handle(TDataStd_Real) aCodeAttr;
if (BaseLabel().FindAttribute(GetEndTimeCodeGUID(), aCodeAttr))
{
theCode = aCodeAttr->Get();
return true;
}
return false;
}
//=======================================================================
//function : SetEndTimeCode
//purpose :
//=======================================================================
void XCAFDoc_AnimationTool::SetEndTimeCode(const double theCode) const
{
Handle(TDataStd_Real) aCodeAttr;
if (BaseLabel().FindAttribute(GetEndTimeCodeGUID(), aCodeAttr))
{
aCodeAttr->Set(theCode);
return;
}
TDataStd_Real::Set(BaseLabel(), GetEndTimeCodeGUID(), theCode);
}
//=======================================================================
//function : GetFileLengthUnit
//purpose :
//=======================================================================
bool XCAFDoc_AnimationTool::GetFileLengthUnit(double& theLengthUnit) const
{
Handle(TDataStd_Real) aLengthUnitAttr;
if (BaseLabel().FindAttribute(GetFileLengthUnitGUID(), aLengthUnitAttr))
{
theLengthUnit = aLengthUnitAttr->Get();
return true;
}
return false;
}
//=======================================================================
//function : SetFileLengthUnit
//purpose :
//=======================================================================
void XCAFDoc_AnimationTool::SetFileLengthUnit(const double theLengthUnit) const
{
Handle(TDataStd_Real) aLengthUnitAttr;
if (BaseLabel().FindAttribute(GetFileLengthUnitGUID(), aLengthUnitAttr))
{
aLengthUnitAttr->Set(theLengthUnit);
return;
}
TDataStd_Real::Set(BaseLabel(), GetFileLengthUnitGUID(), theLengthUnit);
}
//=======================================================================
//function : GetUpAxis
//purpose :
//=======================================================================
bool XCAFDoc_AnimationTool::GetUpAxis(TCollection_AsciiString& theAxis) const
{
Handle(TDataStd_AsciiString) anAxisAttr;
if (BaseLabel().FindAttribute(GetUpAxisGUID(), anAxisAttr))
{
theAxis = anAxisAttr->Get();
return true;
}
return false;
}
//=======================================================================
//function : SetUpAxis
//purpose :
//=======================================================================
void XCAFDoc_AnimationTool::SetUpAxis(const TCollection_AsciiString theAxis) const
{
Handle(TDataStd_AsciiString) anAxisAttr;
if (BaseLabel().FindAttribute(GetUpAxisGUID(), anAxisAttr))
{
anAxisAttr->Set(theAxis);
return;
}
TDataStd_AsciiString::Set(BaseLabel(), GetUpAxisGUID(), theAxis);
}
//=======================================================================
//function : GetAnimationLabels
//purpose :
//=======================================================================
void XCAFDoc_AnimationTool::GetAnimationLabels(TDF_LabelSequence& theLabels) const
{
theLabels.Clear();
for (TDF_ChildIterator aChildIterator(Label());
aChildIterator.More(); aChildIterator.Next())
{
TDF_Label aL = aChildIterator.Value();
if (IsAnimation(aL))
{
theLabels.Append(aL);
}
}
}
//=======================================================================
//function : GetRefAnimationLabels
//purpose :
//=======================================================================
bool XCAFDoc_AnimationTool::GetRefAnimationLabel(const TDF_Label& theShLabel,
TDF_Label& theAnimLabel) const
{
Handle(TDataStd_TreeNode) aNode;
if (!theShLabel.FindAttribute(XCAFDoc::AnimRefShapeGUID(), aNode) ||
!aNode->HasFather())
{
return false;
}
theAnimLabel = aNode->Father()->Label();
return true;
}
//=======================================================================
//function : GetRefShapeLabel
//purpose :
//=======================================================================
bool XCAFDoc_AnimationTool::GetRefShapeLabel(const TDF_Label& theAnimLabel,
TDF_Label& theShLabel) const
{
Handle(TDataStd_TreeNode) aNode;
if (!theAnimLabel.FindAttribute(XCAFDoc::AnimRefShapeGUID(), aNode) ||
!aNode->Label().IsNull())
{
return false;
}
theShLabel = aNode->Label();
return true;
}
//=======================================================================
//function : AddAnimation
//purpose :
//=======================================================================
TDF_Label XCAFDoc_AnimationTool::AddAnimation() const
{
TDF_Label anAnimL;
TDF_TagSource aTag;
anAnimL = aTag.NewChild(Label());
Handle(XCAFDoc_Animation) aTol = XCAFDoc_Animation::Set(anAnimL);
TCollection_AsciiString aStr = "Animation";
TDataStd_Name::Set(anAnimL, aStr);
return anAnimL;
}
//=======================================================================
//function : IsLocked
//purpose :
//=======================================================================
bool XCAFDoc_AnimationTool::IsLocked(const TDF_Label& theAnimLabel) const
{
Handle(TDataStd_UAttribute) anAttr;
return theAnimLabel.FindAttribute(XCAFDoc::LockGUID(), anAttr);
}
//=======================================================================
//function : Unlock
//purpose :
//=======================================================================
void XCAFDoc_AnimationTool::Lock(const TDF_Label& theAnimLabel) const
{
TDataStd_UAttribute::Set(theAnimLabel, XCAFDoc::LockGUID());
}
//=======================================================================
//function : Unlock
//purpose :
//=======================================================================
void XCAFDoc_AnimationTool::Unlock(const TDF_Label& theAnimLabel) const
{
theAnimLabel.ForgetAttribute(XCAFDoc::LockGUID());
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
Standard_OStream& XCAFDoc_AnimationTool::Dump(Standard_OStream& theOStream,
const bool theDepth) const
{
(void)theDepth;
return theOStream;
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
Standard_OStream& XCAFDoc_AnimationTool::Dump(Standard_OStream& theDumpLog) const
{
TDF_Attribute::Dump(theDumpLog);
Dump(theDumpLog, false);
return theDumpLog;
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void XCAFDoc_AnimationTool::DumpJson(Standard_OStream& theOStream,
Standard_Integer theDepth) const
{
(void)theOStream;
(void)theDepth;
}

View File

@@ -0,0 +1,130 @@
// Copyright (c) 2023 OPEN CASCADE SAS
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XCAFDoc_AnimationTool_HeaderFile
#define _XCAFDoc_AnimationTool_HeaderFile
#include <TDF_LabelSequence.hxx>
#include <TDataStd_GenericEmpty.hxx>
//! A tool to store shapes in an XDE
//! document in the form of assembly structure, and to maintain this structure.
//! Attribute containing Shapes section of DECAF document.
//! Provide tools for management of Shapes section.
//! The API provided by this class allows to work with this
//! structure regardless of its low-level implementation.
//! All the shapes are stored on child labels of a main label which is
//! XCAFDoc_DocumentTool::LabelShapes(). The label for assembly also has
//! sub-labels, each of which represents the instance of
//! another shape in that assembly (component). Such sub-label
//! stores reference to the label of the original shape in the form
//! of TDataStd_TreeNode with GUID XCAFDoc::ShapeRefGUID(), and its
//! location encapsulated into the NamedShape.
//! For correct work with an XDE document, it is necessary to use
//! methods for analysis and methods for working with shapes.
class XCAFDoc_AnimationTool : public TDataStd_GenericEmpty
{
public:
Standard_EXPORT static const Standard_GUID& GetID();
//! Create (if not exist) ShapeTool from XCAFDoc on <L>.
Standard_EXPORT static Handle(XCAFDoc_AnimationTool) Set(const TDF_Label& theLabel);
//! Creates an empty tool
//! Creates a tool to work with a document <Doc>
//! Attaches to label XCAFDoc::LabelShapes()
Standard_EXPORT XCAFDoc_AnimationTool();
//! returns the label under which shapes are stored
Standard_EXPORT TDF_Label BaseLabel() const;
//!
Standard_EXPORT bool IsAnimation(const TDF_Label& theLabel) const;
//!
Standard_EXPORT void SetAnimation(const TDF_Label& theShLabel,
const TDF_Label& theAnimLabel) const;
//!
Standard_EXPORT bool GetGlobalFPS(double& theFPS) const;
//!
Standard_EXPORT void SetGlobalFPS(const double theFPS) const;
//!
Standard_EXPORT bool GetStartTimeCode(double& theCode) const;
//!
Standard_EXPORT void SetStartTimeCode(const double theCode) const;
//!
Standard_EXPORT bool GetEndTimeCode(double& theCode) const;
//!
Standard_EXPORT void SetEndTimeCode(const double theCode) const;
//!
Standard_EXPORT bool GetFileLengthUnit(double& theLengthUnit) const;
//!
Standard_EXPORT void SetFileLengthUnit(const double theLengthUnit) const;
//!
Standard_EXPORT bool GetUpAxis(TCollection_AsciiString& theAxis) const;
//!
Standard_EXPORT void SetUpAxis(const TCollection_AsciiString theAxis) const;
//! Returns a sequence of Animation labels currently stored
//! in the Animation table.
Standard_EXPORT void GetAnimationLabels(TDF_LabelSequence& theLabels) const;
//! Returns Animation label defined for shape.
Standard_EXPORT bool GetRefAnimationLabel(const TDF_Label& theShLabel,
TDF_Label& theAnimLabel) const;
//! Returns Animation label defined for shape.
Standard_EXPORT bool GetRefShapeLabel(const TDF_Label& theAnimLabel,
TDF_Label& theShLabel) const;
//! Adds a animation definition to the Animation table and returns its label.
Standard_EXPORT TDF_Label AddAnimation() const;
//! Returns true if the given Animation is marked as locked.
Standard_EXPORT bool IsLocked(const TDF_Label& theAnimLabel) const;
//! Mark the given Animation as locked.
Standard_EXPORT void Lock(const TDF_Label& theAnimLabel) const;
//! Unlock the given Animation.
Standard_EXPORT void Unlock(const TDF_Label& theAnimLabel) const;
Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOStream, const bool theDepth) const;
Standard_EXPORT virtual Standard_OStream& Dump(Standard_OStream& theOStream) const Standard_OVERRIDE;
Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
DEFINE_DERIVED_ATTRIBUTE(XCAFDoc_AnimationTool, TDataStd_GenericEmpty)
private:
};
#endif // _XCAFDoc_AnimationTool_HeaderFile

View File

@@ -23,6 +23,7 @@
#include <TDF_Label.hxx>
#include <TDF_Tool.hxx>
#include <TDocStd_Document.hxx>
#include <XCAFDoc_AnimationTool.hxx>
#include <XCAFDoc_ColorTool.hxx>
#include <XCAFDoc_ClippingPlaneTool.hxx>
#include <XCAFDoc_DimTolTool.hxx>
@@ -88,6 +89,7 @@ Handle(XCAFDoc_DocumentTool) XCAFDoc_DocumentTool::Set(const TDF_Label& L,
XCAFDoc_NotesTool::Set(NotesLabel(L));
XCAFDoc_ViewTool::Set(ViewsLabel(L));
XCAFDoc_ClippingPlaneTool::Set(ClippingPlanesLabel(L));
XCAFDoc_AnimationTool::Set(AnimationlLabel(L));
}
return A;
}
@@ -237,6 +239,17 @@ TDF_Label XCAFDoc_DocumentTool::VisMaterialLabel (const TDF_Label& theLabel)
return aLabel;
}
//=======================================================================
//function : AnimationlLabel
//purpose :
//=======================================================================
TDF_Label XCAFDoc_DocumentTool::AnimationlLabel(const TDF_Label& theLabel)
{
TDF_Label aLabel = DocLabel(theLabel).FindChild(18, Standard_True);
TDataStd_Name::Set(aLabel, "Animation");
return aLabel;
}
//=======================================================================
//function : ShapeTool
//purpose :
@@ -294,6 +307,15 @@ Handle(XCAFDoc_VisMaterialTool) XCAFDoc_DocumentTool::VisMaterialTool (const TDF
return XCAFDoc_VisMaterialTool::Set (VisMaterialLabel (theLabel));
}
//=======================================================================
//function : AnimationTool
//purpose :
//=======================================================================
Handle(XCAFDoc_AnimationTool) XCAFDoc_DocumentTool::AnimationTool(const TDF_Label& theLabel)
{
return XCAFDoc_AnimationTool::Set(AnimationlLabel(theLabel));
}
//=======================================================================
//function : CheckVisMaterialTool
//purpose :
@@ -308,12 +330,26 @@ Standard_Boolean XCAFDoc_DocumentTool::CheckVisMaterialTool(const TDF_Label& the
return aLabel.IsAttribute(XCAFDoc_VisMaterialTool::GetID());
}
//=======================================================================
//function : CheckAnimationTool
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_DocumentTool::CheckAnimationTool(const TDF_Label& theAcces)
{
TDF_Label aLabel = DocLabel(theAcces).FindChild(18, Standard_False);
if (aLabel.IsNull())
{
return Standard_False;
}
return aLabel.IsAttribute(XCAFDoc_AnimationTool::GetID());
}
//=======================================================================
//function : LayerTool
//purpose :
//=======================================================================
Handle(XCAFDoc_LayerTool) XCAFDoc_DocumentTool::LayerTool (const TDF_Label& acces)
Handle(XCAFDoc_LayerTool) XCAFDoc_DocumentTool::LayerTool (const TDF_Label& acces)
{
return XCAFDoc_LayerTool::Set(LayersLabel(acces));
}

View File

@@ -26,6 +26,7 @@
class Standard_GUID;
class TDF_Label;
class TDocStd_Document;
class XCAFDoc_AnimationTool;
class XCAFDoc_ShapeTool;
class XCAFDoc_ColorTool;
class XCAFDoc_ClippingPlaneTool;
@@ -92,6 +93,9 @@ public:
//! Returns sub-label of DocLabel() with tag 10.
Standard_EXPORT static TDF_Label VisMaterialLabel (const TDF_Label& theLabel);
//! Returns sub-label of DocLabel() with tag 18.
Standard_EXPORT static TDF_Label AnimationlLabel(const TDF_Label& theLabel);
//! Creates (if it does not exist) ShapeTool attribute on ShapesLabel().
Standard_EXPORT static Handle(XCAFDoc_ShapeTool) ShapeTool (const TDF_Label& acces);
@@ -110,10 +114,17 @@ public:
//! Should not be confused with MaterialTool() defining physical/manufacturing materials.
Standard_EXPORT static Handle(XCAFDoc_VisMaterialTool) VisMaterialTool (const TDF_Label& theLabel);
//! Creates (if it does not exist) XCAFDoc_AnimationTool attribute on AnimationLabell().
Standard_EXPORT static Handle(XCAFDoc_AnimationTool) AnimationTool(const TDF_Label& theLabel);
//! Checks for the VisMaterialTool attribute on the label's document
//! Returns TRUE if Tool exists, ELSE if it has not been created
Standard_EXPORT static Standard_Boolean CheckVisMaterialTool(const TDF_Label& theAcces);
//! Checks for the AnimationTool attribute on the label's document
//! Returns TRUE if Tool exists, ELSE if it has not been created
Standard_EXPORT static Standard_Boolean CheckAnimationTool(const TDF_Label& theAcces);
//! Creates (if it does not exist) LayerTool attribute on LayersLabel().
Standard_EXPORT static Handle(XCAFDoc_LayerTool) LayerTool (const TDF_Label& acces);

View File

@@ -24,6 +24,7 @@
#include <TCollection_HAsciiString.hxx>
#include <TColStd_SequenceOfHAsciiString.hxx>
#include <TDataStd_Name.hxx>
#include <TDataStd_RealArray.hxx>
#include <TDataStd_TreeNode.hxx>
#include <TDataStd_UAttribute.hxx>
#include <TDF_Attribute.hxx>
@@ -51,7 +52,21 @@
IMPLEMENT_DERIVED_ATTRIBUTE_WITH_TYPE(XCAFDoc_ShapeTool,TDataStd_GenericEmpty,"xcaf","ShapeTool")
static Standard_Boolean theAutoNaming = Standard_True;
namespace
{
static Standard_Boolean THE_AUTO_NAMING_FLAG = Standard_True;
static Standard_Boolean THE_UNIFORM_SCALING_SUPPORT_FLAG = Standard_False;
//=======================================================================
//function : GetUniformScaleGUID
//purpose :
//=======================================================================
const Standard_GUID& GetUniformScaleGUID()
{
static Standard_GUID anUniformScaleID("D4DA66EA-EBAD-4775-ACEC-1A018C6A4501");
return anUniformScaleID;
}
}
// attribute methods //////////////////////////////////////////////////
@@ -412,7 +427,7 @@ void XCAFDoc_ShapeTool::MakeReference (const TDF_Label &L,
refNode->Remove(); // abv: fix against bug in TreeNode::Append()
mainNode->Append(refNode);
if (theAutoNaming)
if (THE_AUTO_NAMING_FLAG)
SetLabelNameByLink(L);
}
@@ -487,7 +502,7 @@ TDF_Label XCAFDoc_ShapeTool::addShape (const TopoDS_Shape& S, const Standard_Boo
// }
A->SetShape(S);
if (theAutoNaming)
if (THE_AUTO_NAMING_FLAG)
SetLabelNameByShape(ShapeLabel);
// if shape is Compound and flag is set, create assembly
@@ -495,7 +510,7 @@ TDF_Label XCAFDoc_ShapeTool::addShape (const TopoDS_Shape& S, const Standard_Boo
// mark assembly by assigning UAttribute
Handle(TDataStd_UAttribute) Uattr;
Uattr = TDataStd_UAttribute::Set ( ShapeLabel, XCAFDoc::AssemblyGUID() );
if (theAutoNaming)
if (THE_AUTO_NAMING_FLAG)
TDataStd_Name::Set(ShapeLabel, TCollection_ExtendedString("ASSEMBLY"));
// iterate on components
@@ -644,31 +659,87 @@ void XCAFDoc_ShapeTool::Init()
//=======================================================================
//function : SetAutoNaming
//purpose :
//purpose :
//=======================================================================
void XCAFDoc_ShapeTool::SetAutoNaming (const Standard_Boolean V)
{
theAutoNaming = V;
THE_AUTO_NAMING_FLAG = V;
}
//=======================================================================
//function : AutoNaming
//purpose :
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_ShapeTool::AutoNaming()
{
return theAutoNaming;
return THE_AUTO_NAMING_FLAG;
}
//=======================================================================
//function : SetUniformScalingSupport
//purpose :
//=======================================================================
void XCAFDoc_ShapeTool::SetUniformScalingSupport(const Standard_Boolean theSupportFlag)
{
THE_UNIFORM_SCALING_SUPPORT_FLAG = theSupportFlag;
}
//=======================================================================
//function : UniformScalingSupport
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_ShapeTool::UniformScalingSupport()
{
return THE_UNIFORM_SCALING_SUPPORT_FLAG;
}
//=======================================================================
//function : GetShapeUniformScale
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_ShapeTool::GetShapeUniformScale(const TDF_Label& theShLabel,
double& theDX,
double& theDY,
double& theDZ)
{
if (theShLabel.IsNull())
{
return Standard_False;
}
Handle(TDataStd_RealArray) anArrAttr;
if (!theShLabel.FindAttribute(GetUniformScaleGUID(), anArrAttr) ||
anArrAttr->Length() != 3)
{
return Standard_False;
}
theDX = anArrAttr->Value(1);
theDY = anArrAttr->Value(2);
theDZ = anArrAttr->Value(3);
}
//=======================================================================
//function : SetShapeUniformScale
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_ShapeTool::SetShapeUniformScale(const TDF_Label& theShLabel,
const double theDX,
const double theDY,
const double theDZ)
{
if (!IsShape(theShLabel))
{
return Standard_False;
}
Handle(TDataStd_RealArray) anArray = TDataStd_RealArray::Set(theShLabel, GetUniformScaleGUID(), 1, 3);
anArray->SetValue(1, theDX);
anArray->SetValue(2, theDY);
anArray->SetValue(3, theDZ);
}
//=======================================================================
//function : ComputeShapes
//purpose :
//purpose :
//=======================================================================
void XCAFDoc_ShapeTool::ComputeShapes(const TDF_Label& L)
{
TDF_ChildIterator it(L);
@@ -1522,7 +1593,7 @@ Standard_Boolean XCAFDoc_ShapeTool::SetSHUO (const TDF_LabelSequence& labels,
TDF_TagSource aTag;
TDF_Label UpperSubL = aTag.NewChild( labels( 1 ) );
if (theAutoNaming) {
if (THE_AUTO_NAMING_FLAG) {
TCollection_ExtendedString Entry("SHUO");
TDataStd_Name::Set(UpperSubL, TCollection_ExtendedString( Entry ));
}
@@ -1533,7 +1604,7 @@ Standard_Boolean XCAFDoc_ShapeTool::SetSHUO (const TDF_LabelSequence& labels,
// add other next_usage occurrences.
for (i = 2; i <= labels.Length(); i++) {
TDF_Label NextSubL = aTag.NewChild( labels( i ) );
if (theAutoNaming) {
if (THE_AUTO_NAMING_FLAG) {
TCollection_ExtendedString EntrySub("SHUO-");
EntrySub += i;
TDataStd_Name::Set(NextSubL, TCollection_ExtendedString( EntrySub ));

View File

@@ -238,6 +238,34 @@ public:
//! Returns current auto-naming mode. See SetAutoNaming() for
//! description.
Standard_EXPORT static Standard_Boolean AutoNaming();
//! Sets uniform scaling support mode to <theSupportFlag>.
//! If True then some DataExchange components be able to keep
//! uniform scale information into special XCAF attribute.
//!
//! This setting is global; it cannot be made a member function
//! as it is used by static methods as well.
//! By default, uniform scaling support is disable.
//! See also UniformScalingSupport().
Standard_EXPORT static void SetUniformScalingSupport (const Standard_Boolean theSupportFlag);
//! Returns current niform scaling support mode.
//! See SetUniformScalingSupport() for description.
Standard_EXPORT static Standard_Boolean UniformScalingSupport();
//! Gets uniform scale values from the label.
//! @return true if scaling is support and attribute is exist
Standard_EXPORT static Standard_Boolean GetShapeUniformScale(const TDF_Label& theShLabel,
double& theDX,
double& theDY,
double& theDZ);
//! Sets uniform scale values on the label.
//! @return true if scaling is support and label contains shape
Standard_EXPORT static Standard_Boolean SetShapeUniformScale(const TDF_Label& theShLabel,
const double theDX,
const double theDY,
const double theDZ);
//! recursive
Standard_EXPORT void ComputeShapes (const TDF_Label& L);

View File

@@ -0,0 +1,9 @@
puts "==========================================================="
puts "0033304: Modeling Data - Floating point signal when converting a B-spline curve to analytical form"
puts "==========================================================="
puts "REQUIRED ALL: Conversion failed"
binrestore [locate_data_file bug33304_bspl_curv.bbrep] a
mkcurve c a
tocanon r c

View File

@@ -1,5 +1,5 @@
@echo off
rem test1
rem Helper script to run procedure of automatic upgrade of application code
rem on newer version of OCCT on Windows.
rem Running it requires that Tcl should be in the PATH