mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Compare commits
33 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b936aa6ed1 | ||
|
96a4eafb75 | ||
|
91a32b3f31 | ||
|
526c883afe | ||
|
c86ede0e57 | ||
|
47710c3050 | ||
|
c950f7fe0e | ||
|
f11043a8e8 | ||
|
beb4a7cfab | ||
|
d9e6701b25 | ||
|
359d02b15f | ||
|
124a9bd915 | ||
|
4556fae98d | ||
|
cf85781059 | ||
|
ccb708b8d3 | ||
|
514c451b3a | ||
|
ce13c99e9b | ||
|
2ffca9595b | ||
|
5ad8acb354 | ||
|
a0758a8002 | ||
|
1e36ce609f | ||
|
4e1a6b0b3b | ||
|
0a15182153 | ||
|
d1cce26f56 | ||
|
25b32bc9b5 | ||
|
0ed464551e | ||
|
9621410faa | ||
|
df85ce0635 | ||
|
21efa6d053 | ||
|
ad13308eb4 | ||
|
41fe9319fd | ||
|
364f396a14 | ||
|
1b29197cc9 |
31
README-ASRV.txt
Normal file
31
README-ASRV.txt
Normal 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.
|
2
adm/scripts/.gitignore
vendored
2
adm/scripts/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
*custom.bat
|
||||
*custom.sh
|
50
adm/scripts/cmake_custom.bat
Normal file
50
adm/scripts/cmake_custom.bat
Normal 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
|
||||
set USE_RAPIDJSON=ON
|
||||
rem set USE_DRACO=OFF
|
||||
rem set USE_TBB=OFF
|
||||
rem set USE_VTK=OFF
|
45
adm/scripts/cmake_custom.sh
Normal file
45
adm/scripts/cmake_custom.sh
Normal 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=ON
|
||||
#USE_DRACO=OFF
|
||||
#USE_TBB=OFF
|
||||
#USE_VTK=OFF
|
||||
|
||||
# This is to add any additional arguments to cmake
|
||||
#AUX_ARGS=
|
@@ -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% ^
|
||||
|
@@ -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" \
|
||||
|
@@ -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
|
||||
)
|
||||
@@ -108,17 +128,10 @@ if ["%toPack%"] == ["1"] (
|
||||
|
||||
"%THE_7Z_PATH%" a -r %THE_7Z_PARAMS% "%aBuildRoot%/%anArchName%.7z" "%aTarget%"
|
||||
)
|
||||
if not ["%1"] == ["-nopause"] (
|
||||
pause
|
||||
)
|
||||
|
||||
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 +141,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"] (
|
||||
@@ -272,7 +281,6 @@ if ["%toCMake%"] == ["1"] (
|
||||
|
||||
if errorlevel 1 (
|
||||
popd
|
||||
pause
|
||||
exit /B
|
||||
goto :eof
|
||||
)
|
||||
@@ -287,7 +295,6 @@ if ["%toMake%"] == ["1"] (
|
||||
if errorlevel 1 (
|
||||
type "%aLogFileSmpl%"
|
||||
popd
|
||||
pause
|
||||
exit /B
|
||||
goto :eof
|
||||
)
|
||||
@@ -299,7 +306,6 @@ if ["%toInstall%"] == ["1"] (
|
||||
if errorlevel 1 (
|
||||
type "%aLogFileSmpl%"
|
||||
popd
|
||||
pause
|
||||
exit /B
|
||||
goto :eof
|
||||
)
|
||||
|
@@ -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}" \
|
||||
|
30
adm/scripts/wasm_custom.bat
Normal file
30
adm/scripts/wasm_custom.bat
Normal 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"
|
20
adm/scripts/wasm_custom.sh
Normal file
20
adm/scripts/wasm_custom.sh
Normal 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
|
@@ -1653,6 +1653,13 @@ For each Saved View OCCT STEP Reader will retrieve the following attributes:
|
||||
- clipping planes (single plane of combination of planes);
|
||||
- front and back plane clipping.
|
||||
|
||||
### User defined attributes
|
||||
Attributes are implemented in accordance with <a href="https://www.mbx-if.org/documents/rec_prac_user_def_attributes_v18.pdf">Recommended practices for User Defined Attributes</a> section 4, 5, 6.1-6.3 and 7.
|
||||
Attributes can be read for shapes at levels:
|
||||
- Part/Product Level;
|
||||
- Component Instances in an Assembly;
|
||||
- Geometry Level.
|
||||
|
||||
@subsection occt_step_7_3 Writing to STEP
|
||||
|
||||
The translation from XDE to STEP can be initialized as follows:
|
||||
@@ -1730,5 +1737,8 @@ Interface_Static::SetIVal("write.step.schema", 5));
|
||||
### Saved views
|
||||
Saved Views are not exported by OCCT.
|
||||
|
||||
### User defined attributes
|
||||
Attributes can be imported from STEP.
|
||||
|
||||
|
||||
|
||||
|
@@ -808,8 +808,11 @@ void Approx_BSplComputeLine::Parameters(const MultiLine& Line,
|
||||
const Standard_Integer aNbp = lastP - firstP + 1;
|
||||
|
||||
|
||||
// The first parameter should always be zero according to all the logic below,
|
||||
// so division by any value will give zero anyway, so it should never be scaled
|
||||
// to avoid case when there is only one parameter in the array thus division by zero happens.
|
||||
TheParameters(firstP) = 0.0;
|
||||
if (aNbp == 2) {
|
||||
TheParameters(firstP) = 0.0;
|
||||
TheParameters(lastP) = 1.0;
|
||||
}
|
||||
else if (Par == Approx_ChordLength || Par == Approx_Centripetal)
|
||||
@@ -820,7 +823,6 @@ void Approx_BSplComputeLine::Parameters(const MultiLine& Line,
|
||||
if (nbP3d == 0) mynbP3d = 1;
|
||||
if (nbP2d == 0) mynbP2d = 1;
|
||||
|
||||
TheParameters(firstP) = 0.0;
|
||||
dist = 0.0;
|
||||
TColgp_Array1OfPnt tabP(1, mynbP3d);
|
||||
TColgp_Array1OfPnt tabPP(1, mynbP3d);
|
||||
@@ -861,10 +863,10 @@ void Approx_BSplComputeLine::Parameters(const MultiLine& Line,
|
||||
TheParameters(i) = TheParameters(i - 1) + Sqrt(dist);
|
||||
}
|
||||
}
|
||||
for (i = firstP; i <= lastP; i++) TheParameters(i) /= TheParameters(lastP);
|
||||
for (i = firstP + 1; i <= lastP; i++) TheParameters(i) /= TheParameters(lastP);
|
||||
}
|
||||
else {
|
||||
for (i = firstP; i <= lastP; i++) {
|
||||
for (i = firstP + 1; i <= lastP; i++) {
|
||||
TheParameters(i) = (Standard_Real(i) - firstP) /
|
||||
(Standard_Real(lastP - Standard_Real(firstP)));
|
||||
}
|
||||
|
@@ -96,7 +96,7 @@ Standard_Boolean BRepClass_FaceExplorer::CheckPoint(gp_Pnt2d& thePoint)
|
||||
else
|
||||
{
|
||||
Standard_Real anEpsilon = Epsilon(aDistance);
|
||||
if (anEpsilon > Max (myUMax - myUMin, myVMax - myVMin))
|
||||
if (anEpsilon > Max (myUMax - myUMin, myVMax - myVMin) && anEpsilon > 1e-100)
|
||||
{
|
||||
gp_Vec2d aLinVec(aCenterPnt, thePoint);
|
||||
gp_Dir2d aLinDir(aLinVec);
|
||||
|
@@ -308,10 +308,15 @@ Standard_Boolean BRepTools_GTrsfModification::NewTriangulation(const TopoDS_Face
|
||||
// modify normals
|
||||
if (theTriangulation->HasNormals())
|
||||
{
|
||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbTriangles(); ++anInd)
|
||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbNodes(); ++anInd)
|
||||
{
|
||||
gp_Dir aNormal = theTriangulation->Normal(anInd);
|
||||
aNormal.Transform(aGTrsf.Trsf());
|
||||
gp_Mat aMat = aGTrsf.VectorialPart();
|
||||
aMat.SetDiagonal(1., 1., 1.);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetForm(gp_Rotation);
|
||||
(gp_Mat&)aTrsf.HVectorialPart() = aMat;
|
||||
aNormal.Transform(aTrsf);
|
||||
theTriangulation->SetNormal(anInd, aNormal);
|
||||
}
|
||||
}
|
||||
|
@@ -515,8 +515,13 @@ BSplCLib::EvalBsplineBasis
|
||||
//
|
||||
// this should be always invertible if ii is correctly computed
|
||||
//
|
||||
Factor = (Parameter - FlatKnots(ii - qq + pp + 1))
|
||||
/ (FlatKnots(ii + pp) - FlatKnots(ii - qq + pp + 1)) ;
|
||||
const Standard_Real aScale = (FlatKnots(ii + pp) - FlatKnots(ii - qq + pp + 1));
|
||||
if (Abs (aScale) < gp::Resolution())
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
Factor = (Parameter - FlatKnots(ii - qq + pp + 1)) / aScale;
|
||||
Saved = Factor * BsplineBasis(1,pp) ;
|
||||
BsplineBasis(1,pp) *= (1.0e0 - Factor) ;
|
||||
BsplineBasis(1,pp) += BsplineBasis(1,qq) ;
|
||||
@@ -536,7 +541,13 @@ BSplCLib::EvalBsplineBasis
|
||||
}
|
||||
|
||||
for (pp = 1 ; pp <= qq - 1 ; pp++) {
|
||||
Inverse = 1.0e0 / (FlatKnots(ii + pp) - FlatKnots(ii - qq + pp + 1)) ;
|
||||
const Standard_Real aScale = (FlatKnots(ii + pp) - FlatKnots(ii - qq + pp + 1));
|
||||
if (Abs (aScale) < gp::Resolution())
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
Inverse = 1.0e0 / aScale;
|
||||
Factor = (Parameter - FlatKnots(ii - qq + pp + 1)) * Inverse ;
|
||||
Saved = Factor * BsplineBasis(1,pp) ;
|
||||
BsplineBasis(1,pp) *= (1.0e0 - Factor) ;
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include <Storage_Schema.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <TDataStd_TreeNode.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TDF_Data.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
@@ -324,7 +325,16 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
|
||||
// read sub-tree of the root label
|
||||
if (!theFilter.IsNull())
|
||||
theFilter->StartIteration();
|
||||
Standard_Integer nbRead = ReadSubTree (theIStream, aData->Root(), theFilter, aQuickPart, aPS.Next());
|
||||
const auto aStreamStartPosition = theIStream.tellg();
|
||||
Standard_Integer nbRead = ReadSubTree (theIStream, aData->Root(), theFilter, aQuickPart, Standard_False, aPS.Next());
|
||||
if (!myUnresolvedLinks.IsEmpty())
|
||||
{
|
||||
// In case we have skipped some linked TreeNodes before getting to
|
||||
// their children.
|
||||
theFilter->StartIteration();
|
||||
theIStream.seekg(aStreamStartPosition, std::ios_base::beg);
|
||||
nbRead += ReadSubTree(theIStream, aData->Root(), theFilter, aQuickPart, Standard_True, aPS.Next());
|
||||
}
|
||||
if (!aPS.More())
|
||||
{
|
||||
myReaderStatus = PCDM_RS_UserBreak;
|
||||
@@ -373,6 +383,7 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
|
||||
const TDF_Label& theLabel,
|
||||
const Handle(PCDM_ReaderFilter)& theFilter,
|
||||
const Standard_Boolean& theQuickPart,
|
||||
const Standard_Boolean theReadMissing,
|
||||
const Message_ProgressRange& theRange)
|
||||
{
|
||||
Standard_Integer nbRead = 0;
|
||||
@@ -393,7 +404,7 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
|
||||
aLabelSize = InverseUint64(aLabelSize);
|
||||
#endif
|
||||
// no one sub-label is needed, so, skip everything
|
||||
if (aSkipAttrs && !theFilter->IsSubPassed())
|
||||
if (aSkipAttrs && !theFilter->IsSubPassed() && myUnresolvedLinks.IsEmpty())
|
||||
{
|
||||
aLabelSize -= sizeof (uint64_t);
|
||||
theIS.seekg (aLabelSize, std::ios_base::cur);
|
||||
@@ -403,6 +414,11 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
|
||||
}
|
||||
}
|
||||
|
||||
if (theReadMissing)
|
||||
{
|
||||
aSkipAttrs = Standard_True;
|
||||
}
|
||||
const auto anAttStartPosition = theIS.tellg();
|
||||
// Read attributes:
|
||||
for (theIS >> myPAtt;
|
||||
theIS && myPAtt.TypeId() > 0 && // not an end marker ?
|
||||
@@ -415,6 +431,12 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
|
||||
myReaderStatus = PCDM_RS_UserBreak;
|
||||
return -1;
|
||||
}
|
||||
if (myUnresolvedLinks.Remove(myPAtt.Id()) && aSkipAttrs)
|
||||
{
|
||||
aSkipAttrs = Standard_False;
|
||||
theIS.seekg(anAttStartPosition, std::ios_base::beg);
|
||||
continue;
|
||||
}
|
||||
if (aSkipAttrs)
|
||||
{
|
||||
if (myPAtt.IsDirect()) // skip direct written stream
|
||||
@@ -487,7 +509,17 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
|
||||
aDriver->TypeName(), Message_Warning);
|
||||
}
|
||||
else if (!isBound)
|
||||
{
|
||||
myRelocTable.Bind(anID, tAtt);
|
||||
Handle(TDataStd_TreeNode) aNode = Handle(TDataStd_TreeNode)::DownCast(tAtt);
|
||||
if (!theFilter.IsNull() && !aNode.IsNull() && !aNode->Father().IsNull() && aNode->Father()->IsNew())
|
||||
{
|
||||
Standard_Integer anUnresolvedLink;
|
||||
myPAtt.SetPosition(BP_HEADSIZE);
|
||||
myPAtt >> anUnresolvedLink;
|
||||
myUnresolvedLinks.Add(anUnresolvedLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!myMapUnsupported.Contains(myPAtt.TypeId()))
|
||||
myMsgDriver->Send(aMethStr + "warning: type ID not registered in header: "
|
||||
@@ -522,7 +554,7 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
|
||||
// read sub-tree
|
||||
if (!theFilter.IsNull())
|
||||
theFilter->Down (aTag);
|
||||
Standard_Integer nbSubRead = ReadSubTree (theIS, aLab, theFilter, theQuickPart, aPS.Next());
|
||||
Standard_Integer nbSubRead = ReadSubTree (theIS, aLab, theFilter, theQuickPart, theReadMissing, aPS.Next());
|
||||
// check for error
|
||||
if (nbSubRead == -1)
|
||||
return -1;
|
||||
|
@@ -80,6 +80,7 @@ protected:
|
||||
const TDF_Label& theData,
|
||||
const Handle(PCDM_ReaderFilter)& theFilter,
|
||||
const Standard_Boolean& theQuickPart,
|
||||
const Standard_Boolean theReadMissing,
|
||||
const Message_ProgressRange& theRanges = Message_ProgressRange());
|
||||
|
||||
|
||||
@@ -125,6 +126,7 @@ private:
|
||||
BinObjMgt_Persistent myPAtt;
|
||||
TColStd_MapOfInteger myMapUnsupported;
|
||||
BinLDrivers_VectorOfDocumentSection mySections;
|
||||
NCollection_Map<Standard_Integer> myUnresolvedLinks;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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:
|
||||
|
||||
|
@@ -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 :
|
||||
|
@@ -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
|
||||
};
|
||||
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -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);
|
||||
|
@@ -76,22 +76,28 @@ static Standard_Boolean Controle(const TColgp_Array1OfPnt& Poles,
|
||||
Standard_Real umin, umax, vmin, vmax;
|
||||
S->Bounds(umin, umax, vmin, vmax);
|
||||
S->D1( (umin+umax)/2, (vmin+vmax)/2, P, DU, DV);
|
||||
// On prend DX le plus proche possible de DU
|
||||
gp_Dir du(DU);
|
||||
Standard_Real Angle1 = du.Angle(DX);
|
||||
Standard_Real Angle2 = du.Angle(DY);
|
||||
if (Angle1 > M_PI/2) Angle1 = M_PI-Angle1;
|
||||
if (Angle2 > M_PI/2) Angle2 = M_PI-Angle2;
|
||||
if (Angle2 < Angle1) {
|
||||
du = DY; DY = DX; DX = du;
|
||||
}
|
||||
if (DX.Angle(DU) > M_PI/2) DX.Reverse();
|
||||
if (DY.Angle(DV) > M_PI/2) DY.Reverse();
|
||||
|
||||
gp_Ax3 axe(Bary, DX^DY, DX);
|
||||
Plan.SetPosition(axe);
|
||||
Plan.SetLocation(Bary);
|
||||
IsPlan = Standard_True;
|
||||
if (DU.SquareMagnitude() > gp::Resolution() &&
|
||||
DV.SquareMagnitude() > gp::Resolution())
|
||||
{
|
||||
// On prend DX le plus proche possible de DU
|
||||
gp_Dir du(DU);
|
||||
Standard_Real Angle1 = du.Angle(DX);
|
||||
Standard_Real Angle2 = du.Angle(DY);
|
||||
if (Angle1 > M_PI/2) Angle1 = M_PI-Angle1;
|
||||
if (Angle2 > M_PI/2) Angle2 = M_PI-Angle2;
|
||||
if (Angle2 < Angle1)
|
||||
{
|
||||
du = DY; DY = DX; DX = du;
|
||||
}
|
||||
if (DX.Angle(DU) > M_PI/2) DX.Reverse();
|
||||
if (DY.Angle(DV) > M_PI/2) DY.Reverse();
|
||||
|
||||
gp_Ax3 axe(Bary, DX^DY, DX);
|
||||
Plan.SetPosition(axe);
|
||||
Plan.SetLocation(Bary);
|
||||
IsPlan = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
return IsPlan;
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -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);
|
||||
|
@@ -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:
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -98,6 +98,8 @@
|
||||
#include <RWStepBasic_RWExternalIdentificationAssignment.hxx>
|
||||
#include <RWStepBasic_RWExternallyDefinedItem.hxx>
|
||||
#include <RWStepBasic_RWGeneralProperty.hxx>
|
||||
#include <RWStepBasic_RWGeneralPropertyAssociation.hxx>
|
||||
#include <RWStepBasic_RWGeneralPropertyRelationship.hxx>
|
||||
#include <RWStepBasic_RWGroupRelationship.hxx>
|
||||
#include <RWStepBasic_RWIdentificationAssignment.hxx>
|
||||
#include <RWStepBasic_RWIdentificationRole.hxx>
|
||||
@@ -570,6 +572,8 @@
|
||||
#include <StepBasic_ExternalIdentificationAssignment.hxx>
|
||||
#include <StepBasic_ExternalSource.hxx>
|
||||
#include <StepBasic_GeneralProperty.hxx>
|
||||
#include <StepBasic_GeneralPropertyAssociation.hxx>
|
||||
#include <StepBasic_GeneralPropertyRelationship.hxx>
|
||||
#include <StepBasic_Group.hxx>
|
||||
#include <StepBasic_GroupRelationship.hxx>
|
||||
#include <StepBasic_IdentificationAssignment.hxx>
|
||||
@@ -1188,7 +1192,9 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_GeneralModule,StepData_GeneralModule)
|
||||
#include <StepDimTol_GeoTolAndGeoTolWthDatRefAndUneqDisGeoTol.hxx>
|
||||
#include <StepRepr_CompGroupShAspAndCompShAspAndDatumFeatAndShAsp.hxx>
|
||||
#include <StepRepr_CompShAspAndDatumFeatAndShAsp.hxx>
|
||||
#include <StepRepr_BooleanRepresentationItem.hxx>
|
||||
#include <StepRepr_IntegerRepresentationItem.hxx>
|
||||
#include <StepRepr_RealRepresentationItem.hxx>
|
||||
#include <StepRepr_ValueRepresentationItem.hxx>
|
||||
#include <StepAP242_DraughtingModelItemAssociation.hxx>
|
||||
#include <StepDimTol_GeoTolAndGeoTolWthDatRefAndGeoTolWthMaxTol.hxx>
|
||||
@@ -5867,6 +5873,20 @@ void RWStepAP214_GeneralModule::FillSharedCase(const Standard_Integer CN,
|
||||
aTool.Share(anEnt, iter);
|
||||
}
|
||||
break;
|
||||
case 819:
|
||||
{
|
||||
DeclareAndCast(StepBasic_GeneralPropertyAssociation, anEnt, ent);
|
||||
RWStepBasic_RWGeneralPropertyAssociation aTool;
|
||||
aTool.Share(anEnt, iter);
|
||||
}
|
||||
break;
|
||||
case 820:
|
||||
{
|
||||
DeclareAndCast(StepBasic_GeneralPropertyRelationship, anEnt, ent);
|
||||
RWStepBasic_RWGeneralPropertyRelationship aTool;
|
||||
aTool.Share(anEnt, iter);
|
||||
}
|
||||
break;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
@@ -8173,6 +8193,18 @@ Standard_Boolean RWStepAP214_GeneralModule::NewVoid
|
||||
case 818:
|
||||
ent = new StepVisual_CubicBezierTriangulatedFace;
|
||||
break;
|
||||
case 819:
|
||||
ent = new StepBasic_GeneralPropertyAssociation;
|
||||
break;
|
||||
case 820:
|
||||
ent = new StepBasic_GeneralPropertyRelationship;
|
||||
break;
|
||||
case 821:
|
||||
ent = new StepRepr_BooleanRepresentationItem;
|
||||
break;
|
||||
case 822:
|
||||
ent = new StepRepr_RealRepresentationItem;
|
||||
break;
|
||||
|
||||
default:
|
||||
return Standard_False;
|
||||
|
@@ -188,6 +188,8 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule)
|
||||
#include <StepShape_GeometricallyBoundedWireframeShapeRepresentation.hxx>
|
||||
#include <StepRepr_GlobalUncertaintyAssignedContext.hxx>
|
||||
#include <StepRepr_GlobalUnitAssignedContext.hxx>
|
||||
#include <StepBasic_GeneralPropertyAssociation.hxx>
|
||||
#include <StepBasic_GeneralPropertyRelationship.hxx>
|
||||
#include <StepBasic_Group.hxx>
|
||||
#include <StepBasic_GroupRelationship.hxx>
|
||||
#include <StepShape_HalfSpaceSolid.hxx>
|
||||
@@ -620,6 +622,8 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule)
|
||||
#include <RWStepShape_RWGeometricallyBoundedWireframeShapeRepresentation.hxx>
|
||||
#include <RWStepRepr_RWGlobalUncertaintyAssignedContext.hxx>
|
||||
#include <RWStepRepr_RWGlobalUnitAssignedContext.hxx>
|
||||
#include <RWStepBasic_RWGeneralPropertyAssociation.hxx>
|
||||
#include <RWStepBasic_RWGeneralPropertyRelationship.hxx>
|
||||
#include <RWStepBasic_RWGroup.hxx>
|
||||
#include <RWStepBasic_RWGroupRelationship.hxx>
|
||||
#include <RWStepShape_RWHalfSpaceSolid.hxx>
|
||||
@@ -1353,7 +1357,9 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule)
|
||||
#include <RWStepDimTol_RWGeoTolAndGeoTolWthDatRefAndUneqDisGeoTol.hxx>
|
||||
#include <RWStepRepr_RWCompGroupShAspAndCompShAspAndDatumFeatAndShAsp.hxx>
|
||||
#include <RWStepRepr_RWCompShAspAndDatumFeatAndShAsp.hxx>
|
||||
#include <RWStepRepr_RWBooleanRepresentationItem.hxx>
|
||||
#include <RWStepRepr_RWIntegerRepresentationItem.hxx>
|
||||
#include <RWStepRepr_RWRealRepresentationItem.hxx>
|
||||
#include <RWStepRepr_RWValueRepresentationItem.hxx>
|
||||
#include <RWStepRepr_RWValueRepresentationItem.hxx>
|
||||
#include <RWStepAP242_RWDraughtingModelItemAssociation.hxx>
|
||||
@@ -1404,7 +1410,9 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule)
|
||||
#include <StepDimTol_GeoTolAndGeoTolWthDatRefAndUneqDisGeoTol.hxx>
|
||||
#include <StepRepr_CompGroupShAspAndCompShAspAndDatumFeatAndShAsp.hxx>
|
||||
#include <StepRepr_CompShAspAndDatumFeatAndShAsp.hxx>
|
||||
#include <StepRepr_BooleanRepresentationItem.hxx>
|
||||
#include <StepRepr_IntegerRepresentationItem.hxx>
|
||||
#include <StepRepr_RealRepresentationItem.hxx>
|
||||
#include <StepRepr_ValueRepresentationItem.hxx>
|
||||
#include <StepAP242_DraughtingModelItemAssociation.hxx>
|
||||
#include <StepDimTol_GeoTolAndGeoTolWthDatRefAndGeoTolWthMaxTol.hxx>
|
||||
@@ -2349,6 +2357,10 @@ static TCollection_AsciiString Reco_ComplexTriangulatedFace("COMPLEX_TRIANGULATE
|
||||
static TCollection_AsciiString Reco_ComplexTriangulatedSurfaceSet("COMPLEX_TRIANGULATED_SURFACE_SET");
|
||||
static TCollection_AsciiString Reco_CubicBezierTessellatedEdge("CUBIC_BEZIER_TESSELLATED_EDGE");
|
||||
static TCollection_AsciiString Reco_CubicBezierTriangulatedFace("CUBIC_BEZIER_TRIANGULATED_FACE");
|
||||
static TCollection_AsciiString Reco_GeneralPropertyAssociation("GENERAL_PROPERTY_ASSOCIATION");
|
||||
static TCollection_AsciiString Reco_GeneralPropertyRelationship("GENERAL_PROPERTY_RELATIONSHIP");
|
||||
static TCollection_AsciiString Reco_BooleanRepresentationItem("BOOLEAN_REPRESENTATION_ITEM");
|
||||
static TCollection_AsciiString Reco_RealRepresentationItem("REAL_REPRESENTATION_ITEM");
|
||||
|
||||
// -- Definition of the libraries --
|
||||
|
||||
@@ -3105,6 +3117,10 @@ RWStepAP214_ReadWriteModule::RWStepAP214_ReadWriteModule ()
|
||||
typenums.Bind(Reco_ComplexTriangulatedSurfaceSet, 816);
|
||||
typenums.Bind(Reco_CubicBezierTessellatedEdge, 817);
|
||||
typenums.Bind(Reco_CubicBezierTriangulatedFace, 818);
|
||||
typenums.Bind(Reco_GeneralPropertyAssociation, 819);
|
||||
typenums.Bind(Reco_GeneralPropertyRelationship, 820);
|
||||
typenums.Bind(Reco_BooleanRepresentationItem, 821);
|
||||
typenums.Bind(Reco_RealRepresentationItem, 822);
|
||||
|
||||
|
||||
// SHORT NAMES
|
||||
@@ -5092,6 +5108,10 @@ const TCollection_AsciiString& RWStepAP214_ReadWriteModule::StepType
|
||||
case 816: return Reco_ComplexTriangulatedSurfaceSet;
|
||||
case 817: return Reco_CubicBezierTessellatedEdge;
|
||||
case 818: return Reco_CubicBezierTriangulatedFace;
|
||||
case 819: return Reco_GeneralPropertyAssociation;
|
||||
case 820: return Reco_GeneralPropertyRelationship;
|
||||
case 821: return Reco_BooleanRepresentationItem;
|
||||
case 822: return Reco_RealRepresentationItem;
|
||||
default : return PasReco;
|
||||
}
|
||||
}
|
||||
@@ -10694,6 +10714,34 @@ void RWStepAP214_ReadWriteModule::ReadStep(const Standard_Integer CN,
|
||||
aTool.ReadStep(data, num, ach, anEnt);
|
||||
}
|
||||
break;
|
||||
case 819:
|
||||
{
|
||||
DeclareAndCast(StepBasic_GeneralPropertyAssociation, anEnt, ent);
|
||||
RWStepBasic_RWGeneralPropertyAssociation aTool;
|
||||
aTool.ReadStep(data, num, ach, anEnt);
|
||||
}
|
||||
break;
|
||||
case 820:
|
||||
{
|
||||
DeclareAndCast(StepBasic_GeneralPropertyRelationship, anEnt, ent);
|
||||
RWStepBasic_RWGeneralPropertyRelationship aTool;
|
||||
aTool.ReadStep(data, num, ach, anEnt);
|
||||
}
|
||||
break;
|
||||
case 821:
|
||||
{
|
||||
DeclareAndCast(StepRepr_BooleanRepresentationItem, anent, ent);
|
||||
RWStepRepr_RWBooleanRepresentationItem aTool;
|
||||
aTool.ReadStep(data, num, ach, anent);
|
||||
}
|
||||
break;
|
||||
case 822:
|
||||
{
|
||||
DeclareAndCast(StepRepr_RealRepresentationItem, anent, ent);
|
||||
RWStepRepr_RWRealRepresentationItem aTool;
|
||||
aTool.ReadStep(data, num, ach, anent);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ach->AddFail("Type Mismatch when reading - Entity");
|
||||
}
|
||||
@@ -16238,6 +16286,34 @@ void RWStepAP214_ReadWriteModule::WriteStep(const Standard_Integer CN,
|
||||
aTool.WriteStep(SW, anEnt);
|
||||
}
|
||||
break;
|
||||
case 819:
|
||||
{
|
||||
DeclareAndCast(StepBasic_GeneralPropertyAssociation, anEnt, ent);
|
||||
RWStepBasic_RWGeneralPropertyAssociation aTool;
|
||||
aTool.WriteStep(SW, anEnt);
|
||||
}
|
||||
break;
|
||||
case 820:
|
||||
{
|
||||
DeclareAndCast(StepBasic_GeneralPropertyRelationship, anEnt, ent);
|
||||
RWStepBasic_RWGeneralPropertyRelationship aTool;
|
||||
aTool.WriteStep(SW, anEnt);
|
||||
}
|
||||
break;
|
||||
case 821:
|
||||
{
|
||||
DeclareAndCast(StepRepr_BooleanRepresentationItem, anent, ent);
|
||||
RWStepRepr_RWBooleanRepresentationItem aTool;
|
||||
aTool.WriteStep(SW, anent);
|
||||
}
|
||||
break;
|
||||
case 822:
|
||||
{
|
||||
DeclareAndCast(StepRepr_RealRepresentationItem, anent, ent);
|
||||
RWStepRepr_RWRealRepresentationItem aTool;
|
||||
aTool.WriteStep(SW, anent);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@@ -108,6 +108,10 @@ RWStepBasic_RWExternalSource.cxx
|
||||
RWStepBasic_RWExternalSource.hxx
|
||||
RWStepBasic_RWGeneralProperty.cxx
|
||||
RWStepBasic_RWGeneralProperty.hxx
|
||||
RWStepBasic_RWGeneralPropertyAssociation.cxx
|
||||
RWStepBasic_RWGeneralPropertyAssociation.hxx
|
||||
RWStepBasic_RWGeneralPropertyRelationship.cxx
|
||||
RWStepBasic_RWGeneralPropertyRelationship.hxx
|
||||
RWStepBasic_RWGroup.cxx
|
||||
RWStepBasic_RWGroup.hxx
|
||||
RWStepBasic_RWGroupAssignment.cxx
|
||||
|
87
src/RWStepBasic/RWStepBasic_RWGeneralPropertyAssociation.cxx
Normal file
87
src/RWStepBasic/RWStepBasic_RWGeneralPropertyAssociation.cxx
Normal file
@@ -0,0 +1,87 @@
|
||||
// Copyright (c) 2024 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 <Interface_EntityIterator.hxx>
|
||||
#include <RWStepBasic_RWGeneralPropertyAssociation.hxx>
|
||||
#include <StepBasic_GeneralProperty.hxx>
|
||||
#include <StepBasic_GeneralPropertyAssociation.hxx>
|
||||
#include <StepData_StepReaderData.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
#include <StepRepr_PropertyDefinition.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : RWStepBasic_RWGeneralPropertyAssociation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
RWStepBasic_RWGeneralPropertyAssociation::RWStepBasic_RWGeneralPropertyAssociation()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepBasic_RWGeneralPropertyAssociation::ReadStep(const Handle(StepData_StepReaderData)& theData,
|
||||
const Standard_Integer theNum,
|
||||
Handle(Interface_Check)& theAch,
|
||||
const Handle(StepBasic_GeneralPropertyAssociation)& theEnt) const
|
||||
{
|
||||
// Check number of parameters
|
||||
if (!theData->CheckNbParams(theNum, 4, theAch, "general_property_association")) return;
|
||||
|
||||
Handle(TCollection_HAsciiString) aName;
|
||||
theData->ReadString(theNum, 1, "name", theAch, aName);
|
||||
|
||||
Handle(TCollection_HAsciiString) aDescription;
|
||||
theData->ReadString(theNum, 2, "description", theAch, aDescription);
|
||||
|
||||
Handle(StepBasic_GeneralProperty) aGeneralProperty;
|
||||
theData->ReadEntity(theNum, 3, "base_definition", theAch, STANDARD_TYPE(StepBasic_GeneralProperty), aGeneralProperty);
|
||||
|
||||
Handle(StepRepr_PropertyDefinition) aPropertyDefinition;
|
||||
theData->ReadEntity(theNum, 4, "derived_definition", theAch, STANDARD_TYPE(StepRepr_PropertyDefinition), aPropertyDefinition);
|
||||
|
||||
// Initialize entity
|
||||
theEnt->Init(aName,
|
||||
aDescription,
|
||||
aGeneralProperty,
|
||||
aPropertyDefinition);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepBasic_RWGeneralPropertyAssociation::WriteStep (StepData_StepWriter& theSW,
|
||||
const Handle(StepBasic_GeneralPropertyAssociation) &theEnt) const
|
||||
{
|
||||
theSW.Send(theEnt->Name());
|
||||
|
||||
theSW.Send(theEnt->Description());
|
||||
|
||||
theSW.Send(theEnt->GeneralProperty());
|
||||
|
||||
theSW.Send(theEnt->PropertyDefinition());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Share
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepBasic_RWGeneralPropertyAssociation::Share(const Handle(StepBasic_GeneralPropertyAssociation)& theEnt,
|
||||
Interface_EntityIterator& theIter) const
|
||||
{
|
||||
theIter.AddItem(theEnt->GeneralProperty());
|
||||
|
||||
theIter.AddItem(theEnt->PropertyDefinition());
|
||||
}
|
60
src/RWStepBasic/RWStepBasic_RWGeneralPropertyAssociation.hxx
Normal file
60
src/RWStepBasic/RWStepBasic_RWGeneralPropertyAssociation.hxx
Normal file
@@ -0,0 +1,60 @@
|
||||
// Copyright (c) 2024 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 _RWStepBasic_RWGeneralPropertyAssociation_HeaderFile
|
||||
#define _RWStepBasic_RWGeneralPropertyAssociation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
class StepData_StepReaderData;
|
||||
class Interface_Check;
|
||||
class StepBasic_GeneralProperty;
|
||||
class StepData_StepWriter;
|
||||
class Interface_EntityIterator;
|
||||
|
||||
class StepBasic_GeneralPropertyAssociation;
|
||||
|
||||
//! Read & Write tool for GeneralPropertyAssociation
|
||||
class RWStepBasic_RWGeneralPropertyAssociation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT RWStepBasic_RWGeneralPropertyAssociation();
|
||||
|
||||
//! Reads GeneralPropertyAssociation
|
||||
Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& theData,
|
||||
const Standard_Integer theNum,
|
||||
Handle(Interface_Check)& theAch,
|
||||
const Handle(StepBasic_GeneralPropertyAssociation)& theEnt) const;
|
||||
|
||||
//! Writes GeneralPropertyAssociation
|
||||
Standard_EXPORT void WriteStep (StepData_StepWriter& theSW,
|
||||
const Handle(StepBasic_GeneralPropertyAssociation)& theEnt) const;
|
||||
|
||||
//! Fills data for graph (shared items)
|
||||
Standard_EXPORT void Share (const Handle(StepBasic_GeneralPropertyAssociation)& theEnt,
|
||||
Interface_EntityIterator& theIter) const;
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif // _RWStepBasic_RWGeneralPropertyAssociation_HeaderFile
|
103
src/RWStepBasic/RWStepBasic_RWGeneralPropertyRelationship.cxx
Normal file
103
src/RWStepBasic/RWStepBasic_RWGeneralPropertyRelationship.cxx
Normal file
@@ -0,0 +1,103 @@
|
||||
// Copyright (c) 2024 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 <Interface_EntityIterator.hxx>
|
||||
#include <RWStepBasic_RWGeneralPropertyRelationship.hxx>
|
||||
#include <StepBasic_GeneralProperty.hxx>
|
||||
#include <StepBasic_GeneralPropertyRelationship.hxx>
|
||||
#include <StepData_StepReaderData.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
#include <StepRepr_PropertyDefinition.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : RWStepBasic_RWGeneralPropertyRelationship
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
RWStepBasic_RWGeneralPropertyRelationship::RWStepBasic_RWGeneralPropertyRelationship()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepBasic_RWGeneralPropertyRelationship::ReadStep(const Handle(StepData_StepReaderData)& theData,
|
||||
const Standard_Integer theNum,
|
||||
Handle(Interface_Check)& theAch,
|
||||
const Handle(StepBasic_GeneralPropertyRelationship)& theEnt) const
|
||||
{
|
||||
// Check number of parameters
|
||||
if (!theData->CheckNbParams(theNum, 4, theAch, "general_property_association")) return;
|
||||
|
||||
Handle(TCollection_HAsciiString) aName;
|
||||
theData->ReadString(theNum, 1, "name", theAch, aName);
|
||||
|
||||
Handle(TCollection_HAsciiString) aDescription;
|
||||
Standard_Boolean hasDescription = Standard_True;
|
||||
if (theData->IsParamDefined(theNum, 2))
|
||||
{
|
||||
theData->ReadString(theNum, 2, "description", theAch, aDescription);
|
||||
}
|
||||
else
|
||||
{
|
||||
hasDescription = Standard_False;
|
||||
}
|
||||
|
||||
Handle(StepBasic_GeneralProperty) aRelatingGeneralProperty;
|
||||
theData->ReadEntity(theNum, 3, "relating_property", theAch, STANDARD_TYPE(StepBasic_GeneralProperty), aRelatingGeneralProperty);
|
||||
|
||||
Handle(StepBasic_GeneralProperty) aRelatedGeneralProperty;
|
||||
theData->ReadEntity(theNum, 4, "related_property", theAch, STANDARD_TYPE(StepBasic_GeneralProperty), aRelatedGeneralProperty);
|
||||
|
||||
// Initialize entity
|
||||
theEnt->Init(aName,
|
||||
hasDescription,
|
||||
aDescription,
|
||||
aRelatingGeneralProperty,
|
||||
aRelatedGeneralProperty);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepBasic_RWGeneralPropertyRelationship::WriteStep(StepData_StepWriter& theSW,
|
||||
const Handle(StepBasic_GeneralPropertyRelationship)& theEnt) const
|
||||
{
|
||||
theSW.Send(theEnt->Name());
|
||||
|
||||
if (theEnt->HasDescription())
|
||||
{
|
||||
theSW.Send(theEnt->Description());
|
||||
}
|
||||
else
|
||||
{
|
||||
theSW.SendUndef();
|
||||
}
|
||||
|
||||
theSW.Send(theEnt->RelatingGeneralProperty());
|
||||
|
||||
theSW.Send(theEnt->RelatedGeneralProperty());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Share
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepBasic_RWGeneralPropertyRelationship::Share(const Handle(StepBasic_GeneralPropertyRelationship)& theEnt,
|
||||
Interface_EntityIterator& theIter) const
|
||||
{
|
||||
theIter.AddItem(theEnt->RelatingGeneralProperty());
|
||||
|
||||
theIter.AddItem(theEnt->RelatedGeneralProperty());
|
||||
}
|
@@ -0,0 +1,60 @@
|
||||
// Copyright (c) 2024 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 _RWStepBasic_RWGeneralPropertyRelationship_HeaderFile
|
||||
#define _RWStepBasic_RWGeneralPropertyAssociation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
class StepData_StepReaderData;
|
||||
class Interface_Check;
|
||||
class StepBasic_GeneralProperty;
|
||||
class StepData_StepWriter;
|
||||
class Interface_EntityIterator;
|
||||
|
||||
class StepBasic_GeneralPropertyRelationship;
|
||||
|
||||
//! Read & Write tool for GeneralPropertyRelationship
|
||||
class RWStepBasic_RWGeneralPropertyRelationship
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT RWStepBasic_RWGeneralPropertyRelationship();
|
||||
|
||||
//! Reads GeneralPropertyAssociation
|
||||
Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& theData,
|
||||
const Standard_Integer theNum,
|
||||
Handle(Interface_Check)& theAch,
|
||||
const Handle(StepBasic_GeneralPropertyRelationship)& theEnt) const;
|
||||
|
||||
//! Writes GeneralPropertyAssociation
|
||||
Standard_EXPORT void WriteStep (StepData_StepWriter& theSW,
|
||||
const Handle(StepBasic_GeneralPropertyRelationship)& theEnt) const;
|
||||
|
||||
//! Fills data for graph (shared items)
|
||||
Standard_EXPORT void Share (const Handle(StepBasic_GeneralPropertyRelationship)& theEnt,
|
||||
Interface_EntityIterator& theIter) const;
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif // _RWStepBasic_RWGeneralPropertyRelationship_HeaderFile
|
@@ -8,6 +8,8 @@ RWStepRepr_RWAssemblyComponentUsageSubstitute.cxx
|
||||
RWStepRepr_RWAssemblyComponentUsageSubstitute.hxx
|
||||
RWStepRepr_RWBetweenShapeAspect.cxx
|
||||
RWStepRepr_RWBetweenShapeAspect.hxx
|
||||
RWStepRepr_RWBooleanRepresentationItem.cxx
|
||||
RWStepRepr_RWBooleanRepresentationItem.hxx
|
||||
RWStepRepr_RWCentreOfSymmetry.cxx
|
||||
RWStepRepr_RWCentreOfSymmetry.hxx
|
||||
RWStepRepr_RWCharacterizedRepresentation.cxx
|
||||
@@ -88,6 +90,8 @@ RWStepRepr_RWPropertyDefinitionRepresentation.cxx
|
||||
RWStepRepr_RWPropertyDefinitionRepresentation.hxx
|
||||
RWStepRepr_RWQuantifiedAssemblyComponentUsage.cxx
|
||||
RWStepRepr_RWQuantifiedAssemblyComponentUsage.hxx
|
||||
RWStepRepr_RWRealRepresentationItem.cxx
|
||||
RWStepRepr_RWRealRepresentationItem.hxx
|
||||
RWStepRepr_RWRepresentation.cxx
|
||||
RWStepRepr_RWRepresentation.hxx
|
||||
RWStepRepr_RWRepresentationContext.cxx
|
||||
|
50
src/RWStepRepr/RWStepRepr_RWBooleanRepresentationItem.cxx
Normal file
50
src/RWStepRepr/RWStepRepr_RWBooleanRepresentationItem.cxx
Normal file
@@ -0,0 +1,50 @@
|
||||
// Copyright (c) 2024 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 <RWStepRepr_RWBooleanRepresentationItem.hxx>
|
||||
#include <StepData_StepReaderData.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
#include <StepRepr_BooleanRepresentationItem.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
RWStepRepr_RWBooleanRepresentationItem::RWStepRepr_RWBooleanRepresentationItem()
|
||||
{
|
||||
}
|
||||
|
||||
void RWStepRepr_RWBooleanRepresentationItem::ReadStep(const Handle(StepData_StepReaderData)& theData,
|
||||
const Standard_Integer theNum,
|
||||
Handle(Interface_Check)& theAch,
|
||||
const Handle(StepRepr_BooleanRepresentationItem)& theEnt) const
|
||||
{
|
||||
// Check number of parameters
|
||||
if (!theData->CheckNbParams(theNum, 2, theAch, "boolean_representation_item") ) return;
|
||||
|
||||
// --- inherited field : name ---
|
||||
Handle(TCollection_HAsciiString) aName;
|
||||
theData->ReadString (theNum, 1, "name", theAch, aName);
|
||||
|
||||
// --- own field : value ---
|
||||
Standard_Boolean aValue;
|
||||
theData->ReadBoolean (theNum, 2, "value", theAch, aValue);
|
||||
|
||||
//--- Initialisation of the read entity ---
|
||||
theEnt->Init(aName, aValue);
|
||||
}
|
||||
|
||||
void RWStepRepr_RWBooleanRepresentationItem::WriteStep(StepData_StepWriter& theSW,
|
||||
const Handle(StepRepr_BooleanRepresentationItem)& theEnt) const
|
||||
{
|
||||
theSW.Send(theEnt->Name());
|
||||
theSW.Send(theEnt->Value());
|
||||
}
|
45
src/RWStepRepr/RWStepRepr_RWBooleanRepresentationItem.hxx
Normal file
45
src/RWStepRepr/RWStepRepr_RWBooleanRepresentationItem.hxx
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright (c) 2024 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 _RWStepRepr_RWBooleanRepresentationItem_HeaderFile
|
||||
#define _RWStepRepr_RWBooleanRepresentationItem_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
class StepData_StepReaderData;
|
||||
class Interface_Check;
|
||||
class StepRepr_BooleanRepresentationItem;
|
||||
class StepData_StepWriter;
|
||||
|
||||
|
||||
//! Read & Write Module for BooleanRepresentationItem
|
||||
class RWStepRepr_RWBooleanRepresentationItem
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
Standard_EXPORT RWStepRepr_RWBooleanRepresentationItem();
|
||||
|
||||
Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& theData,
|
||||
const Standard_Integer theNum,
|
||||
Handle(Interface_Check)& theAch,
|
||||
const Handle(StepRepr_BooleanRepresentationItem)& theEnt) const;
|
||||
|
||||
Standard_EXPORT void WriteStep (StepData_StepWriter& theSW,
|
||||
const Handle(StepRepr_BooleanRepresentationItem)& theEnt) const;
|
||||
};
|
||||
#endif // _RWStepRepr_RWBooleanRepresentationItem_HeaderFile
|
50
src/RWStepRepr/RWStepRepr_RWRealRepresentationItem.cxx
Normal file
50
src/RWStepRepr/RWStepRepr_RWRealRepresentationItem.cxx
Normal file
@@ -0,0 +1,50 @@
|
||||
// Copyright (c) 2024 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 <RWStepRepr_RWRealRepresentationItem.hxx>
|
||||
#include <StepData_StepReaderData.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
#include <StepRepr_RealRepresentationItem.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
RWStepRepr_RWRealRepresentationItem::RWStepRepr_RWRealRepresentationItem()
|
||||
{
|
||||
}
|
||||
|
||||
void RWStepRepr_RWRealRepresentationItem::ReadStep(const Handle(StepData_StepReaderData)& theData,
|
||||
const Standard_Integer theNum,
|
||||
Handle(Interface_Check)& theAch,
|
||||
const Handle(StepRepr_RealRepresentationItem)& theEnt) const
|
||||
{
|
||||
// Check number of parameters
|
||||
if (!theData->CheckNbParams (theNum, 2, theAch, "real_representation_item")) return;
|
||||
|
||||
// --- inherited field : name ---
|
||||
Handle(TCollection_HAsciiString) aName;
|
||||
theData->ReadString (theNum, 1, "name", theAch, aName);
|
||||
|
||||
// --- own field : value ---
|
||||
Standard_Real aValue;
|
||||
theData->ReadReal (theNum, 2, "value", theAch, aValue);
|
||||
|
||||
//--- Initialisation of the read entity ---
|
||||
theEnt->Init(aName, aValue);
|
||||
}
|
||||
|
||||
void RWStepRepr_RWRealRepresentationItem::WriteStep(StepData_StepWriter& theSW,
|
||||
const Handle(StepRepr_RealRepresentationItem)& theEnt) const
|
||||
{
|
||||
theSW.Send(theEnt->Name());
|
||||
theSW.Send(theEnt->Value());
|
||||
}
|
46
src/RWStepRepr/RWStepRepr_RWRealRepresentationItem.hxx
Normal file
46
src/RWStepRepr/RWStepRepr_RWRealRepresentationItem.hxx
Normal file
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2024 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 _RWStepRepr_RWRealRepresentationItem_HeaderFile
|
||||
#define _RWStepRepr_RWRealRepresentationItem_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
class StepData_StepReaderData;
|
||||
class Interface_Check;
|
||||
class StepRepr_RealRepresentationItem;
|
||||
class StepData_StepWriter;
|
||||
|
||||
|
||||
//! Read & Write Module for RealRepresentationItem
|
||||
class RWStepRepr_RWRealRepresentationItem
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT RWStepRepr_RWRealRepresentationItem();
|
||||
|
||||
Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& theData,
|
||||
const Standard_Integer theNum,
|
||||
Handle(Interface_Check)& theAch,
|
||||
const Handle(StepRepr_RealRepresentationItem)& theEnt) const;
|
||||
|
||||
Standard_EXPORT void WriteStep (StepData_StepWriter& theSW,
|
||||
const Handle(StepRepr_RealRepresentationItem)& theEnt) const;
|
||||
};
|
||||
#endif // _RWStepRepr_RWRealRepresentationItem_HeaderFile
|
@@ -27,7 +27,7 @@
|
||||
#include <Standard_Real.hxx>
|
||||
#include <StepVisual_FaceOrSurface.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_HArray2OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfTransient.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : RWStepVisual_RWComplexTriangulatedFace
|
||||
@@ -118,15 +118,16 @@ void RWStepVisual_RWComplexTriangulatedFace::ReadStep (const Handle(StepData_Ste
|
||||
}
|
||||
}
|
||||
|
||||
Handle(TColStd_HArray2OfInteger) aTriangleStrips;
|
||||
Handle(TColStd_HArray1OfTransient) aTriangleStrips;
|
||||
Standard_Integer sub7 = 0;
|
||||
if (theData->ReadSubList(theNum, 7, "triangle_strips", theCheck, sub7))
|
||||
{
|
||||
Standard_Integer nb0 = theData->NbParams(sub7);
|
||||
Standard_Integer nbj0 = theData->NbParams(theData->ParamNumber(sub7,1));
|
||||
aTriangleStrips = new TColStd_HArray2OfInteger(1, nb0, 1, nbj0);
|
||||
aTriangleStrips = new TColStd_HArray1OfTransient(1, nb0);
|
||||
for (Standard_Integer i0 = 1; i0 <= nb0; i0++)
|
||||
{
|
||||
Standard_Integer nbj0 = theData->NbParams(theData->ParamNumber(sub7, i0));
|
||||
Handle(TColStd_HArray1OfInteger) aSingleTriangleStrip = new TColStd_HArray1OfInteger(1, nbj0);
|
||||
Standard_Integer subj7 = 0;
|
||||
if ( theData->ReadSubList (sub7, i0, "sub-part(triangle_strips)", theCheck, subj7) ) {
|
||||
Standard_Integer num4 = subj7;
|
||||
@@ -134,21 +135,23 @@ void RWStepVisual_RWComplexTriangulatedFace::ReadStep (const Handle(StepData_Ste
|
||||
{
|
||||
Standard_Integer anIt0;
|
||||
theData->ReadInteger(num4, j0, "integer", theCheck, anIt0);
|
||||
aTriangleStrips->SetValue(i0,j0, anIt0);
|
||||
aSingleTriangleStrip->SetValue(j0, anIt0);
|
||||
}
|
||||
aTriangleStrips->SetValue(i0, aSingleTriangleStrip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Handle(TColStd_HArray2OfInteger) aTriangleFans;
|
||||
Handle(TColStd_HArray1OfTransient) aTriangleFans;
|
||||
Standard_Integer sub8 = 0;
|
||||
if (theData->ReadSubList(theNum, 8, "triangle_fans", theCheck, sub8))
|
||||
{
|
||||
Standard_Integer nb0 = theData->NbParams(sub8);
|
||||
Standard_Integer nbj0 = theData->NbParams(theData->ParamNumber(sub8,1));
|
||||
aTriangleFans = new TColStd_HArray2OfInteger(1, nb0, 1, nbj0);
|
||||
aTriangleFans = new TColStd_HArray1OfTransient(1, nb0);
|
||||
for (Standard_Integer i0 = 1; i0 <= nb0; i0++)
|
||||
{
|
||||
Standard_Integer nbj0 = theData->NbParams(theData->ParamNumber(sub8, i0));
|
||||
Handle(TColStd_HArray1OfInteger) aSingleTriangleFan = new TColStd_HArray1OfInteger(1, nbj0);
|
||||
Standard_Integer subj8 = 0;
|
||||
if ( theData->ReadSubList (sub8, i0, "sub-part(triangle_fans)", theCheck, subj8) ) {
|
||||
Standard_Integer num4 = subj8;
|
||||
@@ -156,8 +159,9 @@ void RWStepVisual_RWComplexTriangulatedFace::ReadStep (const Handle(StepData_Ste
|
||||
{
|
||||
Standard_Integer anIt0;
|
||||
theData->ReadInteger(num4, j0, "integer", theCheck, anIt0);
|
||||
aTriangleFans->SetValue(i0,j0, anIt0);
|
||||
aSingleTriangleFan->SetValue(j0, anIt0);
|
||||
}
|
||||
aTriangleFans->SetValue(i0, aSingleTriangleFan);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -219,13 +223,14 @@ void RWStepVisual_RWComplexTriangulatedFace::WriteStep (StepData_StepWriter& the
|
||||
theSW.CloseSub();
|
||||
|
||||
theSW.OpenSub();
|
||||
for (Standard_Integer i6 = 1; i6 <= theEnt->TriangleStrips()->RowLength(); i6++)
|
||||
for (Standard_Integer i6 = 1; i6 <= theEnt->NbTriangleStrips(); i6++)
|
||||
{
|
||||
theSW.NewLine(Standard_False);
|
||||
theSW.OpenSub();
|
||||
for (Standard_Integer j6 = 1; j6 <= theEnt->TriangleStrips()->ColLength(); j6++)
|
||||
Handle(TColStd_HArray1OfInteger) aTriangleStrip = Handle(TColStd_HArray1OfInteger)::DownCast(theEnt->TriangleStrips()->Value(i6));
|
||||
for (Standard_Integer j6 = 1; j6 <= aTriangleStrip->Length(); j6++)
|
||||
{
|
||||
Standard_Integer Var0 = theEnt->TriangleStrips()->Value(i6,j6);
|
||||
Standard_Integer Var0 = aTriangleStrip->Value(j6);
|
||||
theSW.Send(Var0);
|
||||
}
|
||||
theSW.CloseSub();
|
||||
@@ -233,13 +238,14 @@ void RWStepVisual_RWComplexTriangulatedFace::WriteStep (StepData_StepWriter& the
|
||||
theSW.CloseSub();
|
||||
|
||||
theSW.OpenSub();
|
||||
for (Standard_Integer i7 = 1; i7 <= theEnt->TriangleFans()->RowLength(); i7++)
|
||||
for (Standard_Integer i7 = 1; i7 <= theEnt->NbTriangleFans(); i7++)
|
||||
{
|
||||
theSW.NewLine(Standard_False);
|
||||
theSW.OpenSub();
|
||||
for (Standard_Integer j7 = 1; j7 <= theEnt->TriangleFans()->ColLength(); j7++)
|
||||
Handle(TColStd_HArray1OfInteger) aTriangleFan = Handle(TColStd_HArray1OfInteger)::DownCast(theEnt->TriangleFans()->Value(i7));
|
||||
for (Standard_Integer j7 = 1; j7 <= aTriangleFan->Length(); j7++)
|
||||
{
|
||||
Standard_Integer Var0 = theEnt->TriangleFans()->Value(i7,j7);
|
||||
Standard_Integer Var0 = aTriangleFan->Value(j7);
|
||||
theSW.Send(Var0);
|
||||
}
|
||||
theSW.CloseSub();
|
||||
|
@@ -114,11 +114,13 @@ Interface_EntityIterator& theIter) const
|
||||
{
|
||||
|
||||
// Inherited fields of Representation
|
||||
|
||||
for (Standard_Integer i1 = 1; i1 <= theEnt->StepRepr_Representation::Items()->Length(); i1++)
|
||||
if (!theEnt->StepRepr_Representation::Items().IsNull())
|
||||
{
|
||||
Handle(StepRepr_RepresentationItem) Var0 = theEnt->StepRepr_Representation::Items()->Value(i1);
|
||||
theIter.AddItem(Var0);
|
||||
for (Standard_Integer i1 = 1; i1 <= theEnt->StepRepr_Representation::Items()->Length(); i1++)
|
||||
{
|
||||
Handle(StepRepr_RepresentationItem) Var0 = theEnt->StepRepr_Representation::Items()->Value(i1);
|
||||
theIter.AddItem(Var0);
|
||||
}
|
||||
}
|
||||
|
||||
theIter.AddItem(theEnt->StepRepr_Representation::ContextOfItems());
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -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
|
||||
@@ -116,6 +112,8 @@ bool STEPCAFControl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext
|
||||
theResource->BooleanVal("read.layer", InternalParameters.ReadLayer, aScope);
|
||||
InternalParameters.ReadProps =
|
||||
theResource->BooleanVal("read.props", InternalParameters.ReadProps, aScope);
|
||||
InternalParameters.ReadMetadata =
|
||||
theResource->BooleanVal("read.metadata", InternalParameters.ReadMetadata, aScope);
|
||||
|
||||
InternalParameters.WritePrecisionMode = (WriteMode_PrecisionMode)
|
||||
theResource->IntegerVal("write.precision.mode", InternalParameters.WritePrecisionMode, aScope);
|
||||
@@ -370,6 +368,12 @@ TCollection_AsciiString STEPCAFControl_ConfigurationNode::Save() const
|
||||
aResult += aScope + "read.props :\t " + InternalParameters.ReadProps + "\n";
|
||||
aResult += "!\n";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Setting up the read.metadata parameter which is used to indicate read Metadata or not\n";
|
||||
aResult += "!Default value: 0(\"OFF\"). Available values: 0(\"OFF\"), 1(\"ON\")\n";
|
||||
aResult += aScope + "read.metadata :\t " + InternalParameters.ReadMetadata + "\n";
|
||||
aResult += "!\n";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Write Parameters:\n";
|
||||
aResult += "!\n";
|
||||
|
@@ -207,6 +207,7 @@ public:
|
||||
bool ReadName = true; //<! NameMode is used to indicate read Name or not
|
||||
bool ReadLayer = true; //<! LayerMode is used to indicate read Layers or not
|
||||
bool ReadProps = true; //<! PropsMode is used to indicate read Validation properties or not
|
||||
bool ReadMetadata = true; //! Parameter for metadata reading
|
||||
|
||||
// Write
|
||||
WriteMode_PrecisionMode WritePrecisionMode = WriteMode_PrecisionMode_Average; //<! Specifies the mode of writing the resolution value into the STEP file
|
||||
|
@@ -185,6 +185,7 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
aReader.SetNameMode(aNode->InternalParameters.ReadName);
|
||||
aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
|
||||
aReader.SetPropsMode(aNode->InternalParameters.ReadProps);
|
||||
aReader.SetMetaMode(aNode->InternalParameters.ReadMetadata);
|
||||
|
||||
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
|
||||
aReadStat = aReader.ReadFile(thePath.ToCString());
|
||||
|
@@ -30,9 +30,12 @@
|
||||
#include <StepBasic_ConversionBasedUnitAndLengthUnit.hxx>
|
||||
#include <StepBasic_ConversionBasedUnitAndPlaneAngleUnit.hxx>
|
||||
#include <StepBasic_ConversionBasedUnitAndMassUnit.hxx>
|
||||
#include <StepBasic_ConversionBasedUnitAndTimeUnit.hxx>
|
||||
#include <StepBasic_DerivedUnit.hxx>
|
||||
#include <StepBasic_DerivedUnitElement.hxx>
|
||||
#include <StepBasic_DocumentFile.hxx>
|
||||
#include <StepBasic_GeneralProperty.hxx>
|
||||
#include <StepBasic_GeneralPropertyAssociation.hxx>
|
||||
#include <StepBasic_MeasureValueMember.hxx>
|
||||
#include <StepBasic_NamedUnit.hxx>
|
||||
#include <StepBasic_Product.hxx>
|
||||
@@ -40,6 +43,9 @@
|
||||
#include <StepBasic_ProductDefinitionFormation.hxx>
|
||||
#include <StepBasic_ProductDefinitionWithAssociatedDocuments.hxx>
|
||||
#include <StepBasic_SiUnitAndLengthUnit.hxx>
|
||||
#include <StepBasic_SiUnitAndMassUnit.hxx>
|
||||
#include <StepBasic_SiUnitAndThermodynamicTemperatureUnit.hxx>
|
||||
#include <StepBasic_SiUnitAndTimeUnit.hxx>
|
||||
#include <StepData_GlobalFactors.hxx>
|
||||
#include <STEPCAFControl_Controller.hxx>
|
||||
#include <STEPCAFControl_DataMapOfPDExternFile.hxx>
|
||||
@@ -129,6 +135,7 @@
|
||||
#include <StepShape_DimensionalLocation.hxx>
|
||||
#include <StepShape_EdgeCurve.hxx>
|
||||
#include <StepShape_EdgeLoop.hxx>
|
||||
#include <StepShape_GeometricCurveSet.hxx>
|
||||
#include <StepShape_GeometricSet.hxx>
|
||||
#include <StepShape_HArray1OfFace.hxx>
|
||||
#include <StepShape_HArray1OfFaceBound.hxx>
|
||||
@@ -214,6 +221,7 @@
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <StepAP242_DraughtingModelItemAssociation.hxx>
|
||||
#include <StepAP242_GeometricItemSpecificUsage.hxx>
|
||||
#include <StepAP242_IdAttribute.hxx>
|
||||
#include <StepGeom_CartesianPoint.hxx>
|
||||
#include <STEPCAFControl_GDTProperty.hxx>
|
||||
#include <StepVisual_TessellatedAnnotationOccurrence.hxx>
|
||||
@@ -221,6 +229,14 @@
|
||||
#include <StepVisual_TessellatedCurveSet.hxx>
|
||||
#include <StepVisual_CoordinatesList.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <StepRepr_BooleanRepresentationItem.hxx>
|
||||
#include <StepRepr_IntegerRepresentationItem.hxx>
|
||||
#include <StepRepr_PropertyDefinitionRelationship.hxx>
|
||||
#include <StepRepr_RealRepresentationItem.hxx>
|
||||
#include <StepRepr_ValueRepresentationItem.hxx>
|
||||
|
||||
#include <StepRepr_ShapeAspectRelationship.hxx>
|
||||
|
||||
|
||||
#include <TColgp_HArray1OfXYZ.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
@@ -270,6 +286,7 @@ STEPCAFControl_Reader::STEPCAFControl_Reader()
|
||||
myNameMode(Standard_True),
|
||||
myLayerMode(Standard_True),
|
||||
myPropsMode(Standard_True),
|
||||
myMetaMode(Standard_True),
|
||||
mySHUOMode(Standard_False),
|
||||
myGDTMode(Standard_True),
|
||||
myMatMode(Standard_True),
|
||||
@@ -290,6 +307,7 @@ STEPCAFControl_Reader::STEPCAFControl_Reader(const Handle(XSControl_WorkSession)
|
||||
myNameMode(Standard_True),
|
||||
myLayerMode(Standard_True),
|
||||
myPropsMode(Standard_True),
|
||||
myMetaMode(Standard_True),
|
||||
mySHUOMode(Standard_False),
|
||||
myGDTMode(Standard_True),
|
||||
myMatMode(Standard_True),
|
||||
@@ -718,6 +736,10 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader,
|
||||
if (GetViewMode())
|
||||
ReadViews(reader.WS(), doc);
|
||||
|
||||
// read metadata
|
||||
if (GetMetaMode())
|
||||
ReadMetadata(reader.WS(), doc);
|
||||
|
||||
// Expand resulting CAF structure for sub-shapes (optionally with their
|
||||
// names) if requested
|
||||
ExpandSubShapes(STool, ShapePDMap);
|
||||
@@ -1717,7 +1739,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadSHUOs(const Handle(XSControl_WorkSes
|
||||
//function : GetMassConversionFactor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Boolean GetMassConversionFactor(Handle(StepBasic_NamedUnit)& NU,
|
||||
static Standard_Boolean GetMassConversionFactor(const Handle(StepBasic_NamedUnit)& NU,
|
||||
Standard_Real& afact)
|
||||
{
|
||||
afact = 1.;
|
||||
@@ -4815,6 +4837,26 @@ Standard_Boolean STEPCAFControl_Reader::GetPropsMode() const
|
||||
return myPropsMode;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMetaMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void STEPCAFControl_Reader::SetMetaMode(const Standard_Boolean theMetaMode)
|
||||
{
|
||||
myMetaMode = theMetaMode;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMetaMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Reader::GetMetaMode() const
|
||||
{
|
||||
return myMetaMode;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetSHUOMode
|
||||
//purpose :
|
||||
@@ -4895,3 +4937,506 @@ Standard_Boolean STEPCAFControl_Reader::GetViewMode() const
|
||||
{
|
||||
return myViewMode;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadMetadata
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean STEPCAFControl_Reader::ReadMetadata(const Handle(XSControl_WorkSession)& theWS,
|
||||
const Handle(TDocStd_Document)& theDoc) const
|
||||
{
|
||||
const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
|
||||
const Handle(XSControl_TransferReader)& aTR = theWS->TransferReader();
|
||||
const Handle(Transfer_TransientProcess)& aTP = aTR->TransientProcess();
|
||||
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
|
||||
if (aSTool.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Integer aNb = aModel->NbEntities();
|
||||
STEPConstruct_Tool aTool(theWS);
|
||||
|
||||
TDF_LabelMap aGeneralLabelMap;
|
||||
NCollection_DataMap<TDF_Label, NCollection_Sequence<Handle(StepRepr_PropertyDefinition)>, TDF_LabelMapHasher> anAttrMap;
|
||||
NCollection_DataMap<TDF_Label, NCollection_Sequence<std::pair<TCollection_AsciiString, Handle(TCollection_HAsciiString)>>, TDF_LabelMapHasher> anExtraAttrMap;
|
||||
for (Standard_Integer anEntityInd = 1; anEntityInd <= aNb; ++anEntityInd)
|
||||
{
|
||||
Handle(Standard_Transient) anEntity = aModel->Value(anEntityInd);
|
||||
|
||||
// checking for Product attributes
|
||||
Handle(StepBasic_ProductDefinition) aProdDefinition = Handle(StepBasic_ProductDefinition)::DownCast(anEntity);
|
||||
if (!aProdDefinition.IsNull())
|
||||
{
|
||||
Handle(Transfer_Binder) aBinder = aTP->Find(aProdDefinition);
|
||||
if (!aBinder.IsNull())
|
||||
{
|
||||
TopoDS_Shape aShape = TransferBRep::ShapeResult(aTP, aBinder);
|
||||
if (aShape.IsNull())
|
||||
continue;
|
||||
|
||||
TDF_Label aShapeLabel;
|
||||
if (myMap.IsBound(aShape))
|
||||
{
|
||||
aShapeLabel = myMap.Find(aShape);
|
||||
}
|
||||
if (!aShapeLabel.IsNull())
|
||||
{
|
||||
if (!aGeneralLabelMap.Contains(aShapeLabel))
|
||||
{
|
||||
aGeneralLabelMap.Add(aShapeLabel);
|
||||
}
|
||||
NCollection_Sequence<std::pair<TCollection_AsciiString, Handle(TCollection_HAsciiString)>> anAttrSeq;
|
||||
Handle(StepBasic_Product) aProduct = aProdDefinition->Formation()->OfProduct();
|
||||
anAttrSeq.Append({ "ProductID", aProduct->Id() });
|
||||
anAttrSeq.Append({ "ProductName", aProduct->Name() });
|
||||
anAttrSeq.Append({ "Description", aProduct->Description() });
|
||||
anAttrSeq.Append({ "ProductDefinition", aProdDefinition->Description() });
|
||||
anExtraAttrMap.Bind(aShapeLabel, anAttrSeq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// checking for User Defined Attributes
|
||||
Handle(StepBasic_GeneralProperty) aGeneralProp = Handle(StepBasic_GeneralProperty)::DownCast(anEntity);
|
||||
if (aGeneralProp.IsNull())
|
||||
continue;
|
||||
|
||||
Handle(StepBasic_GeneralPropertyAssociation) aPropAssociation;
|
||||
NCollection_List< Handle(StepRepr_PropertyDefinition)> aPropDefinitionList;
|
||||
Interface_EntityIterator aSharingListOfGP = theWS->Graph().Sharings(aGeneralProp);
|
||||
for (aSharingListOfGP.Start(); aSharingListOfGP.More(); aSharingListOfGP.Next())
|
||||
{
|
||||
aPropAssociation = Handle(StepBasic_GeneralPropertyAssociation)::DownCast(aSharingListOfGP.Value());
|
||||
if (aPropAssociation.IsNull())
|
||||
continue;
|
||||
|
||||
aPropDefinitionList.Append(aPropAssociation->PropertyDefinition());
|
||||
}
|
||||
|
||||
if (aPropDefinitionList.IsEmpty())
|
||||
continue;
|
||||
|
||||
NCollection_List<Handle(StepRepr_PropertyDefinition)> aGroupedProperties;
|
||||
NCollection_List< Handle(StepRepr_PropertyDefinition)>::Iterator aPropDefIter(aPropDefinitionList);
|
||||
for ( ; aPropDefIter.More(); aPropDefIter.Next())
|
||||
{
|
||||
Handle(StepRepr_PropertyDefinition) aPropDefinition = aPropDefIter.Value();
|
||||
|
||||
// check group of PropertyDefinition
|
||||
Interface_EntityIterator aSharingsListOfPD = theWS->Graph().Sharings(aPropDefinition);
|
||||
for (aSharingsListOfPD.Start(); aSharingsListOfPD.More(); aSharingsListOfPD.Next())
|
||||
{
|
||||
Handle(StepRepr_PropertyDefinitionRelationship) aRel =
|
||||
Handle(StepRepr_PropertyDefinitionRelationship)::DownCast(aSharingsListOfPD.Value());
|
||||
if (aRel.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(StepRepr_PropertyDefinition) aGroupedProp = aRel->RelatedPropertyDefinition();
|
||||
if (!aGroupedProp.IsNull())
|
||||
{
|
||||
aGroupedProperties.Append(aGroupedProp);
|
||||
}
|
||||
}
|
||||
|
||||
NCollection_List<Handle(Transfer_Binder)> aBinders;
|
||||
Interface_EntityIterator aSharedListOfPD = theWS->Graph().Shareds(aPropDefinition);
|
||||
for (aSharedListOfPD.Start(); aSharedListOfPD.More(); aSharedListOfPD.Next())
|
||||
{
|
||||
Handle(Transfer_Binder) aBinder;
|
||||
Handle(StepBasic_ProductDefinition) aProductDefinition =
|
||||
Handle(StepBasic_ProductDefinition)::DownCast(aSharedListOfPD.Value());
|
||||
if (!aProductDefinition.IsNull())
|
||||
{
|
||||
aBinder = aTP->Find(aProductDefinition);
|
||||
if (!aBinder.IsNull())
|
||||
{
|
||||
aBinders.Append(aBinder);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(StepRepr_ProductDefinitionShape) aProductDefinitionShape =
|
||||
Handle(StepRepr_ProductDefinitionShape)::DownCast(aSharedListOfPD.Value());
|
||||
if (!aProductDefinitionShape.IsNull())
|
||||
{
|
||||
Handle(StepBasic_ProductDefinition) aProductDef =
|
||||
aProductDefinitionShape->Definition().ProductDefinition();
|
||||
aBinder = aTP->Find(aProductDef);
|
||||
if (!aBinder.IsNull())
|
||||
{
|
||||
aBinders.Append(aBinder);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(StepRepr_NextAssemblyUsageOccurrence) aNextAssembUsOcc =
|
||||
Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(aSharedListOfPD.Value());
|
||||
if (!aNextAssembUsOcc.IsNull())
|
||||
{
|
||||
aBinder = aTP->Find(aNextAssembUsOcc);
|
||||
if (!aBinder.IsNull())
|
||||
{
|
||||
aBinders.Append(aBinder);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(StepRepr_ShapeAspect) aShapeAspect =
|
||||
Handle(StepRepr_ShapeAspect)::DownCast(aSharedListOfPD.Value());
|
||||
if (!aShapeAspect.IsNull())
|
||||
{
|
||||
TDF_Label aLabel;
|
||||
if (!aBinder.IsNull())
|
||||
{
|
||||
TopoDS_Shape aShape = TransferBRep::ShapeResult(aTP, aBinder);
|
||||
if (aShape.IsNull())
|
||||
continue;
|
||||
|
||||
if (myMap.IsBound(aShape))
|
||||
{
|
||||
aLabel = myMap.Find(aShape);
|
||||
}
|
||||
}
|
||||
Interface_EntityIterator aSharedListOfSA = theWS->Graph().Sharings(aShapeAspect);
|
||||
for (aSharedListOfSA.Start(); aSharedListOfSA.More(); aSharedListOfSA.Next())
|
||||
{
|
||||
Handle(StepAP242_DraughtingModelItemAssociation) aDMIA =
|
||||
Handle(StepAP242_DraughtingModelItemAssociation)::DownCast(aSharedListOfSA.Value());
|
||||
if (!aDMIA.IsNull())
|
||||
break;
|
||||
|
||||
Handle(StepAP242_ItemIdentifiedRepresentationUsage) anItemIdentUsage =
|
||||
Handle(StepAP242_ItemIdentifiedRepresentationUsage)::DownCast(aSharedListOfSA.Value());
|
||||
if (!anItemIdentUsage.IsNull())
|
||||
{
|
||||
for (Standard_Integer anIndex = 1; anIndex <= anItemIdentUsage->NbIdentifiedItem(); ++anIndex)
|
||||
{
|
||||
Handle(StepRepr_RepresentationItem) aReprItem = anItemIdentUsage->IdentifiedItemValue(anIndex);
|
||||
if (aReprItem.IsNull())
|
||||
continue;
|
||||
aBinder = aTP->Find(aReprItem);
|
||||
if (!aBinder.IsNull())
|
||||
{
|
||||
aBinders.Append(aBinder);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(StepRepr_PropertyDefinition) aPropDef =
|
||||
Handle(StepRepr_PropertyDefinition)::DownCast(aSharedListOfSA.Value());
|
||||
if (!aPropDef.IsNull() && aPropDef != aPropDefinition)
|
||||
{
|
||||
Interface_EntityIterator aSharingListOfPD = theWS->Graph().Sharings(aPropDef);
|
||||
for (aSharingListOfPD.Start(); aSharingListOfPD.More(); aSharingListOfPD.Next())
|
||||
{
|
||||
Handle(StepShape_ShapeDefinitionRepresentation) aShDef =
|
||||
Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(aSharingListOfPD.Value());
|
||||
if (aShDef.IsNull())
|
||||
continue;
|
||||
|
||||
findReprItems(theWS, aShDef, aBinders);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(StepShape_ShapeDefinitionRepresentation) aShapeDefRepr =
|
||||
Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(aSharedListOfSA.Value());
|
||||
if (!aShapeDefRepr.IsNull())
|
||||
{
|
||||
findReprItems(theWS, aShapeDefRepr, aBinders);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aBinders.IsEmpty())
|
||||
continue;
|
||||
|
||||
TDF_LabelSequence aLabelSeq;
|
||||
NCollection_List<Handle(Transfer_Binder)>::Iterator aBindIt(aBinders);
|
||||
for (; aBindIt.More(); aBindIt.Next())
|
||||
{
|
||||
TopoDS_Shape aShape = TransferBRep::ShapeResult(aTP, aBindIt.Value());
|
||||
if (aShape.IsNull())
|
||||
continue;
|
||||
|
||||
TDF_Label aShapeLabel;
|
||||
if (myMap.IsBound(aShape))
|
||||
{
|
||||
aShapeLabel = myMap.Find(aShape);
|
||||
}
|
||||
if (!aShapeLabel.IsNull())
|
||||
{
|
||||
aLabelSeq.Append(aShapeLabel);
|
||||
if (!aGeneralLabelMap.Contains(aShapeLabel))
|
||||
{
|
||||
aGeneralLabelMap.Add(aShapeLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fill user defined attribute map
|
||||
for (TDF_LabelSequence::Iterator aLabelIt(aLabelSeq); aLabelIt.More(); aLabelIt.Next())
|
||||
{
|
||||
if (anAttrMap.IsBound(aLabelIt.Value()))
|
||||
{
|
||||
anAttrMap.ChangeFind(aLabelIt.Value()).Append(aPropDefinition);
|
||||
if (!aGroupedProperties.IsEmpty())
|
||||
{
|
||||
NCollection_List<Handle(StepRepr_PropertyDefinition)>::Iterator aPropIt(aGroupedProperties);
|
||||
for (; aPropIt.More(); aPropIt.Next())
|
||||
{
|
||||
anAttrMap.ChangeFind(aLabelIt.Value()).Append(aPropIt.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NCollection_Sequence<Handle(StepRepr_PropertyDefinition)> aPropSeq;
|
||||
aPropSeq.Append(aPropDefinition);
|
||||
if (!aGroupedProperties.IsEmpty())
|
||||
{
|
||||
NCollection_List<Handle(StepRepr_PropertyDefinition)>::Iterator aPropIt(aGroupedProperties);
|
||||
for (; aPropIt.More(); aPropIt.Next())
|
||||
{
|
||||
aPropSeq.Append(aPropIt.Value());
|
||||
}
|
||||
}
|
||||
anAttrMap.Bind(aLabelIt.Value(), aPropSeq);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create metadata
|
||||
for (TDF_LabelMap::Iterator aLabelIt(aGeneralLabelMap); aLabelIt.More(); aLabelIt.Next())
|
||||
{
|
||||
Handle(TDataStd_NamedData) anAttr;
|
||||
if (!aLabelIt.Value().FindAttribute(TDataStd_NamedData::GetID(), anAttr))
|
||||
{
|
||||
anAttr = new TDataStd_NamedData;
|
||||
aLabelIt.Value().AddAttribute(anAttr);
|
||||
}
|
||||
if (anAttrMap.IsBound(aLabelIt.Value()))
|
||||
{
|
||||
NCollection_Sequence<Handle(StepRepr_PropertyDefinition)> anAttrib = anAttrMap.Find(aLabelIt.Value());
|
||||
NCollection_Sequence<Handle(StepRepr_PropertyDefinition)>::Iterator aPropIt(anAttrib);
|
||||
for (; aPropIt.More(); aPropIt.Next())
|
||||
{
|
||||
fillAttributes(theWS, aPropIt.Value(), anAttr);
|
||||
}
|
||||
}
|
||||
if (anExtraAttrMap.IsBound(aLabelIt.Value()))
|
||||
{
|
||||
NCollection_Sequence<std::pair<TCollection_AsciiString, Handle(TCollection_HAsciiString)>> aStrSeq = anExtraAttrMap.Find(aLabelIt.Value());
|
||||
if (!aStrSeq.IsEmpty())
|
||||
{
|
||||
NCollection_Sequence<std::pair<TCollection_AsciiString, Handle(TCollection_HAsciiString)>>::Iterator anIt(aStrSeq);
|
||||
for (; anIt.More(); anIt.Next())
|
||||
{
|
||||
auto aPair = anIt.Value();
|
||||
if (aPair.second.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
anAttr->SetString(aPair.first, aPair.second->String());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : findReprItems
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean STEPCAFControl_Reader::findReprItems(const Handle(XSControl_WorkSession)& theWS,
|
||||
const Handle(StepShape_ShapeDefinitionRepresentation)& theShDefRepr,
|
||||
NCollection_List<Handle(Transfer_Binder)>& theBinders) const
|
||||
{
|
||||
Handle(StepRepr_Representation) aRepr = theShDefRepr->UsedRepresentation();
|
||||
if (aRepr.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Handle(Transfer_Binder) aBinder;
|
||||
const Handle(Transfer_TransientProcess)& aTP = theWS->TransferReader()->TransientProcess();
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) aReprItems = aRepr->Items();
|
||||
if (!aReprItems->IsEmpty())
|
||||
{
|
||||
for (Standard_Integer anInd = aReprItems->Lower(); anInd <= aReprItems->Upper(); anInd++)
|
||||
{
|
||||
Handle(StepRepr_RepresentationItem) aReprItem = aReprItems->Value(anInd);
|
||||
aBinder = aTP->Find(aReprItem);
|
||||
if (!aBinder.IsNull())
|
||||
{
|
||||
theBinders.Append(aBinder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : fillAttributes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean STEPCAFControl_Reader::fillAttributes(const Handle(XSControl_WorkSession)& theWS,
|
||||
const Handle(StepRepr_PropertyDefinition)& thePropDef,
|
||||
Handle(TDataStd_NamedData)& theAttr) const
|
||||
{
|
||||
// skip if key is null
|
||||
if (thePropDef->Name().IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Handle(StepRepr_PropertyDefinitionRepresentation) aPropDefRepr;
|
||||
Interface_EntityIterator aSharingListOfPD = theWS->Graph().Sharings(thePropDef);
|
||||
for (aSharingListOfPD.Start(); aSharingListOfPD.More(); aSharingListOfPD.Next())
|
||||
{
|
||||
aPropDefRepr = Handle(StepRepr_PropertyDefinitionRepresentation)::DownCast(aSharingListOfPD.Value());
|
||||
if (aPropDefRepr.IsNull())
|
||||
continue;
|
||||
|
||||
Handle(StepRepr_Representation) aUsedRepr = aPropDefRepr->UsedRepresentation();
|
||||
if (aUsedRepr.IsNull())
|
||||
continue;
|
||||
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) aReprItems = aUsedRepr->Items();
|
||||
if (!aReprItems.IsNull())
|
||||
{
|
||||
for (Standard_Integer anIndex = aReprItems->Lower(); anIndex <= aReprItems->Upper(); anIndex++)
|
||||
{
|
||||
Handle(StepRepr_RepresentationItem) anItem = aReprItems->Value(anIndex);
|
||||
if (anItem.IsNull())
|
||||
continue;
|
||||
|
||||
if (anItem->IsKind(STANDARD_TYPE(StepRepr_DescriptiveRepresentationItem)))
|
||||
{
|
||||
Handle(StepRepr_DescriptiveRepresentationItem) aDescrItem = Handle(StepRepr_DescriptiveRepresentationItem)::DownCast(anItem);
|
||||
Handle(TCollection_HAsciiString) aDescription = aDescrItem->Description();
|
||||
theAttr->SetString(thePropDef->Name()->ToCString(), aDescription->ToCString());
|
||||
}
|
||||
else if (anItem->IsKind(STANDARD_TYPE(StepRepr_MeasureRepresentationItem)))
|
||||
{
|
||||
Handle(StepRepr_MeasureRepresentationItem) aMeasureItem = Handle(StepRepr_MeasureRepresentationItem)::DownCast(anItem);
|
||||
Standard_Real aValue = aMeasureItem->Measure()->ValueComponent();
|
||||
TCollection_AsciiString aValType = aMeasureItem->Measure()->ValueComponentMember()->Name();
|
||||
StepBasic_Unit anUnit = aMeasureItem->Measure()->UnitComponent();
|
||||
if (!anUnit.IsNull())
|
||||
{
|
||||
Standard_Real aParam = 1.;
|
||||
if (anUnit.Type() == STANDARD_TYPE(StepBasic_DerivedUnit))
|
||||
{
|
||||
Handle(StepBasic_DerivedUnit) aDUnit = anUnit.DerivedUnit();
|
||||
for (Standard_Integer anInd = 1; anInd <= aDUnit->NbElements(); ++anInd)
|
||||
{
|
||||
Handle(StepBasic_DerivedUnitElement) aDUElem = aDUnit->ElementsValue(anInd);
|
||||
Standard_Real anExp = aDUElem->Exponent();
|
||||
Handle(StepBasic_NamedUnit) aNUnit = aDUElem->Unit();
|
||||
if (!aNUnit.IsNull())
|
||||
{
|
||||
if (aNUnit->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit)) ||
|
||||
aNUnit->IsKind(STANDARD_TYPE(StepBasic_SiUnitAndLengthUnit)))
|
||||
{
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(aNUnit);
|
||||
if (aValType == "VOLUME_MEASURE")
|
||||
{
|
||||
aParam = pow(anUnitCtx.LengthFactor(), anExp);
|
||||
}
|
||||
else
|
||||
{
|
||||
aParam = aParam * pow(anUnitCtx.LengthFactor()/1000, anExp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(aNUnit);
|
||||
if (anUnitCtx.AreaDone())
|
||||
aParam = anUnitCtx.AreaFactor();
|
||||
if (anUnitCtx.LengthDone())
|
||||
{
|
||||
Standard_Real aLengthFactor = anUnitCtx.LengthFactor();
|
||||
aParam *= pow(aLengthFactor, anExp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
aValue = aValue * aParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(StepBasic_NamedUnit) aNUnit = anUnit.NamedUnit();
|
||||
if (!aNUnit.IsNull())
|
||||
{
|
||||
if (aNUnit->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndMassUnit)))
|
||||
{
|
||||
Standard_Real aFact = 1.;
|
||||
if (GetMassConversionFactor(aNUnit, aFact))
|
||||
{
|
||||
aValue *= aFact;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(aNUnit);
|
||||
if (anUnitCtx.AreaDone())
|
||||
aParam = anUnitCtx.AreaFactor();
|
||||
if (anUnitCtx.VolumeDone())
|
||||
aParam = anUnitCtx.VolumeFactor();
|
||||
if (anUnitCtx.LengthDone())
|
||||
aParam = anUnitCtx.LengthFactor();
|
||||
|
||||
aValue *= aParam;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
theAttr->SetReal(thePropDef->Name()->ToCString(), aValue);
|
||||
}
|
||||
else if (anItem->IsKind(STANDARD_TYPE(StepRepr_ValueRepresentationItem)))
|
||||
{
|
||||
Handle(StepRepr_ValueRepresentationItem) aValueItem = Handle(StepRepr_ValueRepresentationItem)::DownCast(anItem);
|
||||
Handle(StepBasic_MeasureValueMember) aMeasureValueMem = aValueItem->ValueComponentMember();
|
||||
Interface_ParamType aParamType = aMeasureValueMem->ParamType();
|
||||
if (aParamType == Interface_ParamInteger)
|
||||
{
|
||||
theAttr->SetInteger(thePropDef->Name()->ToCString(), aMeasureValueMem->Integer());
|
||||
}
|
||||
else if (aParamType == Interface_ParamReal)
|
||||
{
|
||||
theAttr->SetReal(thePropDef->Name()->ToCString(), aMeasureValueMem->Real());
|
||||
}
|
||||
}
|
||||
else if (anItem->IsKind(STANDARD_TYPE(StepRepr_IntegerRepresentationItem)))
|
||||
{
|
||||
Handle(StepRepr_IntegerRepresentationItem) anIntegerItem = Handle(StepRepr_IntegerRepresentationItem)::DownCast(anItem);
|
||||
theAttr->SetInteger(thePropDef->Name()->ToCString(), anIntegerItem->Value());
|
||||
}
|
||||
else if (anItem->IsKind(STANDARD_TYPE(StepRepr_RealRepresentationItem)))
|
||||
{
|
||||
Handle(StepRepr_RealRepresentationItem) aRealItem = Handle(StepRepr_RealRepresentationItem)::DownCast(anItem);
|
||||
theAttr->SetReal(thePropDef->Name()->ToCString(), aRealItem->Value());
|
||||
}
|
||||
else if (anItem->IsKind(STANDARD_TYPE(StepRepr_BooleanRepresentationItem)))
|
||||
{
|
||||
Handle(StepRepr_BooleanRepresentationItem) aBoolItem = Handle(StepRepr_BooleanRepresentationItem)::DownCast(anItem);
|
||||
theAttr->SetInteger(thePropDef->Name()->ToCString(), aBoolItem->Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -28,16 +28,21 @@
|
||||
#include <XCAFDimTolObjects_DatumModifWithValue.hxx>
|
||||
|
||||
class XSControl_WorkSession;
|
||||
class TDataStd_NamedData;
|
||||
class TDocStd_Document;
|
||||
class STEPCAFControl_ExternFile;
|
||||
class TopoDS_Shape;
|
||||
class XCAFDoc_ShapeTool;
|
||||
class StepRepr_RepresentationItem;
|
||||
class Transfer_TransientProcess;
|
||||
class StepBasic_NamedUnit;
|
||||
class StepShape_ConnectedFaceSet;
|
||||
class StepShape_ShapeDefinitionRepresentation;
|
||||
class StepRepr_NextAssemblyUsageOccurrence;
|
||||
class StepRepr_PropertyDefinition;
|
||||
class STEPConstruct_Tool;
|
||||
class StepDimTol_Datum;
|
||||
class Transfer_Binder;
|
||||
|
||||
|
||||
//! Provides a tool to read STEP file and put it into
|
||||
@@ -155,6 +160,11 @@ public:
|
||||
Standard_EXPORT void SetPropsMode (const Standard_Boolean propsmode);
|
||||
|
||||
Standard_EXPORT Standard_Boolean GetPropsMode() const;
|
||||
|
||||
//! MetaMode for indicate read Metadata or not.
|
||||
Standard_EXPORT void SetMetaMode(const Standard_Boolean theMetaMode);
|
||||
|
||||
Standard_EXPORT Standard_Boolean GetMetaMode() const;
|
||||
|
||||
//! Set SHUO mode for indicate write SHUO or not.
|
||||
Standard_EXPORT void SetSHUOMode (const Standard_Boolean shuomode);
|
||||
@@ -222,6 +232,11 @@ protected:
|
||||
//! model and assigns them to corresponding labels in the DECAF
|
||||
//! document
|
||||
Standard_EXPORT Standard_Boolean ReadValProps (const Handle(XSControl_WorkSession)& WS, const Handle(TDocStd_Document)& doc, const STEPCAFControl_DataMapOfPDExternFile& PDFileMap) const;
|
||||
|
||||
//! Reads metadata assigned to shapes in the STEP model and
|
||||
//! assigns them to corresponding labels in the DECAF document
|
||||
Standard_EXPORT Standard_Boolean ReadMetadata(const Handle(XSControl_WorkSession)& theWS,
|
||||
const Handle(TDocStd_Document)& theDoc) const;
|
||||
|
||||
//! Reads layers of parts defined in the STEP model and
|
||||
//! set reference between shape and layers in the DECAF document
|
||||
@@ -298,6 +313,16 @@ private:
|
||||
void prepareUnits(const Handle(StepData_StepModel)& theModel,
|
||||
const Handle(TDocStd_Document)& theDoc) const;
|
||||
|
||||
//! Find RepresentationItems
|
||||
Standard_Boolean findReprItems(const Handle(XSControl_WorkSession) & theWS,
|
||||
const Handle(StepShape_ShapeDefinitionRepresentation) & theShDefRepr,
|
||||
NCollection_List<Handle(Transfer_Binder)>& theBinders) const;
|
||||
|
||||
//! Fill metadata
|
||||
Standard_Boolean fillAttributes(const Handle(XSControl_WorkSession)& theWS,
|
||||
const Handle(StepRepr_PropertyDefinition)& thePropDef,
|
||||
Handle(TDataStd_NamedData)& theAttr) const;
|
||||
|
||||
private:
|
||||
|
||||
STEPControl_Reader myReader;
|
||||
@@ -307,6 +332,7 @@ private:
|
||||
Standard_Boolean myNameMode;
|
||||
Standard_Boolean myLayerMode;
|
||||
Standard_Boolean myPropsMode;
|
||||
Standard_Boolean myMetaMode;
|
||||
Standard_Boolean mySHUOMode;
|
||||
Standard_Boolean myGDTMode;
|
||||
Standard_Boolean myMatMode;
|
||||
|
@@ -158,6 +158,8 @@ static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERI
|
||||
#include <StepShape_GeometricallyBoundedWireframeShapeRepresentation.hxx>
|
||||
#include <StepRepr_GlobalUncertaintyAssignedContext.hxx>
|
||||
#include <StepRepr_GlobalUnitAssignedContext.hxx>
|
||||
#include <StepBasic_GeneralPropertyAssociation.hxx>
|
||||
#include <StepBasic_GeneralPropertyRelationship.hxx>
|
||||
#include <StepBasic_GroupRelationship.hxx>
|
||||
#include <StepShape_HalfSpaceSolid.hxx>
|
||||
#include <StepGeom_Hyperbola.hxx>
|
||||
@@ -639,7 +641,9 @@ static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERI
|
||||
#include <StepDimTol_GeoTolAndGeoTolWthDatRefAndUneqDisGeoTol.hxx>
|
||||
#include <StepRepr_CompGroupShAspAndCompShAspAndDatumFeatAndShAsp.hxx>
|
||||
#include <StepRepr_CompShAspAndDatumFeatAndShAsp.hxx>
|
||||
#include <StepRepr_BooleanRepresentationItem.hxx>
|
||||
#include <StepRepr_IntegerRepresentationItem.hxx>
|
||||
#include <StepRepr_RealRepresentationItem.hxx>
|
||||
#include <StepRepr_ValueRepresentationItem.hxx>
|
||||
#include <StepAP242_DraughtingModelItemAssociation.hxx>
|
||||
#include <StepDimTol_GeoTolAndGeoTolWthDatRefAndGeoTolWthMaxTol.hxx>
|
||||
@@ -1558,6 +1562,10 @@ StepAP214_Protocol::StepAP214_Protocol ()
|
||||
types.Bind(STANDARD_TYPE(StepVisual_ComplexTriangulatedSurfaceSet), 816);
|
||||
types.Bind(STANDARD_TYPE(StepVisual_CubicBezierTessellatedEdge), 817);
|
||||
types.Bind(STANDARD_TYPE(StepVisual_CubicBezierTriangulatedFace), 818);
|
||||
types.Bind(STANDARD_TYPE(StepBasic_GeneralPropertyAssociation), 819);
|
||||
types.Bind(STANDARD_TYPE(StepBasic_GeneralPropertyRelationship), 820);
|
||||
types.Bind(STANDARD_TYPE(StepRepr_BooleanRepresentationItem), 821);
|
||||
types.Bind(STANDARD_TYPE(StepRepr_RealRepresentationItem), 822);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -135,6 +135,10 @@ StepBasic_ExternalSource.cxx
|
||||
StepBasic_ExternalSource.hxx
|
||||
StepBasic_GeneralProperty.cxx
|
||||
StepBasic_GeneralProperty.hxx
|
||||
StepBasic_GeneralPropertyAssociation.cxx
|
||||
StepBasic_GeneralPropertyAssociation.hxx
|
||||
StepBasic_GeneralPropertyRelationship.cxx
|
||||
StepBasic_GeneralPropertyRelationship.hxx
|
||||
StepBasic_Group.cxx
|
||||
StepBasic_Group.hxx
|
||||
StepBasic_GroupAssignment.cxx
|
||||
|
117
src/StepBasic/StepBasic_GeneralPropertyAssociation.cxx
Normal file
117
src/StepBasic/StepBasic_GeneralPropertyAssociation.cxx
Normal file
@@ -0,0 +1,117 @@
|
||||
// Copyright (c) 2024 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 <StepBasic_GeneralPropertyAssociation.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StepBasic_GeneralPropertyAssociation, Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : StepBasic_GeneralPropertyAssociation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
StepBasic_GeneralPropertyAssociation::StepBasic_GeneralPropertyAssociation ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void StepBasic_GeneralPropertyAssociation::Init (const Handle(TCollection_HAsciiString)& aName,
|
||||
const Handle(TCollection_HAsciiString)& aDescription,
|
||||
const Handle(StepBasic_GeneralProperty)& aGeneralProperty,
|
||||
const Handle(StepRepr_PropertyDefinition)& aPropertyDefinition)
|
||||
{
|
||||
theName = aName;
|
||||
|
||||
theDescription = aDescription;
|
||||
|
||||
theGeneralProperty = aGeneralProperty;
|
||||
|
||||
thePropertyDefinition = aPropertyDefinition;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Name
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TCollection_HAsciiString) StepBasic_GeneralPropertyAssociation::Name() const
|
||||
{
|
||||
return theName;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void StepBasic_GeneralPropertyAssociation::SetName(const Handle(TCollection_HAsciiString)& aName)
|
||||
{
|
||||
theName = aName;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Description
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TCollection_HAsciiString) StepBasic_GeneralPropertyAssociation::Description() const
|
||||
{
|
||||
return theDescription;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDescription
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void StepBasic_GeneralPropertyAssociation::SetDescription (const Handle(TCollection_HAsciiString)& aDescription)
|
||||
{
|
||||
theDescription = aDescription;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GeneralProperty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(StepBasic_GeneralProperty) StepBasic_GeneralPropertyAssociation::GeneralProperty() const
|
||||
{
|
||||
return theGeneralProperty;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetGeneralProperty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void StepBasic_GeneralPropertyAssociation::SetGeneralProperty(const Handle(StepBasic_GeneralProperty)& aGeneralProperty)
|
||||
{
|
||||
theGeneralProperty = aGeneralProperty;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PropertyDefinition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(StepRepr_PropertyDefinition) StepBasic_GeneralPropertyAssociation::PropertyDefinition() const
|
||||
{
|
||||
return thePropertyDefinition;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPropertyDefinition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void StepBasic_GeneralPropertyAssociation::SetPropertyDefinition(const Handle(StepRepr_PropertyDefinition)& aPropertyDefinition)
|
||||
{
|
||||
thePropertyDefinition = aPropertyDefinition;
|
||||
}
|
84
src/StepBasic/StepBasic_GeneralPropertyAssociation.hxx
Normal file
84
src/StepBasic/StepBasic_GeneralPropertyAssociation.hxx
Normal file
@@ -0,0 +1,84 @@
|
||||
// Copyright (c) 2024 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 _StepBasic_GeneralPropertyAssociation_HeaderFile
|
||||
#define _StepBasic_GeneralPropertyAssociation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
class TCollection_HAsciiString;
|
||||
class StepBasic_GeneralProperty;
|
||||
class StepRepr_PropertyDefinition;
|
||||
|
||||
DEFINE_STANDARD_HANDLE(StepBasic_GeneralPropertyAssociation, Standard_Transient)
|
||||
|
||||
//! Representation of STEP entity GeneralPropertyAssociation
|
||||
class StepBasic_GeneralPropertyAssociation : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT StepBasic_GeneralPropertyAssociation();
|
||||
|
||||
//! Initialize all fields (own and inherited)
|
||||
Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& aName,
|
||||
const Handle(TCollection_HAsciiString)& aDescription,
|
||||
const Handle(StepBasic_GeneralProperty)& aGeneralProperty,
|
||||
const Handle(StepRepr_PropertyDefinition)& aPropertyDefinition);
|
||||
|
||||
//! Returns field Name
|
||||
Standard_EXPORT Handle(TCollection_HAsciiString) Name() const;
|
||||
|
||||
//! Set field Name
|
||||
Standard_EXPORT void SetName(const Handle(TCollection_HAsciiString)& Name);
|
||||
|
||||
//! Returns field Description
|
||||
Standard_EXPORT Handle(TCollection_HAsciiString) Description() const;
|
||||
|
||||
//! Set field Description
|
||||
Standard_EXPORT void SetDescription(const Handle(TCollection_HAsciiString)& Description);
|
||||
|
||||
//! Returns field GeneralProperty
|
||||
Standard_EXPORT Handle(StepBasic_GeneralProperty) GeneralProperty() const;
|
||||
|
||||
//! Set field GeneralProperty
|
||||
Standard_EXPORT void SetGeneralProperty(const Handle(StepBasic_GeneralProperty)& GeneralProperty);
|
||||
|
||||
//! Returns field PropertyDefinition
|
||||
Standard_EXPORT Handle(StepRepr_PropertyDefinition) PropertyDefinition() const;
|
||||
|
||||
//! Set field PropertyDefinition
|
||||
Standard_EXPORT void SetPropertyDefinition(const Handle(StepRepr_PropertyDefinition)& PropertyDefinition);
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(StepBasic_GeneralPropertyAssociation, Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Handle(TCollection_HAsciiString) theName;
|
||||
Handle(TCollection_HAsciiString) theDescription;
|
||||
Handle(StepBasic_GeneralProperty) theGeneralProperty;
|
||||
Handle(StepRepr_PropertyDefinition) thePropertyDefinition;
|
||||
|
||||
};
|
||||
|
||||
#endif // _StepBasic_GeneralPropertyAssociation_HeaderFile
|
137
src/StepBasic/StepBasic_GeneralPropertyRelationship.cxx
Normal file
137
src/StepBasic/StepBasic_GeneralPropertyRelationship.cxx
Normal file
@@ -0,0 +1,137 @@
|
||||
// Copyright (c) 2024 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 <StepBasic_GeneralProperty.hxx>
|
||||
#include <StepBasic_GeneralPropertyRelationship.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StepBasic_GeneralPropertyRelationship, Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : StepBasic_GeneralPropertyRelationship
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
StepBasic_GeneralPropertyRelationship::StepBasic_GeneralPropertyRelationship ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void StepBasic_GeneralPropertyRelationship::Init(const Handle(TCollection_HAsciiString)& aName,
|
||||
const Standard_Boolean hasDescription,
|
||||
const Handle(TCollection_HAsciiString)& aDescription,
|
||||
const Handle(StepBasic_GeneralProperty)& aRelatingGeneralProperty,
|
||||
const Handle(StepBasic_GeneralProperty)& aRelatedGeneralProperty)
|
||||
{
|
||||
theName = aName;
|
||||
|
||||
defDescription = hasDescription;
|
||||
if (defDescription) {
|
||||
theDescription = aDescription;
|
||||
}
|
||||
else theDescription.Nullify();
|
||||
|
||||
theRelatingGeneralProperty = aRelatingGeneralProperty;
|
||||
|
||||
theRelatedGeneralProperty = aRelatedGeneralProperty;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Name
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TCollection_HAsciiString) StepBasic_GeneralPropertyRelationship::Name() const
|
||||
{
|
||||
return theName;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void StepBasic_GeneralPropertyRelationship::SetName(const Handle(TCollection_HAsciiString)& aName)
|
||||
{
|
||||
theName = aName;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasDescription
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean StepBasic_GeneralPropertyRelationship::HasDescription() const
|
||||
{
|
||||
return defDescription;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Description
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TCollection_HAsciiString) StepBasic_GeneralPropertyRelationship::Description() const
|
||||
{
|
||||
return theDescription;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDescription
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void StepBasic_GeneralPropertyRelationship::SetDescription (const Handle(TCollection_HAsciiString)& aDescription)
|
||||
{
|
||||
defDescription = true;
|
||||
if (aDescription.IsNull())
|
||||
{
|
||||
defDescription = false;
|
||||
}
|
||||
theDescription = aDescription;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RelatingGeneralProperty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(StepBasic_GeneralProperty) StepBasic_GeneralPropertyRelationship::RelatingGeneralProperty() const
|
||||
{
|
||||
return theRelatingGeneralProperty;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetRelatingGeneralProperty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void StepBasic_GeneralPropertyRelationship::SetRelatingGeneralProperty(const Handle(StepBasic_GeneralProperty)& aRelatingGeneralProperty)
|
||||
{
|
||||
theRelatingGeneralProperty = aRelatingGeneralProperty;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RelatedGeneralProperty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(StepBasic_GeneralProperty) StepBasic_GeneralPropertyRelationship::RelatedGeneralProperty() const
|
||||
{
|
||||
return theRelatedGeneralProperty;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetRelatedGeneralProperty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void StepBasic_GeneralPropertyRelationship::SetRelatedGeneralProperty(const Handle(StepBasic_GeneralProperty)& aRelatedGeneralProperty)
|
||||
{
|
||||
theRelatedGeneralProperty = aRelatedGeneralProperty;
|
||||
}
|
88
src/StepBasic/StepBasic_GeneralPropertyRelationship.hxx
Normal file
88
src/StepBasic/StepBasic_GeneralPropertyRelationship.hxx
Normal file
@@ -0,0 +1,88 @@
|
||||
// Copyright (c) 2024 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 _StepBasic_GeneralPropertyRelationship_HeaderFile
|
||||
#define _StepBasic_GeneralPropertyRelationship_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
class TCollection_HAsciiString;
|
||||
class StepBasic_GeneralProperty;
|
||||
|
||||
DEFINE_STANDARD_HANDLE(StepBasic_GeneralPropertyRelationship, Standard_Transient)
|
||||
|
||||
//! Representation of STEP entity GeneralPropertyRelationship
|
||||
class StepBasic_GeneralPropertyRelationship : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT StepBasic_GeneralPropertyRelationship();
|
||||
|
||||
//! Initialize all fields (own and inherited)
|
||||
Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& aName,
|
||||
const Standard_Boolean hasDescription,
|
||||
const Handle(TCollection_HAsciiString)& aDescription,
|
||||
const Handle(StepBasic_GeneralProperty)& aRelatingGeneralProperty,
|
||||
const Handle(StepBasic_GeneralProperty)& aRelatedGeneralProperty);
|
||||
|
||||
//! Returns field Name
|
||||
Standard_EXPORT Handle(TCollection_HAsciiString) Name() const;
|
||||
|
||||
//! Set field Name
|
||||
Standard_EXPORT void SetName(const Handle(TCollection_HAsciiString)& Name);
|
||||
|
||||
//! Returns True if optional field Description is defined
|
||||
Standard_EXPORT Standard_Boolean HasDescription() const;
|
||||
|
||||
//! Returns field Description
|
||||
Standard_EXPORT Handle(TCollection_HAsciiString) Description() const;
|
||||
|
||||
//! Set field Description
|
||||
Standard_EXPORT void SetDescription(const Handle(TCollection_HAsciiString)& Description);
|
||||
|
||||
//! Returns field RelatingGeneralProperty
|
||||
Standard_EXPORT Handle(StepBasic_GeneralProperty) RelatingGeneralProperty() const;
|
||||
|
||||
//! Set field RelatingGeneralProperty
|
||||
Standard_EXPORT void SetRelatingGeneralProperty(const Handle(StepBasic_GeneralProperty)& RelatingGeneralProperty);
|
||||
|
||||
//! Returns field RelatedGeneralProperty
|
||||
Standard_EXPORT Handle(StepBasic_GeneralProperty) RelatedGeneralProperty() const;
|
||||
|
||||
//! Set field RelatedGeneralProperty
|
||||
Standard_EXPORT void SetRelatedGeneralProperty(const Handle(StepBasic_GeneralProperty)& RelatedGeneralProperty);
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(StepBasic_GeneralPropertyRelationship, Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Standard_Boolean defDescription;
|
||||
Handle(TCollection_HAsciiString) theName;
|
||||
Handle(TCollection_HAsciiString) theDescription;
|
||||
Handle(StepBasic_GeneralProperty) theRelatingGeneralProperty;
|
||||
Handle(StepBasic_GeneralProperty) theRelatedGeneralProperty;
|
||||
|
||||
};
|
||||
|
||||
#endif // _StepBasic_GeneralPropertyRelationship_HeaderFile
|
@@ -62,6 +62,7 @@ Standard_CString StepBasic_MeasureValueMember::Name () const
|
||||
case 13 : return "MASS_MEASURE";
|
||||
case 14 : return "THERMODYNAMIC_TEMPERATURE_MEASURE";
|
||||
case 15 : return "COUNT_MEASURE";
|
||||
case 16 : return "NUMERIC_MEASURE";
|
||||
default : break;
|
||||
}
|
||||
return "";
|
||||
@@ -92,6 +93,7 @@ Standard_Boolean StepBasic_MeasureValueMember::SetName (const Standard_CString
|
||||
else if (name[0] == 'M' && !strcmp (name,"MASS_MEASURE")) thecase = 13;
|
||||
else if (name[1] == 'H' && !strcmp (name,"THERMODYNAMIC_TEMPERATURE_MEASURE")) thecase = 14;
|
||||
else if (name[2] == 'U' && !strcmp (name,"COUNT_MEASURE")) thecase = 15;
|
||||
else if (name[0] == 'N' && !strcmp (name,"NUMERIC_MEASURE")) thecase = 16;
|
||||
else return Standard_False;
|
||||
|
||||
return Standard_True;
|
||||
|
@@ -1000,7 +1000,7 @@ Standard_Boolean StepData_StepReaderData::ReadAny(const Standard_Integer num,
|
||||
case Interface_ParamInteger: {
|
||||
if (!val.IsNull()) {
|
||||
DeclareAndCast(StepData_SelectMember, sm, val);
|
||||
sm->SetInteger(atoi(str));
|
||||
sm->SetReal(Interface_FileReaderData::Fastof(str));
|
||||
return Standard_True;
|
||||
}
|
||||
Handle(StepData_SelectInt) sin = new StepData_SelectInt;
|
||||
@@ -1358,16 +1358,27 @@ Standard_Boolean StepData_StepReaderData::ReadInteger(const Standard_Integer num
|
||||
Standard_Integer& val) const
|
||||
{
|
||||
Handle(String) errmess; // Null si pas d erreur
|
||||
Standard_Boolean warn = Standard_False;
|
||||
if (nump > 0 && nump <= NbParams(num)) {
|
||||
const Interface_FileParameter& FP = Param(num, nump);
|
||||
if (FP.ParamType() == Interface_ParamInteger) val = atoi(FP.CValue());
|
||||
else errmess = new String("Parameter n0.%d (%s) not an Integer");
|
||||
if (FP.ParamType() == Interface_ParamInteger)
|
||||
val = atoi(FP.CValue());
|
||||
else if (FP.ParamType() == Interface_ParamReal)
|
||||
{
|
||||
val = static_cast<Standard_Integer>(std::round(Interface_FileReaderData::Fastof(FP.CValue())));
|
||||
if (acceptvoid) warn = Standard_True;
|
||||
errmess = new String("Parameter n0.%d (%s) was rounded");
|
||||
}
|
||||
if (FP.ParamType() != Interface_ParamInteger &&
|
||||
FP.ParamType() != Interface_ParamReal)
|
||||
errmess = new String("Parameter n0.%d (%s) not an Integer");
|
||||
}
|
||||
else errmess = new String("Parameter n0.%d (%s) absent");
|
||||
|
||||
if (errmess.IsNull()) return Standard_True;
|
||||
sprintf(txtmes, errmess->ToCString(), nump, mess);
|
||||
ach->AddFail(txtmes, errmess->ToCString());
|
||||
if (warn) ach->AddWarning(txtmes, errmess->ToCString());
|
||||
else ach->AddFail(txtmes, errmess->ToCString());
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,8 @@ StepRepr_AssemblyComponentUsageSubstitute.cxx
|
||||
StepRepr_AssemblyComponentUsageSubstitute.hxx
|
||||
StepRepr_BetweenShapeAspect.cxx
|
||||
StepRepr_BetweenShapeAspect.hxx
|
||||
StepRepr_BooleanRepresentationItem.cxx
|
||||
StepRepr_BooleanRepresentationItem.hxx
|
||||
StepRepr_CentreOfSymmetry.cxx
|
||||
StepRepr_CentreOfSymmetry.hxx
|
||||
StepRepr_CharacterizedDefinition.cxx
|
||||
@@ -110,6 +112,8 @@ StepRepr_PropertyDefinitionRepresentation.cxx
|
||||
StepRepr_PropertyDefinitionRepresentation.hxx
|
||||
StepRepr_QuantifiedAssemblyComponentUsage.cxx
|
||||
StepRepr_QuantifiedAssemblyComponentUsage.hxx
|
||||
StepRepr_RealRepresentationItem.cxx
|
||||
StepRepr_RealRepresentationItem.hxx
|
||||
StepRepr_Representation.cxx
|
||||
StepRepr_Representation.hxx
|
||||
StepRepr_RepresentationContext.cxx
|
||||
|
28
src/StepRepr/StepRepr_BooleanRepresentationItem.cxx
Normal file
28
src/StepRepr/StepRepr_BooleanRepresentationItem.cxx
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2024 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 <StepRepr_BooleanRepresentationItem.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StepRepr_BooleanRepresentationItem, StepRepr_RepresentationItem)
|
||||
|
||||
StepRepr_BooleanRepresentationItem::StepRepr_BooleanRepresentationItem()
|
||||
{
|
||||
}
|
||||
|
||||
void StepRepr_BooleanRepresentationItem::Init(const Handle(TCollection_HAsciiString)& theName,
|
||||
const Standard_Boolean theValue)
|
||||
{
|
||||
value = theValue;
|
||||
StepRepr_RepresentationItem::Init(theName);
|
||||
}
|
52
src/StepRepr/StepRepr_BooleanRepresentationItem.hxx
Normal file
52
src/StepRepr/StepRepr_BooleanRepresentationItem.hxx
Normal file
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2024 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 _StepRepr_BooleanRepresentationItem_HeaderFile
|
||||
#define _StepRepr_BooleanRepresentationItem_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <StepRepr_RepresentationItem.hxx>
|
||||
class TCollection_HAsciiString;
|
||||
|
||||
class StepRepr_BooleanRepresentationItem;
|
||||
DEFINE_STANDARD_HANDLE(StepRepr_BooleanRepresentationItem, StepRepr_RepresentationItem)
|
||||
|
||||
class StepRepr_BooleanRepresentationItem : public StepRepr_RepresentationItem
|
||||
{
|
||||
public:
|
||||
|
||||
//! Returns a BooleanRepresentationItem
|
||||
Standard_EXPORT StepRepr_BooleanRepresentationItem();
|
||||
|
||||
Standard_EXPORT void Init (const Handle(TCollection_HAsciiString)& theName, const Standard_Boolean theValue);
|
||||
|
||||
inline void SetValue(const Standard_Boolean theValue)
|
||||
{
|
||||
value = theValue;
|
||||
}
|
||||
|
||||
inline Standard_Boolean Value() const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(StepRepr_BooleanRepresentationItem, StepRepr_RepresentationItem)
|
||||
|
||||
private:
|
||||
|
||||
Standard_Boolean value;
|
||||
};
|
||||
|
||||
#endif // _StepRepr_BooleanRepresentationItem_HeaderFile
|
28
src/StepRepr/StepRepr_RealRepresentationItem.cxx
Normal file
28
src/StepRepr/StepRepr_RealRepresentationItem.cxx
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2024 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 <StepRepr_RealRepresentationItem.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StepRepr_RealRepresentationItem, StepRepr_RepresentationItem)
|
||||
|
||||
StepRepr_RealRepresentationItem::StepRepr_RealRepresentationItem()
|
||||
{
|
||||
}
|
||||
|
||||
void StepRepr_RealRepresentationItem::Init(const Handle(TCollection_HAsciiString)& theName,
|
||||
const Standard_Real theValue)
|
||||
{
|
||||
value = theValue;
|
||||
StepRepr_RepresentationItem::Init(theName);
|
||||
}
|
53
src/StepRepr/StepRepr_RealRepresentationItem.hxx
Normal file
53
src/StepRepr/StepRepr_RealRepresentationItem.hxx
Normal file
@@ -0,0 +1,53 @@
|
||||
// Copyright (c) 2024 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 _StepRepr_RealRepresentationItem_HeaderFile
|
||||
#define _StepRepr_RealRepresentationItem_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <StepRepr_RepresentationItem.hxx>
|
||||
class TCollection_HAsciiString;
|
||||
|
||||
class StepRepr_RealRepresentationItem;
|
||||
DEFINE_STANDARD_HANDLE(StepRepr_RealRepresentationItem, StepRepr_RepresentationItem)
|
||||
|
||||
class StepRepr_RealRepresentationItem : public StepRepr_RepresentationItem
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Returns a RealRepresentationItem
|
||||
Standard_EXPORT StepRepr_RealRepresentationItem();
|
||||
|
||||
Standard_EXPORT void Init (const Handle(TCollection_HAsciiString)& theName, const Standard_Real theValue);
|
||||
|
||||
inline void SetValue(const Standard_Real theValue)
|
||||
{
|
||||
value = theValue;
|
||||
}
|
||||
|
||||
inline Standard_Real Value() const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(StepRepr_RealRepresentationItem, StepRepr_RepresentationItem)
|
||||
|
||||
private:
|
||||
|
||||
Standard_Real value;
|
||||
};
|
||||
|
||||
#endif // _StepRepr_RealRepresentationItem_HeaderFile
|
@@ -96,7 +96,7 @@
|
||||
// To proceed with I-DEAS-like STP (ssv; 15.11.2010)
|
||||
//#define DEBUG
|
||||
// ============================================================================
|
||||
// Method : StepToTopoDS_TranslateFace::StepToTopoDS_TranslateFace
|
||||
// Method : StepToTopoDS_TranslateFace
|
||||
// Purpose : Empty Constructor
|
||||
// ============================================================================
|
||||
StepToTopoDS_TranslateFace::StepToTopoDS_TranslateFace()
|
||||
@@ -540,24 +540,25 @@ StepToTopoDS_TranslateFace::createMesh(const Handle(StepVisual_ComplexTriangulat
|
||||
{
|
||||
Handle(StepVisual_CoordinatesList) aCoords = theTF->Coordinates();
|
||||
Handle(TColgp_HArray1OfXYZ) aNodes = aCoords->Points();
|
||||
Handle(TColStd_HArray2OfInteger) aTriaStrips = theTF->TriangleStrips();
|
||||
Handle(TColStd_HArray2OfInteger) aTriaFans = theTF->TriangleFans();
|
||||
Handle(TColStd_HArray1OfTransient) aTriaStrips = theTF->TriangleStrips();
|
||||
Handle(TColStd_HArray1OfTransient) aTriaFans = theTF->TriangleFans();
|
||||
const Standard_Boolean aHasUVNodes = Standard_False;
|
||||
const Standard_Boolean aHasNormals = (theTF->NbNormals() > 0);
|
||||
|
||||
Standard_Integer aNbTriaStrips = 0;
|
||||
for (Standard_Integer i = 1; i <= theTF->NbTriangleStrips(); ++i)
|
||||
{
|
||||
for (Standard_Integer j = 3; j <= aTriaStrips->UpperCol(); j += 2)
|
||||
Handle(TColStd_HArray1OfInteger) aTriangleStrip = Handle(TColStd_HArray1OfInteger)::DownCast(aTriaStrips->Value(i));
|
||||
for (Standard_Integer j = 3; j <= aTriangleStrip->Length(); j += 2)
|
||||
{
|
||||
if (aTriaStrips->Value(i, j) != aTriaStrips->Value(i, j - 2) &&
|
||||
aTriaStrips->Value(i, j) != aTriaStrips->Value(i, j - 1))
|
||||
if (aTriangleStrip->Value(j) != aTriangleStrip->Value(j - 2) &&
|
||||
aTriangleStrip->Value(j) != aTriangleStrip->Value(j - 1))
|
||||
++aNbTriaStrips;
|
||||
}
|
||||
for (Standard_Integer j = 4; j <= aTriaStrips->UpperCol(); j += 2)
|
||||
for (Standard_Integer j = 4; j <= aTriangleStrip->Length(); j += 2)
|
||||
{
|
||||
if (aTriaStrips->Value(i, j) != aTriaStrips->Value(i, j - 2) &&
|
||||
aTriaStrips->Value(i, j) != aTriaStrips->Value(i, j - 1))
|
||||
if (aTriangleStrip->Value(j) != aTriangleStrip->Value(j - 2) &&
|
||||
aTriangleStrip->Value(j) != aTriangleStrip->Value(j - 1))
|
||||
++aNbTriaStrips;
|
||||
}
|
||||
}
|
||||
@@ -565,12 +566,8 @@ StepToTopoDS_TranslateFace::createMesh(const Handle(StepVisual_ComplexTriangulat
|
||||
Standard_Integer aNbTriaFans = 0;
|
||||
for (Standard_Integer i = 1; i <= theTF->NbTriangleFans(); ++i)
|
||||
{
|
||||
Standard_Integer v1 = aTriaStrips->Value(i, 1);
|
||||
for (Standard_Integer j = 3; j <= aTriaStrips->UpperCol(); ++j)
|
||||
{
|
||||
if (aTriaStrips->Value(i, j) != v1 && aTriaStrips->Value(i, j - 1) != v1)
|
||||
++aNbTriaFans;
|
||||
}
|
||||
Handle(TColStd_HArray1OfInteger) aTriangleFan = Handle(TColStd_HArray1OfInteger)::DownCast(aTriaFans->Value(i));
|
||||
aNbTriaFans += aTriangleFan->Length() - 2;
|
||||
}
|
||||
|
||||
Handle(Poly_Triangulation) aMesh = new Poly_Triangulation(theTF->NbPnindex(),
|
||||
@@ -583,27 +580,42 @@ StepToTopoDS_TranslateFace::createMesh(const Handle(StepVisual_ComplexTriangulat
|
||||
aMesh->SetNode(j, aLF * aPoint);
|
||||
}
|
||||
|
||||
Standard_Integer k = 1;
|
||||
for (Standard_Integer i = 1; i <= theTF->NbTriangleStrips(); ++i)
|
||||
Standard_Integer aTriangleIndex = 1;
|
||||
for (Standard_Integer aTrianStripIndex = 1; aTrianStripIndex <= theTF->NbTriangleStrips(); ++aTrianStripIndex)
|
||||
{
|
||||
for (Standard_Integer j = 3; j <= aTriaStrips->UpperCol(); j += 2)
|
||||
Handle(TColStd_HArray1OfInteger) aTriangleStrip = Handle(TColStd_HArray1OfInteger)::DownCast(aTriaStrips->Value(aTrianStripIndex));
|
||||
for (Standard_Integer anIndex = 3; anIndex <= aTriangleStrip->Length(); anIndex += 2)
|
||||
{
|
||||
if (aTriaStrips->Value(i, j) != aTriaStrips->Value(i, j - 2) &&
|
||||
aTriaStrips->Value(i, j) != aTriaStrips->Value(i, j - 1))
|
||||
if (aTriangleStrip->Value(anIndex) != aTriangleStrip->Value(anIndex - 2) &&
|
||||
aTriangleStrip->Value(anIndex) != aTriangleStrip->Value(anIndex - 1))
|
||||
{
|
||||
aMesh->SetTriangle(k++, Poly_Triangle(aTriaStrips->Value(i, j - 2),
|
||||
aTriaStrips->Value(i, j),
|
||||
aTriaStrips->Value(i, j - 1)));
|
||||
aMesh->SetTriangle(aTriangleIndex++, Poly_Triangle(aTriangleStrip->Value(anIndex - 2),
|
||||
aTriangleStrip->Value(anIndex),
|
||||
aTriangleStrip->Value(anIndex - 1)));
|
||||
}
|
||||
}
|
||||
for (Standard_Integer j = 4; j <= aTriaStrips->UpperCol(); j += 2)
|
||||
for (Standard_Integer anIndex = 4; anIndex <= aTriangleStrip->Length(); anIndex += 2)
|
||||
{
|
||||
if (aTriaStrips->Value(i, j) != aTriaStrips->Value(i, j - 2) &&
|
||||
aTriaStrips->Value(i, j) != aTriaStrips->Value(i, j - 1))
|
||||
if (aTriangleStrip->Value(anIndex) != aTriangleStrip->Value(anIndex - 2) &&
|
||||
aTriangleStrip->Value(anIndex) != aTriangleStrip->Value(anIndex - 1))
|
||||
{
|
||||
aMesh->SetTriangle(k++, Poly_Triangle(aTriaStrips->Value(i, j - 2),
|
||||
aTriaStrips->Value(i, j - 1),
|
||||
aTriaStrips->Value(i, j)));
|
||||
aMesh->SetTriangle(aTriangleIndex++, Poly_Triangle(aTriangleStrip->Value(anIndex - 2),
|
||||
aTriangleStrip->Value(anIndex - 1),
|
||||
aTriangleStrip->Value(anIndex)));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Standard_Integer aTrianFanIndex = 1; aTrianFanIndex <= theTF->NbTriangleFans(); ++aTrianFanIndex)
|
||||
{
|
||||
Handle(TColStd_HArray1OfInteger) aTriangleFan = Handle(TColStd_HArray1OfInteger)::DownCast(aTriaFans->Value(aTrianFanIndex));
|
||||
for (Standard_Integer anIndex = 3; anIndex <= aTriangleFan->Length(); ++anIndex)
|
||||
{
|
||||
if (aTriangleFan->Value(anIndex) != aTriangleFan->Value(anIndex - 2) &&
|
||||
aTriangleFan->Value(anIndex - 1) != aTriangleFan->Value(anIndex - 2))
|
||||
{
|
||||
aMesh->SetTriangle(aTriangleIndex++, Poly_Triangle(aTriangleFan->Value(1),
|
||||
aTriangleFan->Value(anIndex),
|
||||
aTriangleFan->Value(anIndex - 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -39,8 +39,8 @@ void StepVisual_ComplexTriangulatedFace::Init (const Handle(TCollection_HAsciiSt
|
||||
const Standard_Boolean theHasTessellatedFace_GeometricLink,
|
||||
const StepVisual_FaceOrSurface& theTessellatedFace_GeometricLink,
|
||||
const Handle(TColStd_HArray1OfInteger)& thePnindex,
|
||||
const Handle(TColStd_HArray2OfInteger)& theTriangleStrips,
|
||||
const Handle(TColStd_HArray2OfInteger)& theTriangleFans)
|
||||
const Handle(TColStd_HArray1OfTransient)& theTriangleStrips,
|
||||
const Handle(TColStd_HArray1OfTransient)& theTriangleFans)
|
||||
{
|
||||
StepVisual_TessellatedFace::Init(theRepresentationItem_Name,
|
||||
theTessellatedFace_Coordinates,
|
||||
@@ -107,7 +107,7 @@ Standard_Integer StepVisual_ComplexTriangulatedFace::PnindexValue(const Standard
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TColStd_HArray2OfInteger) StepVisual_ComplexTriangulatedFace::TriangleStrips () const
|
||||
Handle(TColStd_HArray1OfTransient) StepVisual_ComplexTriangulatedFace::TriangleStrips () const
|
||||
{
|
||||
return myTriangleStrips;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ Handle(TColStd_HArray2OfInteger) StepVisual_ComplexTriangulatedFace::TriangleStr
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void StepVisual_ComplexTriangulatedFace::SetTriangleStrips(const Handle(TColStd_HArray2OfInteger)& theTriangleStrips)
|
||||
void StepVisual_ComplexTriangulatedFace::SetTriangleStrips(const Handle(TColStd_HArray1OfTransient)& theTriangleStrips)
|
||||
{
|
||||
myTriangleStrips = theTriangleStrips;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ Standard_Integer StepVisual_ComplexTriangulatedFace::NbTriangleStrips() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return myTriangleStrips->ColLength();
|
||||
return myTriangleStrips->Length();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -141,7 +141,7 @@ Standard_Integer StepVisual_ComplexTriangulatedFace::NbTriangleStrips() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TColStd_HArray2OfInteger) StepVisual_ComplexTriangulatedFace::TriangleFans () const
|
||||
Handle(TColStd_HArray1OfTransient) StepVisual_ComplexTriangulatedFace::TriangleFans () const
|
||||
{
|
||||
return myTriangleFans;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ Handle(TColStd_HArray2OfInteger) StepVisual_ComplexTriangulatedFace::TriangleFan
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void StepVisual_ComplexTriangulatedFace::SetTriangleFans(const Handle(TColStd_HArray2OfInteger)& theTriangleFans)
|
||||
void StepVisual_ComplexTriangulatedFace::SetTriangleFans(const Handle(TColStd_HArray1OfTransient)& theTriangleFans)
|
||||
{
|
||||
myTriangleFans = theTriangleFans;
|
||||
}
|
||||
@@ -167,5 +167,5 @@ Standard_Integer StepVisual_ComplexTriangulatedFace::NbTriangleFans() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return myTriangleFans->ColLength();
|
||||
return myTriangleFans->Length();
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include <StepVisual_TessellatedFace.hxx>
|
||||
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_HArray2OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfTransient.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(StepVisual_ComplexTriangulatedFace, StepVisual_TessellatedFace)
|
||||
|
||||
@@ -43,8 +43,8 @@ public :
|
||||
const Standard_Boolean theHasTessellatedFace_GeometricLink,
|
||||
const StepVisual_FaceOrSurface& theTessellatedFace_GeometricLink,
|
||||
const Handle(TColStd_HArray1OfInteger)& thePnindex,
|
||||
const Handle(TColStd_HArray2OfInteger)& theTriangleStrips,
|
||||
const Handle(TColStd_HArray2OfInteger)& theTriangleFans);
|
||||
const Handle(TColStd_HArray1OfTransient)& theTriangleStrips,
|
||||
const Handle(TColStd_HArray1OfTransient)& theTriangleFans);
|
||||
|
||||
//! Returns field Pnindex
|
||||
Standard_EXPORT Handle(TColStd_HArray1OfInteger) Pnindex() const;
|
||||
@@ -59,19 +59,19 @@ public :
|
||||
Standard_EXPORT Standard_Integer PnindexValue(const Standard_Integer theNum) const;
|
||||
|
||||
//! Returns field TriangleStrips
|
||||
Standard_EXPORT Handle(TColStd_HArray2OfInteger) TriangleStrips() const;
|
||||
Standard_EXPORT Handle(TColStd_HArray1OfTransient) TriangleStrips() const;
|
||||
|
||||
//! Sets field TriangleStrips
|
||||
Standard_EXPORT void SetTriangleStrips (const Handle(TColStd_HArray2OfInteger)& theTriangleStrips);
|
||||
Standard_EXPORT void SetTriangleStrips (const Handle(TColStd_HArray1OfTransient)& theTriangleStrips);
|
||||
|
||||
//! Returns number of TriangleStrips
|
||||
Standard_EXPORT Standard_Integer NbTriangleStrips() const;
|
||||
|
||||
//! Returns field TriangleFans
|
||||
Standard_EXPORT Handle(TColStd_HArray2OfInteger) TriangleFans() const;
|
||||
Standard_EXPORT Handle(TColStd_HArray1OfTransient) TriangleFans() const;
|
||||
|
||||
//! Sets field TriangleFans
|
||||
Standard_EXPORT void SetTriangleFans (const Handle(TColStd_HArray2OfInteger)& theTriangleFans);
|
||||
Standard_EXPORT void SetTriangleFans (const Handle(TColStd_HArray1OfTransient)& theTriangleFans);
|
||||
|
||||
//! Returns number of TriangleFans
|
||||
Standard_EXPORT Standard_Integer NbTriangleFans() const;
|
||||
@@ -81,8 +81,8 @@ public :
|
||||
private:
|
||||
|
||||
Handle(TColStd_HArray1OfInteger) myPnindex;
|
||||
Handle(TColStd_HArray2OfInteger) myTriangleStrips;
|
||||
Handle(TColStd_HArray2OfInteger) myTriangleFans;
|
||||
Handle(TColStd_HArray1OfTransient) myTriangleStrips;
|
||||
Handle(TColStd_HArray1OfTransient) myTriangleFans;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
XCAFApp
|
||||
XCAFAnimObjects
|
||||
XCAFDimTolObjects
|
||||
XCAFNoteObjects
|
||||
XCAFDoc
|
||||
XCAFPrs
|
||||
XCAFView
|
||||
XCAFView
|
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@@ -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
20
src/XCAFAnimObjects/FILES
Normal 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
|
33
src/XCAFAnimObjects/XCAFAnimObjects_AnimObject.cxx
Normal file
33
src/XCAFAnimObjects/XCAFAnimObjects_AnimObject.cxx
Normal 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)
|
||||
{}
|
59
src/XCAFAnimObjects/XCAFAnimObjects_AnimObject.hxx
Normal file
59
src/XCAFAnimObjects/XCAFAnimObjects_AnimObject.hxx
Normal 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
|
52
src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.cxx
Normal file
52
src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.cxx
Normal 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)
|
||||
{}
|
56
src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.hxx
Normal file
56
src/XCAFAnimObjects/XCAFAnimObjects_CustomOperation.hxx
Normal 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
|
27
src/XCAFAnimObjects/XCAFAnimObjects_InterpolationType.hxx
Normal file
27
src/XCAFAnimObjects/XCAFAnimObjects_InterpolationType.hxx
Normal 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
|
43
src/XCAFAnimObjects/XCAFAnimObjects_Operation.cxx
Normal file
43
src/XCAFAnimObjects/XCAFAnimObjects_Operation.cxx
Normal 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)
|
||||
{}
|
67
src/XCAFAnimObjects/XCAFAnimObjects_Operation.hxx
Normal file
67
src/XCAFAnimObjects/XCAFAnimObjects_Operation.hxx
Normal 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
|
29
src/XCAFAnimObjects/XCAFAnimObjects_OperationType.hxx
Normal file
29
src/XCAFAnimObjects/XCAFAnimObjects_OperationType.hxx
Normal 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
|
90
src/XCAFAnimObjects/XCAFAnimObjects_Orient.cxx
Normal file
90
src/XCAFAnimObjects/XCAFAnimObjects_Orient.cxx
Normal 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;
|
||||
}
|
56
src/XCAFAnimObjects/XCAFAnimObjects_Orient.hxx
Normal file
56
src/XCAFAnimObjects/XCAFAnimObjects_Orient.hxx
Normal 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
|
86
src/XCAFAnimObjects/XCAFAnimObjects_Rotate.cxx
Normal file
86
src/XCAFAnimObjects/XCAFAnimObjects_Rotate.cxx
Normal 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)
|
||||
{}
|
84
src/XCAFAnimObjects/XCAFAnimObjects_Rotate.hxx
Normal file
84
src/XCAFAnimObjects/XCAFAnimObjects_Rotate.hxx
Normal 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
|
87
src/XCAFAnimObjects/XCAFAnimObjects_Scale.cxx
Normal file
87
src/XCAFAnimObjects/XCAFAnimObjects_Scale.cxx
Normal 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;
|
||||
}
|
56
src/XCAFAnimObjects/XCAFAnimObjects_Scale.hxx
Normal file
56
src/XCAFAnimObjects/XCAFAnimObjects_Scale.hxx
Normal 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
|
87
src/XCAFAnimObjects/XCAFAnimObjects_Skew.cxx
Normal file
87
src/XCAFAnimObjects/XCAFAnimObjects_Skew.cxx
Normal 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;
|
||||
}
|
57
src/XCAFAnimObjects/XCAFAnimObjects_Skew.hxx
Normal file
57
src/XCAFAnimObjects/XCAFAnimObjects_Skew.hxx
Normal 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
|
114
src/XCAFAnimObjects/XCAFAnimObjects_Transform.cxx
Normal file
114
src/XCAFAnimObjects/XCAFAnimObjects_Transform.cxx
Normal 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;
|
||||
}
|
56
src/XCAFAnimObjects/XCAFAnimObjects_Transform.hxx
Normal file
56
src/XCAFAnimObjects/XCAFAnimObjects_Transform.hxx
Normal 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
|
88
src/XCAFAnimObjects/XCAFAnimObjects_Translate.cxx
Normal file
88
src/XCAFAnimObjects/XCAFAnimObjects_Translate.cxx
Normal file
@@ -0,0 +1,88 @@
|
||||
// Copyright (c) 2023 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include "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;
|
||||
}
|
56
src/XCAFAnimObjects/XCAFAnimObjects_Translate.hxx
Normal file
56
src/XCAFAnimObjects/XCAFAnimObjects_Translate.hxx
Normal 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
|
@@ -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
|
||||
|
@@ -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 :
|
||||
|
@@ -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
|
||||
|
450
src/XCAFDoc/XCAFDoc_Animation.cxx
Normal file
450
src/XCAFDoc/XCAFDoc_Animation.cxx
Normal 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;
|
||||
}
|
55
src/XCAFDoc/XCAFDoc_Animation.hxx
Normal file
55
src/XCAFDoc/XCAFDoc_Animation.hxx
Normal 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
|
437
src/XCAFDoc/XCAFDoc_AnimationTool.cxx
Normal file
437
src/XCAFDoc/XCAFDoc_AnimationTool.cxx
Normal 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;
|
||||
}
|
130
src/XCAFDoc/XCAFDoc_AnimationTool.hxx
Normal file
130
src/XCAFDoc/XCAFDoc_AnimationTool.hxx
Normal 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
|
@@ -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));
|
||||
}
|
||||
|
@@ -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);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user