1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

..

18 Commits

Author SHA1 Message Date
nmanchen
f53c218335 Merge branch 'master' into CR32857_use_trim_surface 2022-12-02 05:38:49 +03:00
smoskvin
057dcfddf7 0033225: Changing the status of tests on Ubuntu 20.04 and Windows 64 VC142 2022-11-28 00:04:06 +03:00
atereshi
3837b3bf28 0033217: DRAW - Missed Standard_EXPORT attribute in DrawTrSurf_Set* functions 2022-11-25 13:03:27 +03:00
nmanchen
acaaf4f598 0032857: Error when finding the intersection between a new face made after a draft and the inner face of body
myGeom is now initialized by input surface for Draft_FaceInfo even if its type is Geom_RectangularTrimmedSurface.
input cylindric faces is not necessary to be trimmed (fixes bug712_1)
2022-11-24 07:14:11 +03:00
gelin
db2bfd1e83 0032818: Modeling Algorithms - Result of sweep operation is invalid
BRepFill_TrimShellCorner.cxx - setting correct orientation for NewEdge
tests/pipe/bugs/bug32818 - new test case added
2022-11-21 20:13:47 +03:00
ika
a855215141 0030256: ACIS Import - crash while importing SAT file on constructing a pipe
Fix for thin section with both first and last parameters located in one segment.
2022-11-21 20:11:13 +03:00
ifv
195aac3a42 0033193: Modeling Algorithms - Regression: UnifySameDomain raises SIGSEGV
ShapeUpgrade_UnifySameDomain.cxx - method ReconstructMissedSeam is improved.

tests/bugs/heal/bug33193 - new test case added
2022-11-21 20:10:06 +03:00
atereshi
f706dd34b3 0027122: Data Exchange - invalid shapes are produced during model translation due to huge face tolerance
Problem: The shape has two faces that dimensions are less than tolerance in the specified STEP file. This situation produces the invalid shape.
Change: Shape process has operator FixFaceSize, that is exactly suitable for this shape. The only option of FixFaceSize operator was added to InterfaceStatic, to manage the operator from DRAW command.
Result: The shape without artifacts can be reproduced from STEP file with an extra healing procedure.
2022-11-21 20:06:04 +03:00
ifv
c325231de6 0033179: Modeling Algorithms - Crash in ShapeFix_Shape with the attached object, when healing for fixing SameParameterFlag
BSplCLib_2.cxx - method MergeBSplineKnots is modified in order to have always not empty result.
Geom2dConvert.cxx - in static function MultNumandDenom tolerance for comparing knots is decreased.

tests/bugs/modalg_8/bug33179 test case added
2022-11-21 20:03:35 +03:00
ifv
91a2f58f8f 0026441: Modeling Algorithms - BRepOffset_MakeOffset affects original shape
BRepOffset_MakeOffset.cxx - tolerance control for building planar faces is implemented,
                            updating tolerance for initial entities is avoided

BRepAlgo_Loop.cxx - "total" setting tolerance 0.001 is removing

BRepLib.cxx - checking of "locked" for vertex is removing in static function UpdShTol

QABugs_20.cxx - add new command OCC26441 for checking tolerance differenses between two "identical" shapes

tests/bugs/modalg_7/bug30054 - case now is "BAD", because really result shape is invalid: many faces has not closed wires with huge gaps between ends of edges. Result was "OK" only because tolerances of vertices were increased by algorithm to cover all gaps.

tests/bugs/modalg_8/bug26441 - new test case added

Other test: B3, C8, A7, C8: they were "BAD" and now are "BAD", only some problems are changed.
2022-11-21 20:00:23 +03:00
ifv
8175a70c4e 0033173: Modeling Algorithms - Regression in BRepExtrema_DistShapeShape causing Standard_OutOfRange exception
Extrema/Extrema_ExtCC.cxx - checking number of solutions is added

tests/bugs/modalg_8/bug33173 - test case added
2022-11-21 19:57:45 +03:00
atereshi
f9990707fe 0033187: Modeling Algorithms - Crash in postprocessing of imported shape
Problem: Desynchronization of behaviors of GeomAdaptor_Curve::NbIntervals and
 GeomAdaptor_Curve::Intervals functions. First calculates number of intervals, then
 array is created and second fills the array. In some cases the size of array
 is less than need for filling.

Change:
1. Added function BSplCLib::Intervals that calculates number of interval and fills
 the array with its (if needed).
2. Simplified the algorithm of intervals calculation.
3. GeomAdaptor_Curve::NbIntervals/Intervals and Geom2dAdaptor_Curve::NbIntervals/Intervals
 use BSplCLib::Intervals.
4. When creating an adapter for the base curve, the boundaries of the adapter for the offset curve are applied.
5. Test for problem shape was created: bugs modalg_8 bug33187.

Result: The new approach eliminates the problem of writing outside the array bounds.
2022-11-21 19:53:59 +03:00
knosulko
aba5c241c6 0033144: Modeling Algorithms - Wrong result of Shape Proximity
Added step of refinement the coarser of the two shapes meshes to produce two meshes with approximately the same density.
Added tests lowalgos/proximity.

Fixed accounting of parameters to adjust number of initial sample points
2022-11-21 19:50:40 +03:00
ifv
cc164fd7dc 0033170: Modeling Algorithms - Checking for canonical geometry: plane detection problems
GeomLib_IsPlanarSurface.cxx - using poles for checking BSpline, Bezier curves and surface changed
                              on checking by curve, surface points.

BRepOffset_MakeOffset.cxx - set normal of plane surface according to normal of initial face surface

tests/cr/bugs/bug33170 - new test case added
2022-11-21 19:44:10 +03:00
ona
d7d89acb39 0032977: OCC V7.5, V7.6 cannot read STEP color correctly for the root label, but v6.8 can
- color overriding mechanism is implemented for assembles, parts and instances
2022-11-21 19:41:08 +03:00
Eugeny Maltchikov
d444cc35c6 0033171: Modeling Algorithms - Invalid result of faces unification
Avoid unification of the faces belonging to the different shells.
2022-11-21 19:38:22 +03:00
nmanchen
7b98ef4e57 0032857: Error when finding the intersection between a new face made after a draft and the inner face of body
myGeom is now initialized by input surface for Draft_FaceInfo even if its type is Geom_RectangularTrimmedSurface.
2022-11-14 08:45:25 +03:00
smoskvin
eeba62cbd3 Increment OCCT version up to 7.8.0dev 2022-11-12 01:20:10 +03:00
200 changed files with 2661 additions and 6773 deletions

View File

@@ -1,31 +0,0 @@
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 Normal file
View File

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

View File

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

View File

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

View File

@@ -15,8 +15,6 @@ 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
@@ -57,7 +55,6 @@ if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
pushd "%BUILD_DIR%"
cmake -G "%arch_compile%" ^
-D BUILD_CPP_STANDARD:STRING="%BUILD_CPP_STANDARD%" ^
-D 3RDPARTY_DIR:STRING="%OCCT3RDPARTY%" ^
-D BUILD_ADDITIONAL_TOOLKITS:STRING="%BUILD_ADDITIONAL_TOOLKITS%" ^
-D BUILD_DOC_Overview:BOOL=%BUILD_DOC_Overview% ^

View File

@@ -14,13 +14,12 @@ 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
@@ -55,7 +54,6 @@ if [ ! -d "$BUILD_DIR" ]; then mkdir -p "$BUILD_DIR"; fi
pushd "$BUILD_DIR"
cmake -G "Unix Makefiles" \
-D BUILD_CPP_STANDARD:STRING="$BUILD_CPP_STANDARD" \
-D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
-D 3RDPARTY_DIR:PATH="$OCCT3RDPARTY" \
-D 3RDPARTY_FREETYPE_DIR:PATH="$FREETYPE_DIR" \

View File

@@ -26,12 +26,6 @@ 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"
@@ -50,38 +44,9 @@ 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%" )
@@ -93,8 +58,23 @@ 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
)
@@ -135,6 +115,10 @@ if not ["%1"] == ["-nopause"] (
goto :eof
:cmakeGenerate
set "aPlatformAndCompiler=wasm32%aBuildTypePrefix%"
set "aWorkDir=%aBuildRoot%\occt-%aPlatformAndCompiler%-make"
set "aDestDir=%aBuildRoot%\occt-%aPlatformAndCompiler%"
set "aLogFile=%aBuildRoot%\occt-%aPlatformAndCompiler%-build.log"
if ["%toCMake%"] == ["1"] (
if ["%toClean%"] == ["1"] (
rmdir /S /Q %aWorkDir%"
@@ -144,6 +128,10 @@ if ["%toCMake%"] == ["1"] (
if not exist "%aWorkDir%" ( mkdir "%aWorkDir%" )
if exist "%aLogFile%" ( del "%aLogFile%" )
set "aSrcRootSmpl=%aCasSrc%\samples\webgl"
set "aWorkDirSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%-make"
set "aDestDirSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%"
set "aLogFileSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%-build.log"
if ["%toBuildSample%"] == ["1"] (
if ["%toCMake%"] == ["1"] (
if ["%toClean%"] == ["1"] (

View File

@@ -4,11 +4,6 @@
# 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
@@ -26,12 +21,6 @@ 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
@@ -44,14 +33,19 @@ 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
@@ -66,14 +60,14 @@ if [ "${toCMake}" = "1" ]; then
echo "Configuring OCCT for WASM..."
echo cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="${aToolchain}" \
-DCMAKE_BUILD_TYPE:STRING="$CMAKE_BUILD_TYPE" \
-DCMAKE_BUILD_TYPE:STRING="Release" \
-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/freetype2" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include/freetype2" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
-DBUILD_MODULE_FoundationClasses:BOOL="ON" \
-DBUILD_MODULE_ModelingData:BOOL="${BUILD_ModelingData}" \
-DBUILD_MODULE_ModelingAlgorithms:BOOL="${BUILD_ModelingAlgorithms}" \
@@ -84,14 +78,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="$CMAKE_BUILD_TYPE" \
-DCMAKE_BUILD_TYPE:STRING="Release" \
-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/freetype2" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include/freetype2" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
-DBUILD_MODULE_FoundationClasses:BOOL="ON" \
-DBUILD_MODULE_ModelingData:BOOL="${BUILD_ModelingData}" \
-DBUILD_MODULE_ModelingAlgorithms:BOOL="${BUILD_ModelingAlgorithms}" \

View File

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

View File

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

View File

@@ -42,12 +42,14 @@
#include <TopTools_SequenceOfShape.hxx>
#include <stdio.h>
//#define OCCT_DEBUG_ALGO
//#define DRAW
#ifdef DRAW
#include <DBRep.hxx>
#pragma comment(lib,"TKDraw")
#endif
#ifdef OCCT_DEBUG_ALGO
Standard_Boolean AffichLoop = Standard_False;
Standard_Boolean AffichLoop = Standard_True;
Standard_Integer NbLoops = 0;
Standard_Integer NbWires = 1;
static char* name = new char[100];
@@ -58,7 +60,8 @@ static char* name = new char[100];
//purpose :
//=======================================================================
BRepAlgo_Loop::BRepAlgo_Loop()
BRepAlgo_Loop::BRepAlgo_Loop():
myTolConf (0.001)
{
}
@@ -185,7 +188,6 @@ static TopoDS_Vertex UpdateClosedEdge(const TopoDS_Edge& E,
Standard_Boolean OnStart = 0, OnEnd = 0;
//// modified by jgv, 13.04.04 for OCC5634 ////
TopExp::Vertices (E,V1,V2);
//Standard_Real Tol = Precision::Confusion();
Standard_Real Tol = BRep_Tool::Tolerance( V1 );
///////////////////////////////////////////////
@@ -427,13 +429,12 @@ static void StoreInMVE (const TopoDS_Face& F,
TopoDS_Edge& E,
TopTools_IndexedDataMapOfShapeListOfShape& MVE,
Standard_Boolean& YaCouture,
TopTools_DataMapOfShapeShape& VerticesForSubstitute )
TopTools_DataMapOfShapeShape& VerticesForSubstitute,
const Standard_Real theTolConf)
{
TopoDS_Vertex V1, V2, V;
TopTools_ListOfShape Empty;
Standard_Real Tol = 0.001; //5.e-05; //5.e-07;
// gp_Pnt P1, P2, P;
gp_Pnt P1, P;
BRep_Builder BB;
for (Standard_Integer iV = 1; iV <= MVE.Extent(); iV++)
@@ -449,7 +450,7 @@ static void StoreInMVE (const TopoDS_Face& F,
{
V1 = TopoDS::Vertex( itl.Value() );
P1 = BRep_Tool::Pnt( V1 );
if (P.IsEqual( P1, Tol ) && !V.IsSame(V1))
if (P.IsEqual( P1, theTolConf ) && !V.IsSame(V1))
{
V.Orientation( V1.Orientation() );
if (VerticesForSubstitute.IsBound( V1 ))
@@ -574,7 +575,7 @@ void BRepAlgo_Loop::Perform()
TopoDS_Edge& E = TopoDS::Edge(itl1.Value());
if (!Emap.Add(E))
continue;
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute);
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute, myTolConf);
}
}
}
@@ -586,7 +587,7 @@ void BRepAlgo_Loop::Perform()
for (itl.Initialize(myConstEdges); itl.More(); itl.Next()) {
TopoDS_Edge& E = TopoDS::Edge(itl.Value());
if (DejaVu.Add(E))
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute);
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute, myTolConf);
}
#ifdef DRAW
@@ -626,42 +627,42 @@ void BRepAlgo_Loop::Perform()
//--------------------------------
RemovePendingEdges(MVE);
if (MVE.Extent() == 0) break;
if (MVE.Extent() == 0) break;
//--------------------------------
// Start edge.
//--------------------------------
EF = CE = TopoDS::Edge(MVE(1).First());
TopExp::Vertices(CE,V1,V2);
TopExp::Vertices(CE, V1, V2);
//--------------------------------
// VF vertex start of new wire
//--------------------------------
if (CE.Orientation() == TopAbs_FORWARD) { CV = VF = V1;}
else { CV = VF = V2;}
if (CE.Orientation() == TopAbs_FORWARD) { CV = VF = V1; }
else { CV = VF = V2; }
if (!MVE.Contains(CV)) continue;
TopTools_ListOfShape& aListEdges = MVE.ChangeFromKey(CV);
for ( itl.Initialize(aListEdges); itl.More(); itl.Next()) {
for (itl.Initialize(aListEdges); itl.More(); itl.Next()) {
if (itl.Value().IsEqual(CE)) {
aListEdges.Remove(itl);
break;
aListEdges.Remove(itl);
break;
}
}
End = Standard_False;
End = Standard_False;
while (!End) {
//-------------------------------
// Construction of a wire.
//-------------------------------
TopExp::Vertices(CE,V1,V2);
TopExp::Vertices(CE, V1, V2);
if (!CV.IsSame(V1)) CV = V1; else CV = V2;
B.Add (NW,CE);
B.Add(NW, CE);
UsedEdges.Add(CE);
if (!MVE.Contains(CV) || MVE.FindFromKey(CV).IsEmpty()) {
End = Standard_True;
}
else {
End = !SelectEdge(myFace,CE,CV,NE,MVE.ChangeFromKey(CV));
End = !SelectEdge(myFace, CE, CV, NE, MVE.ChangeFromKey(CV));
if (!End) {
CE = NE;
if (MVE.FindFromKey(CV).IsEmpty())
@@ -672,35 +673,41 @@ void BRepAlgo_Loop::Perform()
//--------------------------------------------------
// Add new wire to the set of wires
//------------------------------------------------
Standard_Real Tol = 0.001; //5.e-05; //5.e-07;
TopExp_Explorer explo( NW, TopAbs_VERTEX );
for (; explo.More(); explo.Next())
{
const TopoDS_Vertex& aV = TopoDS::Vertex( explo.Current() );
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &(aV).TShape());
TV->Tolerance( Tol );
TV->Modified( Standard_True );
}
for (explo.Init( NW, TopAbs_EDGE ); explo.More(); explo.Next())
{
const TopoDS_Edge& aE = TopoDS::Edge( explo.Current() );
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &(aE).TShape());
TE->Tolerance( Tol );
TE->Modified( Standard_True );
}
if (VF.IsSame(CV) && SamePnt2d(VF,EF,CE,myFace))
if (VF.IsSame(CV))
{
NW.Closed (Standard_True);
myNewWires.Append (NW);
if (SamePnt2d(VF, EF, CE, myFace))
{
NW.Closed(Standard_True);
myNewWires.Append(NW);
}
else if(BRep_Tool::Tolerance(VF) < myTolConf)
{
BRep_Builder aBB;
aBB.UpdateVertex(VF, myTolConf);
if (SamePnt2d(VF, EF, CE, myFace))
{
NW.Closed(Standard_True);
myNewWires.Append(NW);
}
#ifdef OCCT_DEBUG_ALGO
else
{
std::cout << "BRepAlgo_Loop: Open Wire" << std::endl;
if (AffichLoop)
std::cout << "OpenWire is : NW_" << NbLoops << "_" << NbWires << std::endl;
}
#endif
}
}
#ifdef OCCT_DEBUG_ALGO
else {
std::cout <<"BRepAlgo_Loop: Open Wire"<<std::endl;
std::cout << "BRepAlgo_Loop: Open Wire" << std::endl;
if (AffichLoop)
std::cout << "OpenWire is : NW_"<<NbLoops<<"_"<<NbWires<<std::endl;
}
std::cout << "OpenWire is : NW_" << NbLoops << "_" << NbWires << std::endl;
}
#endif
#ifdef DRAW
if (AffichLoop) {
sprintf(name,"NW_%d_%d",NbLoops,NbWires++);
@@ -777,8 +784,6 @@ void BRepAlgo_Loop::CutEdge (const TopoDS_Edge& E,
VF = TopoDS::Vertex(aLocalV);
aLocalV = VCEI.Oriented(TopAbs_REVERSED);
VL = TopoDS::Vertex(aLocalV);
// VF = TopoDS::Vertex(VCEI.Oriented(TopAbs_FORWARD));
// VL = TopoDS::Vertex(VCEI.Oriented(TopAbs_REVERSED));
}
SV.Prepend(VF);
SV.Append(VL);
@@ -813,13 +818,9 @@ void BRepAlgo_Loop::CutEdge (const TopoDS_Edge& E,
B.Add (NewEdge,aLocalEdge);
aLocalEdge = V2.Oriented(TopAbs_REVERSED);
B.Add (TopoDS::Edge(NewEdge),aLocalEdge);
// B.Add (NewEdge,V1.Oriented(TopAbs_FORWARD));
// B.Add (NewEdge,V2.Oriented(TopAbs_REVERSED));
if (V1.IsSame(VF))
U1 = f;
else
// U1=BRep_Tool::Parameter
// (TopoDS::Vertex(V1.Oriented(TopAbs_INTERNAL)),WE);
{
TopoDS_Shape aLocalV = V1.Oriented(TopAbs_INTERNAL);
U1=BRep_Tool::Parameter(TopoDS::Vertex(aLocalV),WE);
@@ -830,8 +831,6 @@ void BRepAlgo_Loop::CutEdge (const TopoDS_Edge& E,
{
TopoDS_Shape aLocalV = V2.Oriented(TopAbs_INTERNAL);
U2=BRep_Tool::Parameter(TopoDS::Vertex(aLocalV),WE);
// U2=BRep_Tool::Parameter
// (TopoDS::Vertex(V2.Oriented(TopAbs_INTERNAL)),WE);
}
B.Range (TopoDS::Edge(NewEdge),U1,U2);
#ifdef DRAW

View File

@@ -86,8 +86,17 @@ public:
Standard_EXPORT void VerticesForSubstitute (TopTools_DataMapOfShapeShape& VerVerMap);
//! Set maximal tolerance used for comparing distaces between vertices.
void SetTolConf(const Standard_Real theTolConf)
{
myTolConf = theTolConf;
}
//! Get maximal tolerance used for comparing distaces between vertices.
Standard_Real GetTolConf() const
{
return myTolConf;
}
protected:
@@ -108,6 +117,7 @@ private:
TopTools_DataMapOfShapeListOfShape myCutEdges;
TopTools_DataMapOfShapeShape myVerticesForSubstitute;
BRepAlgo_Image myImageVV;
Standard_Real myTolConf;
};

View File

@@ -43,6 +43,8 @@ BRepExtrema_ProximityDistTool::BRepExtrema_ProximityDistTool()
//=======================================================================
BRepExtrema_ProximityDistTool::BRepExtrema_ProximityDistTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Standard_Integer theNbSamples1,
const BVH_Array3d& theAddVertices1,
const NCollection_Vector<ProxPnt_Status>& theAddStatus1,
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2)
@@ -55,6 +57,7 @@ BRepExtrema_ProximityDistTool::BRepExtrema_ProximityDistTool (const Handle(BRepE
{
LoadTriangleSets (theSet1, theSet2);
LoadShapeLists (theShapeList1, theShapeList2);
LoadAdditionalPointsFirstSet (theAddVertices1, theAddStatus1);
}
//=======================================================================
@@ -69,7 +72,7 @@ void BRepExtrema_ProximityDistTool::LoadTriangleSets (const Handle(BRepExtrema_T
}
//=======================================================================
//function : LoadTriangleSets
//function : LoadShapeLists
//purpose : Loads the given list of subshapes into the proximity tool
//=======================================================================
void BRepExtrema_ProximityDistTool::LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
@@ -78,23 +81,33 @@ void BRepExtrema_ProximityDistTool::LoadShapeLists (const BRepExtrema_ShapeList&
myShapeList1 = theShapeList1;
myShapeList2 = theShapeList2;
}
//=======================================================================
//function : Perform
//purpose : Performs searching of the proximity distance
//=======================================================================
void BRepExtrema_ProximityDistTool::Perform()
{
SetBVHSet (mySet2.get());
const BVH_Array3d& aVertices1 = mySet1->GetVertices();
Standard_Integer aVtxSize = (Standard_Integer)aVertices1.size();
//=======================================================================
//function : LoadAdditionalPointsFirstSet
//purpose : Loads given additional vertices and their statuses
//=======================================================================
void BRepExtrema_ProximityDistTool::LoadAdditionalPointsFirstSet (const BVH_Array3d& theAddVertices1,
const NCollection_Vector<ProxPnt_Status>& theAddStatus1)
{
myAddVertices1 = theAddVertices1;
myAddStatus1 = theAddStatus1;
}
//=======================================================================
//function : goThroughtSet1
//purpose : Goes throught vertices from the 1st set
//=======================================================================
void BRepExtrema_ProximityDistTool::goThroughtSet1 (const BVH_Array3d& theVertices1,
const Standard_Boolean theIsAdditionalSet)
{
Standard_Integer aVtxSize = (Standard_Integer)theVertices1.size();
Standard_Integer aVtxStep = Max (myNbSamples1 <= 0 ? 1 : aVtxSize / myNbSamples1, 1);
for (Standard_Integer aVtxIdx = 0; aVtxIdx < aVtxSize; aVtxIdx += aVtxStep)
{
myDistance = std::numeric_limits<Standard_Real>::max();
myMinDistance = std::numeric_limits<Standard_Real>::max();
myIsDone = Standard_False;
SetObject (aVertices1[aVtxIdx]);
SetObject (theVertices1[aVtxIdx]);
ComputeDistance();
@@ -102,20 +115,31 @@ void BRepExtrema_ProximityDistTool::Perform()
if (IsDone() && myDistance > myProxDist)
{
myPnt1 = aVertices1[aVtxIdx];
myPnt1 = theVertices1[aVtxIdx];
myPnt2 = myExtremaPoint;
myProxDist = myDistance;
myProxVtxIdx1 = aVtxIdx;
myIsProxVtx1FromAddSet = theIsAdditionalSet;
myProxPrjState = myExtPrjState;
}
}
}
myIsDone = myProxDist > -1.;
//=======================================================================
//function : Perform
//purpose : Performs searching of the proximity distance
//=======================================================================
void BRepExtrema_ProximityDistTool::Perform()
{
SetBVHSet (mySet2.get());
goThroughtSet1 (mySet1->GetVertices(), Standard_False);
goThroughtSet1 (myAddVertices1, Standard_True);
if (myIsDone)
{
DefineStatusProxPnt();
}
myIsDone = myProxDist > -1.;
if (myIsDone)
{
DefineStatusProxPnt();
}
}
static Standard_Real pointBoxSquareMaxDistance (const BVH_Vec3d& thePoint,
@@ -247,7 +271,12 @@ Standard_Real BRepExtrema_ProximityDistTool::ComputeDistance()
return myDistance;
}
static Standard_Boolean isNodeOnBorder (const Standard_Integer theNodeIdx, const Handle (Poly_Triangulation)& theTr)
//=======================================================================
//function : IsNodeOnBorder
//purpose : Returns true if the node is on the boarder
//=======================================================================
Standard_Boolean BRepExtrema_ProximityDistTool::IsNodeOnBorder (const Standard_Integer theNodeIdx,
const Handle(Poly_Triangulation)& theTr)
{
Poly_Connect aPolyConnect (theTr);
@@ -279,12 +308,49 @@ static Standard_Boolean isNodeOnBorder (const Standard_Integer theNodeIdx, const
return Standard_False;
}
//=======================================================================
//function : IsEdgeOnBorder
//purpose : Returns true if the edge is on the boarder
//=======================================================================
Standard_Boolean BRepExtrema_ProximityDistTool::IsEdgeOnBorder (const Standard_Integer theTrgIdx,
const Standard_Integer theFirstEdgeNodeIdx,
const Standard_Integer theSecondEdgeNodeIdx,
const Handle(Poly_Triangulation)& theTr)
{
Poly_Connect aPolyConnect (theTr);
Standard_Integer aAdjTrg[3];
aPolyConnect.Triangles (theTrgIdx, aAdjTrg[0], aAdjTrg[1], aAdjTrg[2]); //indices of adjacent triangles
for (Standard_Integer j = 0; j < 3; j++)
{
Standard_Integer k = (j + 1) % 3;
if (aAdjTrg[j] == 0) //free segment of triangle
{
//are ends of free segment and it is a part of border
if (j == theFirstEdgeNodeIdx &&
k == theSecondEdgeNodeIdx)
{
return Standard_True;
}
}
}
return Standard_False;
}
//=======================================================================
//function : defineStatusProxPnt1
//purpose : Defines the status of proximity point from 1st BVH
//=======================================================================
void BRepExtrema_ProximityDistTool::defineStatusProxPnt1()
{
if (myIsProxVtx1FromAddSet)
{
myPntStatus1 = myAddStatus1[myProxVtxIdx1];
return;
}
Standard_Integer aFaceID1 = mySet1->GetShapeIDOfVtx (myProxVtxIdx1);
if (myShapeList1 (aFaceID1).ShapeType() == TopAbs_EDGE)
@@ -314,9 +380,9 @@ void BRepExtrema_ProximityDistTool::defineStatusProxPnt1()
TopLoc_Location aLocation;
const TopoDS_Face& aF = TopoDS::Face (myShapeList1 (aFaceID1));
Handle (Poly_Triangulation) aTr = BRep_Tool::Triangulation (aF, aLocation);
Handle(Poly_Triangulation) aTr = BRep_Tool::Triangulation (aF, aLocation);
if (isNodeOnBorder (aNodeIdx, aTr))
if (IsNodeOnBorder (aNodeIdx, aTr))
{
myPntStatus1 = ProxPnt_Status_BORDER;
}
@@ -398,7 +464,7 @@ void BRepExtrema_ProximityDistTool::defineStatusProxPnt2()
{
TopLoc_Location aLocation;
const TopoDS_Face& aF = TopoDS::Face (myShapeList2 (aFaceID2));
Handle (Poly_Triangulation) aTr = BRep_Tool::Triangulation (aF, aLocation);
Handle(Poly_Triangulation) aTr = BRep_Tool::Triangulation (aF, aLocation);
NCollection_Array1<Standard_Integer> aVtxIndicesOfTrg;
mySet2->GetVtxIndices (aTrgIdx, aVtxIndicesOfTrg);
@@ -408,7 +474,7 @@ void BRepExtrema_ProximityDistTool::defineStatusProxPnt2()
Standard_Integer aNodeNum = myProxPrjState.GetNumberOfFirstNode();
Standard_Integer aNodeIdx = mySet2->GetVtxIdxInShape (aVtxIndicesOfTrg[aNodeNum]) + 1;
if (isNodeOnBorder (aNodeIdx, aTr))
if (IsNodeOnBorder (aNodeIdx, aTr))
{
myPntStatus2 = ProxPnt_Status_BORDER;
}
@@ -419,27 +485,18 @@ void BRepExtrema_ProximityDistTool::defineStatusProxPnt2()
}
else if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_EDGE)
{
myPntStatus2 = ProxPnt_Status_MIDDLE;
Poly_Connect aPolyConnect (aTr);
Standard_Integer aTrgIdxInShape = mySet2->GetTrgIdxInShape (aTrgIdx) + 1;
Standard_Integer aAdjTrg[3];
aPolyConnect.Triangles (aTrgIdxInShape, aAdjTrg[0], aAdjTrg[1], aAdjTrg[2]); //indices of adjacent triangles
for (Standard_Integer j = 0; j < 3; j++)
if (IsEdgeOnBorder (aTrgIdxInShape,
myProxPrjState.GetNumberOfFirstNode(),
myProxPrjState.GetNumberOfLastNode(),
aTr))
{
Standard_Integer k = (j + 1) % 3;
if (aAdjTrg[j] == 0) //free segment of triangle
{
//aVtxIndicesOfTrg[j] and aVtxIndicesOfTrg[k] are ends of free segment and it is a part of border
if (j == myProxPrjState.GetNumberOfFirstNode() &&
k == myProxPrjState.GetNumberOfLastNode())
{
myPntStatus2 = ProxPnt_Status_BORDER;
break;
}
}
myPntStatus2 = ProxPnt_Status_BORDER;
}
else
{
myPntStatus2 = ProxPnt_Status_MIDDLE;
}
} //else if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_EDGE)
}

View File

@@ -21,6 +21,7 @@
#include <BRepExtrema_TriangleSet.hxx>
#include <BVH_Distance.hxx>
#include <BVH_Tools.hxx>
#include <Poly_Triangulation.hxx>
//! Tool class for computation the proximity distance from first
//! primitive set to second one that is the maximal from minimum
@@ -93,6 +94,8 @@ public:
//! Creates new tool for the given element sets.
Standard_EXPORT BRepExtrema_ProximityDistTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Standard_Integer theNbSamples1,
const BVH_Array3d& theAddVertices1,
const NCollection_Vector<ProxPnt_Status>& theAddStatus1,
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2);
@@ -107,6 +110,10 @@ public:
Standard_EXPORT void LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2);
//! Loads given additional vertices and their statuses.
void LoadAdditionalPointsFirstSet (const BVH_Array3d& theAddVertices1,
const NCollection_Vector<ProxPnt_Status>& theAddStatus1);
//! Performs searching of the proximity distance.
Standard_EXPORT void Perform();
@@ -121,6 +128,20 @@ public: //! @name Reject/Accept implementations
Standard_EXPORT virtual Standard_Boolean Accept (const Standard_Integer theSgmIdx,
const Standard_Real&) Standard_OVERRIDE;
public:
//! Returns true if the node is on the boarder.
Standard_EXPORT static Standard_Boolean IsNodeOnBorder (const Standard_Integer theNodeIdx,
const Handle (Poly_Triangulation)& theTr);
//! Returns true if the edge is on the boarder.
Standard_EXPORT static Standard_Boolean IsEdgeOnBorder (const Standard_Integer theTrgIdx,
const Standard_Integer theFirstEdgeNodeIdx,
const Standard_Integer theSecondEdgeNodeIdx,
const Handle (Poly_Triangulation)& theTr);
public:
//! Returns points on triangles sets, which provide the proximity distance.
void ProximityPoints (BVH_Vec3d& thePoint1, BVH_Vec3d& thePoint2) const
{
@@ -148,6 +169,10 @@ protected:
private:
//! Goes throught vertices from the 1st set.
void goThroughtSet1 (const BVH_Array3d& aVertices1,
const Standard_Boolean theIsAdditionalSet);
//! Defines the status of proximity point from 1st BVH.
void defineStatusProxPnt1();
@@ -183,6 +208,11 @@ private:
Standard_Integer myNbSamples1; //!< Number of samples points on the first shape
//! Is vertex corresponding to proximity point of 1st shape from additional set
Standard_Integer myIsProxVtx1FromAddSet;
BVH_Array3d myAddVertices1; //!< Additional vertices on the 1st shape
NCollection_Vector<ProxPnt_Status> myAddStatus1; //!< Status of additional vertices on the 1st shape
//! Vertex index from 1st BVH corresponding to proximity point of 1st shape
Standard_Integer myProxVtxIdx1;

View File

@@ -1,4 +1,4 @@
// Created on: 2022-08-08
// Created on: 2022-08-08
// Created by: Kseniya NOSULKO
// Copyright (c) 2022 OPEN CASCADE SAS
//
@@ -14,17 +14,32 @@
// commercial license or contractual agreement.
#include <BRepExtrema_ProximityValueTool.hxx>
#include <BRepExtrema_ProximityDistTool.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepGProp.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <GCPnts_QuasiUniformAbscissa.hxx>
#include <GProp_GProps.hxx>
#include <Poly_Connect.hxx>
#include <TopoDS.hxx>
//=======================================================================
//function : BRepExtrema_ProximityValueTool
//purpose : Creates new unitialized proximity tool
//=======================================================================
BRepExtrema_ProximityValueTool::BRepExtrema_ProximityValueTool()
: myDistance (std::numeric_limits<Standard_Real>::max()),
: myIsRefinementRequired1 (Standard_False),
myIsRefinementRequired2 (Standard_False),
myDistance (std::numeric_limits<Standard_Real>::max()),
myIsDone (Standard_False),
myNbSamples1(0),
myNbSamples2(0)
{}
{
// Should be initialized later
myIsInitS1 = myIsInitS2 = Standard_False;
}
//=======================================================================
//function : BRepExtrema_ProximityValueTool
@@ -34,13 +49,15 @@ BRepExtrema_ProximityValueTool::BRepExtrema_ProximityValueTool (const Handle(BRe
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2)
: myDistance (std::numeric_limits<Standard_Real>::max()),
: myIsRefinementRequired1 (Standard_False),
myIsRefinementRequired2 (Standard_False),
myDistance (std::numeric_limits<Standard_Real>::max()),
myIsDone (Standard_False),
myNbSamples1(0),
myNbSamples2(0)
myNbSamples1 (0),
myNbSamples2 (0)
{
LoadTriangleSets (theSet1, theSet2);
LoadShapeLists (theShapeList1, theShapeList2);
LoadTriangleSets (theSet1, theSet2);
}
//=======================================================================
@@ -53,7 +70,94 @@ void BRepExtrema_ProximityValueTool::LoadTriangleSets (const Handle(BRepExtrema_
mySet1 = theSet1;
mySet2 = theSet2;
myIsDone = Standard_False;
MarkDirty();
}
//=======================================================================
//function : calcEdgeRefinementStep
//purpose : Calculates the edge refinement step
//=======================================================================
static Standard_Real calcEdgeRefinementStep (const TopoDS_Edge& theEdge,
const Standard_Integer theNbNodes)
{
if (theNbNodes < 2)
return 0;
BRepAdaptor_Curve aBAC (theEdge);
Standard_Real aLen = GCPnts_AbscissaPoint::Length (aBAC);
return aLen / (Standard_Real)(theNbNodes - 1);
}
//=======================================================================
//function : calcFaceRefinementStep
//purpose : Calculates the face refinement step as an approximate square
// (Shape area / number triangles) * 2
//=======================================================================
static Standard_Real calcFaceRefinementStep (const TopoDS_Face& theFace,
const Standard_Integer theNbTrg)
{
if (theNbTrg < 1)
return 0;
GProp_GProps props;
BRepGProp::SurfaceProperties (theFace, props);
Standard_Real aArea = props.Mass();
return 2 * (aArea / (Standard_Real)theNbTrg);
}
//=======================================================================
//function : getInfoForRefinement
//purpose : Gets shape data for further refinement
//=======================================================================
Standard_Boolean BRepExtrema_ProximityValueTool::getInfoForRefinement (const TopoDS_Shape& theShape,
TopAbs_ShapeEnum& theShapeType,
Standard_Integer& theNbNodes,
Standard_Real& theStep)
{
if (theShape.ShapeType() == TopAbs_FACE)
{
theShapeType = TopAbs_FACE;
TopoDS_Face aF = TopoDS::Face (theShape);
TopLoc_Location aLocation;
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation (aF, aLocation);
if (aTriangulation.IsNull())
{
return Standard_False;
}
theNbNodes = aTriangulation->NbNodes();
Standard_Integer aNbTrg = aTriangulation->NbTriangles();
theStep = calcFaceRefinementStep (aF, aNbTrg);
}
else if (theShape.ShapeType() == TopAbs_EDGE)
{
theShapeType = TopAbs_EDGE;
TopoDS_Edge aE = TopoDS::Edge (theShape);
TopLoc_Location aLocation;
Handle(Poly_Polygon3D) aPolygon = BRep_Tool::Polygon3D (aE, aLocation);
if (aPolygon.IsNull())
{
return Standard_False;
}
theNbNodes = aPolygon->NbNodes();
theStep = calcEdgeRefinementStep (aE, theNbNodes);
}
else
{
return Standard_False;
}
if (theStep < Precision::Confusion())
{
return Standard_False;
}
return Standard_True;
}
//=======================================================================
@@ -66,7 +170,13 @@ void BRepExtrema_ProximityValueTool::LoadShapeLists (const BRepExtrema_ShapeList
myShapeList1 = theShapeList1;
myShapeList2 = theShapeList2;
myIsDone = Standard_False;
myShape1 = theShapeList1 (0);
myIsInitS1 = getInfoForRefinement (myShape1, myShapeType1, myNbNodes1, myStep1);
myShape2 = theShapeList2 (0);
myIsInitS2 = getInfoForRefinement (myShape2, myShapeType2, myNbNodes2, myStep2);
MarkDirty();
}
//=======================================================================
@@ -79,7 +189,7 @@ void BRepExtrema_ProximityValueTool::SetNbSamplePoints(const Standard_Integer th
myNbSamples1 = theSamples1;
myNbSamples2 = theSamples2;
myIsDone = Standard_False;
MarkDirty();
}
//=======================================================================
@@ -88,6 +198,8 @@ void BRepExtrema_ProximityValueTool::SetNbSamplePoints(const Standard_Integer th
//=======================================================================
Standard_Real BRepExtrema_ProximityValueTool::computeProximityDist (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Standard_Integer theNbSamples1,
const BVH_Array3d& theAddVertices1,
const NCollection_Vector<ProxPnt_Status>& theAddStatus1,
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2,
@@ -96,7 +208,8 @@ Standard_Real BRepExtrema_ProximityValueTool::computeProximityDist (const Handle
ProxPnt_Status& thePointStatus1,
ProxPnt_Status& thePointStatus2) const
{
BRepExtrema_ProximityDistTool aProxDistTool (theSet1, theNbSamples1, theSet2, theShapeList1, theShapeList2);
BRepExtrema_ProximityDistTool aProxDistTool (theSet1, theNbSamples1, theAddVertices1, theAddStatus1,
theSet2, theShapeList1, theShapeList2);
aProxDistTool.Perform();
if (!aProxDistTool.IsDone())
@@ -108,21 +221,311 @@ Standard_Real BRepExtrema_ProximityValueTool::computeProximityDist (const Handle
return aProxDistTool.ProximityDistance();
}
//=======================================================================
//function : getEdgeAdditionalVertices
//purpose : Gets additional vertices and their statuses on the edge with the input step
//=======================================================================
Standard_Boolean BRepExtrema_ProximityValueTool::getEdgeAdditionalVertices (
const TopoDS_Edge& theEdge,
const Standard_Real theStep,
BVH_Array3d& theAddVertices,
NCollection_Vector<ProxPnt_Status>& theAddStatuses)
{
BRepAdaptor_Curve aBAC (theEdge);
if (!aBAC.Is3DCurve() || theStep < Precision::Confusion())
{
return Standard_False;
}
Standard_Real aLen = GCPnts_AbscissaPoint::Length (aBAC);
Standard_Integer aNbSamplePoints = (Standard_Integer) (aLen / theStep) + 1;
GCPnts_QuasiUniformAbscissa aGCPnts (aBAC, Max (3, aNbSamplePoints));
if (!aGCPnts.IsDone())
return Standard_False;
Standard_Integer aNbNodes = aGCPnts.NbPoints();
for (Standard_Integer aVertIdx = 2; aVertIdx < aNbNodes; ++aVertIdx) //don't add extreme points
{
Standard_Real aPar = aGCPnts.Parameter (aVertIdx);
gp_Pnt aP = aBAC.Value (aPar);
theAddVertices.push_back (BVH_Vec3d (aP.X(), aP.Y(), aP.Z()));
theAddStatuses.Append (ProxPnt_Status::ProxPnt_Status_MIDDLE);
}
return Standard_True;
}
//=======================================================================
//function : doRecurTrgSplit
//purpose : Splits the triangle into two ones recursively, halving the longest side
// untill the area of the current triangle > input step
//! @param theTrg points of the triangle to be splitted
//! @param theEdgesStatus status of triangle edges - on the border or middle of the face
//! @param theTol telerance used in search of coincidence points
//! @param theStep minimum area of the resulting triangle
//! @param theAddVertices vertices obtained halving sides
//! @param theAddStatuses status of obtained vertices - on the border or middle of the face,
//! from triangulation of which the input triangle is
//=======================================================================
void BRepExtrema_ProximityValueTool::doRecurTrgSplit (const gp_Pnt (&theTrg)[3],
const ProxPnt_Status (&theEdgesStatus)[3],
const Standard_Real theTol,
const Standard_Real theStep,
BVH_Array3d& theAddVertices,
NCollection_Vector<ProxPnt_Status>& theAddStatuses)
{
gp_XYZ aTrgSide1 = theTrg[1].Coord() - theTrg[0].Coord();
gp_XYZ aTrgSide2 = theTrg[2].Coord() - theTrg[0].Coord();
Standard_Real aTrgArea = 0.5 * aTrgSide1.CrossMagnitude (aTrgSide2);
if (aTrgArea - theStep < Precision::SquareConfusion())
return;
Standard_Real aD[3] { theTrg[0].Distance (theTrg[1]),
theTrg[1].Distance (theTrg[2]),
theTrg[2].Distance (theTrg[0]) };
Standard_Integer aBisectedEdgeIdx = aD[0] > aD[1] ? (aD[0] > aD[2] ? 0 : 2) : (aD[1] > aD[2] ? 1 : 2);
gp_Pnt aCenterOfMaxSide (theTrg[aBisectedEdgeIdx].Coord());
aCenterOfMaxSide.BaryCenter (0.5, theTrg[(aBisectedEdgeIdx + 1) % 3], 0.5);
Bnd_Box aBox;
aBox.Add (aCenterOfMaxSide);
aBox.Enlarge (theTol);
myInspector.SetCurrent (aCenterOfMaxSide.Coord());
myCells.Inspect (aBox.CornerMin().XYZ(), aBox.CornerMax().XYZ(), myInspector);
if (myInspector.IsNeedAdd()) //is point aCenterOfMaxSide unique
{
BVH_Vec3d aBisectingPnt (aCenterOfMaxSide.X(), aCenterOfMaxSide.Y(), aCenterOfMaxSide.Z());
theAddVertices.push_back (aBisectingPnt);
theAddStatuses.Append (theEdgesStatus[aBisectedEdgeIdx]);
myInspector.Add (aCenterOfMaxSide.Coord());
myCells.Add (static_cast<BRepExtrema_VertexInspector::Target>(theAddVertices.size()),
aBox.CornerMin().XYZ(), aBox.CornerMax().XYZ());
}
gp_Pnt aTrg1[3] = { theTrg[0], theTrg[1], theTrg[2] };
gp_Pnt aTrg2[3] = { theTrg[0], theTrg[1], theTrg[2] };
ProxPnt_Status aEdgesStatus1[3] = { theEdgesStatus[0], theEdgesStatus[1], theEdgesStatus[2] };
ProxPnt_Status aEdgesStatus2[3] = { theEdgesStatus[0], theEdgesStatus[1], theEdgesStatus[2] };
switch (aBisectedEdgeIdx)
{
case 0:
aTrg1[0] = aTrg2[1] = aCenterOfMaxSide;
aEdgesStatus1[2] = aEdgesStatus2[1] = ProxPnt_Status::ProxPnt_Status_MIDDLE;
break;
case 1:
aTrg1[1] = aTrg2[2] = aCenterOfMaxSide;
aEdgesStatus1[0] = aEdgesStatus2[2] = ProxPnt_Status::ProxPnt_Status_MIDDLE;
break;
case 2:
aTrg1[2] = aTrg2[0] = aCenterOfMaxSide;
aEdgesStatus1[1] = aEdgesStatus2[0] = ProxPnt_Status::ProxPnt_Status_MIDDLE;
break;
}
doRecurTrgSplit (aTrg1, aEdgesStatus1, theTol, theStep, theAddVertices, theAddStatuses);
doRecurTrgSplit (aTrg2, aEdgesStatus2, theTol, theStep, theAddVertices, theAddStatuses);
}
static Standard_Real getModelRange (const TopLoc_Location& theLocation,
const Handle(Poly_Triangulation)& theTr)
{
Bnd_Box aBox;
theTr->MinMax (aBox, theLocation.Transformation());
Standard_Real aXm = 0.0, aYm = 0.0, aZm = 0.0, aXM = 0.0, aYM = 0.0, aZM = 0.0;
aBox.Get (aXm, aYm, aZm, aXM, aYM, aZM);
Standard_Real aRange = aXM - aXm;
aRange = Max (aRange, aYM - aYm);
aRange = Max (aRange, aZM - aZm);
return aRange;
}
static void getNodesOfTrg (const Standard_Integer theTriIdx,
const TopLoc_Location& theLocation,
const Handle (Poly_Triangulation)& theTr,
gp_Pnt (&theTrg)[3])
{
Standard_Integer aVtxIdx1;
Standard_Integer aVtxIdx2;
Standard_Integer aVtxIdx3;
theTr->Triangle (theTriIdx).Get (aVtxIdx1, aVtxIdx2, aVtxIdx3);
gp_Pnt aVtx1 = theTr->Node (aVtxIdx1);
aVtx1.Transform (theLocation);
theTrg[0] = aVtx1;
gp_Pnt aVtx2 = theTr->Node (aVtxIdx2);
aVtx2.Transform (theLocation);
theTrg[1] = aVtx2;
gp_Pnt aVtx3 = theTr->Node (aVtxIdx3);
aVtx3.Transform (theLocation);
theTrg[2] = aVtx3;
}
// Gets status of triangle edges - on the border or middle of the face
static void getEdgesStatus(const Standard_Integer theTriIdx,
const Handle(Poly_Triangulation)& theTr,
ProxPnt_Status (&theEdgesStatus1)[3])
{
for (Standard_Integer j = 0; j < 3; j++)
{
Standard_Integer k = (j + 1) % 3;
if (BRepExtrema_ProximityDistTool::IsEdgeOnBorder (theTriIdx, j, k, theTr))
{
theEdgesStatus1[j] = ProxPnt_Status::ProxPnt_Status_BORDER;
}
else
{
theEdgesStatus1[j] = ProxPnt_Status::ProxPnt_Status_MIDDLE;
}
}
}
//=======================================================================
//function : getFaceAdditionalVertices
//purpose : Gets additional vertices and their statuses on the face with the input step (triangle square)
//=======================================================================
Standard_Boolean BRepExtrema_ProximityValueTool::getFaceAdditionalVertices (
const TopoDS_Face& theFace,
const Standard_Real theStep,
BVH_Array3d& theAddVertices,
NCollection_Vector<ProxPnt_Status>& theAddStatuses)
{
Standard_Real aTol = Precision::Confusion();
TopLoc_Location aLocation;
Handle(Poly_Triangulation) aTr = BRep_Tool::Triangulation (theFace, aLocation);
if (aTr.IsNull())
{
return Standard_False;
}
myCells.Reset (Max (aTol, getModelRange (aLocation, aTr) / IntegerLast()));
for (Standard_Integer aTriIdx = 1; aTriIdx <= aTr->NbTriangles(); ++aTriIdx)
{
gp_Pnt aTrg[3];
ProxPnt_Status aEdgesStatus[3];
getNodesOfTrg (aTriIdx, aLocation, aTr, aTrg);
getEdgesStatus (aTriIdx, aTr, aEdgesStatus);
doRecurTrgSplit (aTrg, aEdgesStatus, aTol, theStep, theAddVertices, theAddStatuses);
}
return Standard_True;
}
//=======================================================================
//function : getShapesVertices
//purpose : Gets additional vertices on shapes with refining a coarser one if it's needed
//=======================================================================
Standard_Boolean BRepExtrema_ProximityValueTool::getShapesAdditionalVertices()
{
// estimate the density of meshes of shapes to add points to a coarcer one
// target steps for refinement
Standard_Real aStep1 = myStep1;
Standard_Real aStep2 = myStep2;
if ((myShapeType1 == TopAbs_EDGE) && (myShapeType2 == TopAbs_EDGE))
{
if (myNbSamples1 > myNbNodes1) // 1st edge needs refinement
{
aStep1 = calcEdgeRefinementStep (TopoDS::Edge (myShape1), myNbSamples1);
myIsRefinementRequired1 = Standard_True;
}
if (myNbSamples2 > myNbNodes2) // 2nd edge needs refinement
{
aStep2 = calcEdgeRefinementStep (TopoDS::Edge (myShape2), myNbSamples2);
myIsRefinementRequired2 = Standard_True;
}
if (aStep1 / aStep2 > 2.) // 1st edge needs refinement
{
myIsRefinementRequired1 = Standard_True;
aStep1 = aStep2;
}
else if (aStep2 / aStep1 > 2.) // 2nd edge needs refinement
{
myIsRefinementRequired2 = Standard_True;
aStep2 = aStep1;
}
if (myIsRefinementRequired1)
{
if (!getEdgeAdditionalVertices (TopoDS::Edge (myShape1), aStep1, myAddVertices1, myAddStatus1))
{
return Standard_False;
}
}
if (myIsRefinementRequired2)
{
if (!getEdgeAdditionalVertices (TopoDS::Edge (myShape2), aStep2, myAddVertices2, myAddStatus2))
{
return Standard_False;
}
}
}
else if ((myShapeType1 == TopAbs_FACE) && (myShapeType2 == TopAbs_FACE))
{
if (aStep1 / aStep2 > 2) // 1st face needs refinement
{
myIsRefinementRequired1 = Standard_True;
aStep1 = myStep2;
}
else if (aStep2 / aStep1 > 2.) // 2nd face needs refinement
{
myIsRefinementRequired2 = Standard_True;
aStep2 = myStep1;
}
if (myIsRefinementRequired1)
{
return getFaceAdditionalVertices (TopoDS::Face (myShape1), aStep1, myAddVertices1, myAddStatus1);
}
if (myIsRefinementRequired2)
{
return getFaceAdditionalVertices (TopoDS::Face (myShape2), aStep2, myAddVertices2, myAddStatus2);
}
}
return Standard_True;
}
//=======================================================================
//function : Perform
//purpose : Performs the computation of the proximity value
//=======================================================================
void BRepExtrema_ProximityValueTool::Perform (Standard_Real& theTolerance)
{
myIsDone = Standard_False;
if (!myIsInitS1 || !myIsInitS2 || (myShapeType1 != myShapeType2))
return;
//get vertices on shapes with refining a coarser mesh if it's needed
if (!getShapesAdditionalVertices())
return;
// max(min) dist from the 1st shape to the 2nd one
BVH_Vec3d aP1_1, aP1_2;
ProxPnt_Status aPointStatus1_1 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
ProxPnt_Status aPointStatus1_2 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
Standard_Real aProximityDist1 = computeProximityDist (mySet1, myNbSamples1, mySet2, myShapeList1, myShapeList2,
aP1_1, aP1_2, aPointStatus1_1, aPointStatus1_2);
Standard_Real aProximityDist1 = computeProximityDist (mySet1, myNbSamples1, myAddVertices1, myAddStatus1,
mySet2,
myShapeList1, myShapeList2,
aP1_1, aP1_2,
aPointStatus1_1, aPointStatus1_2);
if (aProximityDist1 < 0.)
return;
@@ -132,8 +535,11 @@ void BRepExtrema_ProximityValueTool::Perform (Standard_Real& theTolerance)
ProxPnt_Status aPointStatus2_1 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
ProxPnt_Status aPointStatus2_2 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
Standard_Real aProximityDist2 = computeProximityDist (mySet2, myNbSamples2, mySet1, myShapeList2, myShapeList1,
aP2_2, aP2_1, aPointStatus2_2, aPointStatus2_1);
Standard_Real aProximityDist2 = computeProximityDist (mySet2, myNbSamples2, myAddVertices2, myAddStatus2,
mySet1,
myShapeList2, myShapeList1,
aP2_2, aP2_1,
aPointStatus2_2, aPointStatus2_1);
if (aProximityDist2 < 0.)
return;
@@ -159,3 +565,23 @@ void BRepExtrema_ProximityValueTool::Perform (Standard_Real& theTolerance)
myIsDone = Standard_True;
theTolerance = myDistance;
}
//=======================================================================
//function : Inspect
//purpose : Used for selection and storage of coinciding nodes
//=======================================================================
NCollection_CellFilter_Action BRepExtrema_VertexInspector::Inspect (const Standard_Integer theTarget)
{
myIsNeedAdd = Standard_True;
const gp_XYZ& aPnt = myPoints.Value (theTarget - 1);
Standard_Real aDx, aDy, aDz;
aDx = myCurrent.X() - aPnt.X();
aDy = myCurrent.Y() - aPnt.Y();
aDz = myCurrent.Z() - aPnt.Z();
if ((aDx * aDx <= myTol) && (aDy * aDy <= myTol) && (aDz * aDz <= myTol))
myIsNeedAdd = Standard_False;
return CellFilter_Keep;
}

View File

@@ -1,4 +1,4 @@
// Created on: 2022-08-08
// Created on: 2022-08-08
// Created by: Kseniya NOSULKO
// Copyright (c) 2022 OPEN CASCADE SAS
//
@@ -18,9 +18,67 @@
#include <BRepExtrema_ProximityDistTool.hxx>
#include <BRepExtrema_TriangleSet.hxx>
#include <NCollection_CellFilter.hxx>
#include <Precision.hxx>
typedef NCollection_Vector<gp_XYZ> VectorOfPoint;
//! Class BRepExtrema_VertexInspector
//! derived from NCollection_CellFilter_InspectorXYZ
//! This class define the Inspector interface for CellFilter algorithm,
//! working with gp_XYZ points in 3d space.
//! Used in search of coincidence points with a certain tolerance.
class BRepExtrema_VertexInspector : public NCollection_CellFilter_InspectorXYZ
{
public:
typedef Standard_Integer Target;
//! Constructor; remembers the tolerance
BRepExtrema_VertexInspector()
: myTol (Precision::SquareConfusion()),
myIsNeedAdd (Standard_True)
{}
//! Keep the points used for comparison
void Add (const gp_XYZ& thePnt)
{
myPoints.Append (thePnt);
}
//! Set tolerance for comparison of point coordinates
void SetTol (const Standard_Real theTol)
{
myTol = theTol;
}
//! Set current point to search for coincidence
void SetCurrent (const gp_XYZ& theCurPnt)
{
myCurrent = theCurPnt;
myIsNeedAdd = Standard_True;
}
Standard_Boolean IsNeedAdd()
{
return myIsNeedAdd;
}
//! Implementation of inspection method
Standard_EXPORT NCollection_CellFilter_Action Inspect (const Standard_Integer theTarget);
private:
Standard_Real myTol;
Standard_Boolean myIsNeedAdd;
VectorOfPoint myPoints;
gp_XYZ myCurrent;
};
typedef NCollection_CellFilter<BRepExtrema_VertexInspector> BRepExtrema_CellFilter;
typedef typename BRepExtrema_ProximityDistTool::ProxPnt_Status ProxPnt_Status;
//! Tool class for computation of the proximity value from one BVH
//! primitive set to another, solving max(min) problem.
//! Handles only edge/edge or face/face cases.
//! This tool is not intended to be used independently, and is integrated
//! in other classes, implementing algorithms based on shape tessellation
//! (BRepExtrema_ShapeProximity and BRepExtrema_SelfIntersection).
@@ -29,8 +87,6 @@
//! on the quality of input tessellation(s).
class BRepExtrema_ProximityValueTool
{
public:
typedef typename BRepExtrema_ProximityDistTool::ProxPnt_Status ProxPnt_Status;
public:
@@ -86,9 +142,17 @@ public:
private:
//! Gets shape data for further refinement.
Standard_Boolean getInfoForRefinement (const TopoDS_Shape& theShapes,
TopAbs_ShapeEnum& theShapeType,
Standard_Integer& theNbNodes,
Standard_Real& theStep);
//! Returns the computed proximity value from first BVH to another one.
Standard_Real computeProximityDist (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Standard_Integer theNbSamples1,
const BVH_Array3d& theAddVertices1,
const NCollection_Vector<ProxPnt_Status>& theAddStatus1,
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2,
@@ -97,6 +161,29 @@ private:
ProxPnt_Status& thePointStatus1,
ProxPnt_Status& thePointStatus2) const;
//! Gets additional vertices on shapes with refining a coarser one if it's needed.
Standard_Boolean getShapesAdditionalVertices();
//! Gets additional vertices and their statuses on the edge with the input step.
Standard_Boolean getEdgeAdditionalVertices (const TopoDS_Edge& theEdge,
const Standard_Real theStep,
BVH_Array3d& theAddVertices,
NCollection_Vector<ProxPnt_Status>& theAddStatuses);
//! Gets additional vertices and their statuses on the face with the input step (triangle square).
Standard_Boolean getFaceAdditionalVertices (const TopoDS_Face& theFace,
const Standard_Real theStep,
BVH_Array3d& theAddVertices,
NCollection_Vector<ProxPnt_Status>& theAddStatuses);
//! Splits the triangle recursively, halving the longest side
//! to the area of the current triangle > input step
void doRecurTrgSplit (const gp_Pnt (&theTrg)[3],
const ProxPnt_Status (&theEdgesStatus)[3],
const Standard_Real theTol,
const Standard_Real theStep,
BVH_Array3d& theAddVertices,
NCollection_Vector<ProxPnt_Status>& theAddStatuses);
private:
//! Set of all mesh primitives of the 1st shape.
@@ -109,6 +196,35 @@ private:
//! List of subshapes of the 2nd shape.
BRepExtrema_ShapeList myShapeList2;
//! The 1st shape.
TopoDS_Shape myShape1;
//! The 2nd shape.
TopoDS_Shape myShape2;
BVH_Array3d myAddVertices1; //!< Additional vertices on the 1st shape if its mesh is coarser.
BVH_Array3d myAddVertices2; //!< Additional vertices on the 2nd shape if its mesh is coarser.
NCollection_Vector<ProxPnt_Status> myAddStatus1; //!< Status of additional vertices on the 1st shape.
NCollection_Vector<ProxPnt_Status> myAddStatus2; //!< Status of additional vertices on the 2nd shape.
Standard_Boolean myIsInitS1; //!< Is the 1st shape initialized?
Standard_Boolean myIsInitS2; //!< Is the 2nd shape initialized?
Standard_Boolean myIsRefinementRequired1; //!< Flag about the need to refine the 1st shape.
Standard_Boolean myIsRefinementRequired2; //!< Flag about the need to refine the 2nd shape.
Standard_Integer myNbNodes1; //!< Number of nodes in triangulation of the 1st shape.
Standard_Integer myNbNodes2; //!< Number of nodes in triangulation of the 2nd shape.
Standard_Real myStep1; //!< Step for getting vertices on the 1st shape.
Standard_Real myStep2; //!< Step for getting vertices on the 2nd shape.
BRepExtrema_CellFilter myCells;
BRepExtrema_VertexInspector myInspector;
TopAbs_ShapeEnum myShapeType1; //!< 1st shape type.
TopAbs_ShapeEnum myShapeType2; //!< 2nd shape type.
Standard_Real myDistance; //!< Distance
Standard_Boolean myIsDone; //!< State of the algorithm

View File

@@ -129,6 +129,7 @@ void BRepExtrema_ShapeProximity::Perform()
myElementSet2);
myProxValTool.LoadShapeLists (myShapeList1,
myShapeList2);
myProxValTool.SetNbSamplePoints (myNbSamples1, myNbSamples2);
myProxValTool.Perform (myTolerance);
myProxValTool.ProximityPoints(myProxPoint1, myProxPoint2);

View File

@@ -37,7 +37,8 @@
//! on distance less than the given tolerance from each other.
//!
//! Second approach:
//! Compute the proximity value between two shapes if the tolerance is not defined (Precision::Infinite()).
//! Compute the proximity value between two shapes (handles only edge/edge or face/face cases)
//! if the tolerance is not defined (Precision::Infinite()).
//! In this case the proximity value is a minimal thickness of a layer containing both shapes.
//!
//! For the both approaches the high performance is achieved through the use of existing
@@ -46,8 +47,6 @@
//! triangulation).
class BRepExtrema_ShapeProximity
{
public:
typedef typename BRepExtrema_ProximityValueTool::ProxPnt_Status ProxPnt_Status;
public:

View File

@@ -56,6 +56,7 @@
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <BRepExtrema_ExtCC.hxx>
#include <ShapeFix_Edge.hxx>
static TopoDS_Edge FindEdgeCloseToBisectorPlane(const TopoDS_Vertex& theVertex,
TopoDS_Compound& theComp,
@@ -534,6 +535,26 @@ BRepFill_TrimShellCorner::MakeFacesNonSec(const Standard_Integer
if(bHasNewEdge) {
aNewEdge.Orientation(TopAbs_FORWARD);
// Refer to BrepFill_Sweep.cxx BuildEdge Construct an edge via an iso
gp_Pnt P1, P2;
Standard_Real p11, p12, p21, p22;
P1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aNewEdge)));
P2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aNewEdge)));
TopoDS_Edge aERef = TopoDS::Edge(fit == 1 ? aE1 : aE2);
p11 = P1.Distance(BRep_Tool::Pnt(TopExp::FirstVertex(aERef)));
p22 = P2.Distance(BRep_Tool::Pnt(TopExp::LastVertex(aERef)));
p12 = P1.Distance(BRep_Tool::Pnt(TopExp::LastVertex(aERef)));
p21 = P2.Distance(BRep_Tool::Pnt(TopExp::FirstVertex(aERef)));
if (p11 > p12 && p22 > p21) {
aNewEdge.Reverse();
}
// for nonPlane surface, we should add pCurve
Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge();
sfe->FixAddPCurve(aNewEdge, TopoDS::Face(aFace), Standard_False);
}
TopTools_ListOfShape aOrderedList;

View File

@@ -802,7 +802,7 @@ static void GetEdgeTol(const TopoDS_Edge& theEdge,
}
if(temp > d2) d2 = temp;
}
d2 = 1.5*sqrt(d2);
d2 = 1.05*sqrt(d2);
theEdTol = d2;
}
@@ -884,10 +884,6 @@ static void UpdShTol(const TopTools_DataMapOfShapeReal& theShToTol,
case TopAbs_VERTEX:
{
const Handle(BRep_TVertex)& aTV = *((Handle(BRep_TVertex)*)&aNsh.TShape());
//
if(aTV->Locked())
throw TopoDS_LockedShape("BRep_Builder::UpdateVertex");
//
if (theVForceUpdate)
aTV->Tolerance(aTol);
else
@@ -1709,8 +1705,8 @@ static void InternalUpdateTolerances(const TopoDS_Shape& theOldShape,
for (iCur=1; iCur<=nbV; iCur++) {
tol=0;
const TopoDS_Vertex& V = TopoDS::Vertex(parents.FindKey(iCur));
Bnd_Box box;
box.Add(BRep_Tool::Pnt(V));
gp_Pnt aPV = BRep_Tool::Pnt(V);
Standard_Real aMaxDist = 0.;
gp_Pnt p3d;
for (lConx.Initialize(parents(iCur)); lConx.More(); lConx.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(lConx.Value());
@@ -1732,8 +1728,10 @@ static void InternalUpdateTolerances(const TopoDS_Shape& theOldShape,
if (!C.IsNull()) { // edge non degenerated
p3d = C->Value(par);
p3d.Transform(L.Transformation());
box.Add(p3d);
}
Standard_Real aDist = p3d.SquareDistance(aPV);
if (aDist > aMaxDist)
aMaxDist = aDist;
}
}
else if (cr->IsCurveOnSurface()) {
const Handle(Geom_Surface)& Su = cr->Surface();
@@ -1745,21 +1743,22 @@ static void InternalUpdateTolerances(const TopoDS_Shape& theOldShape,
gp_Pnt2d p2d = PC->Value(par);
p3d = Su->Value(p2d.X(),p2d.Y());
p3d.Transform(L.Transformation());
box.Add(p3d);
Standard_Real aDist = p3d.SquareDistance(aPV);
if (aDist > aMaxDist)
aMaxDist = aDist;
if (!PC2.IsNull()) {
p2d = PC2->Value(par);
p3d = Su->Value(p2d.X(),p2d.Y());
p3d.Transform(L.Transformation());
box.Add(p3d);
aDist = p3d.SquareDistance(aPV);
if (aDist > aMaxDist)
aMaxDist = aDist;
}
}
itcr.Next();
}
}
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
box.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
aXmax -= aXmin; aYmax -= aYmin; aZmax -= aZmin;
tol = Max(tol,sqrt(aXmax*aXmax+aYmax*aYmax+aZmax*aZmax));
tol = Max(tol, sqrt(aMaxDist));
tol += 2.*Epsilon(tol);
//
Standard_Real aVTol = BRep_Tool::Tolerance(V);

View File

@@ -336,8 +336,10 @@ static BRepOffset_Error checkSinglePoint(const Standard_Real theUParam,
const NCollection_Vector<gp_Pnt>& theBadPoints);
//---------------------------------------------------------------------
static void UpdateTolerance ( TopoDS_Shape& myShape,
const TopTools_IndexedMapOfShape& myFaces);
static void UpdateTolerance ( TopoDS_Shape& theShape,
const TopTools_IndexedMapOfShape& theFaces,
const TopoDS_Shape& theInitShape);
static Standard_Real ComputeMaxDist(const gp_Pln& thePlane,
const Handle(Geom_Curve)& theCrv,
const Standard_Real theFirst,
@@ -1036,8 +1038,16 @@ void BRepOffset_MakeOffset::MakeOffsetShape(const Message_ProgressRange& theRang
// MAJ Tolerance edge and Vertex
// ----------------------------
if (!myOffsetShape.IsNull()) {
UpdateTolerance (myOffsetShape,myFaces);
BRepLib::UpdateTolerances( myOffsetShape );
if (myThickening)
{
UpdateTolerance(myOffsetShape, myFaces, myShape);
}
else
{
TopoDS_Shape aDummy;
UpdateTolerance(myOffsetShape, myFaces, aDummy);
}
BRepLib::UpdateTolerances(myOffsetShape);
}
CorrectConicalFaces();
@@ -3165,13 +3175,38 @@ void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRa
} //if both edges are arcs of circles
if (NewFace.IsNull())
{
BRepLib_MakeFace MF(theWire, Standard_True); //Only plane
if (MF.Error() == BRepLib_FaceDone)
Standard_Real anEdgeTol = BRep_Tool::Tolerance(anEdge);
//Tolerances of input shape should not be increased by BRepLib_MakeFace
BRepLib_FindSurface aFindPlane(theWire, anEdgeTol, Standard_True); //only plane
IsPlanar = Standard_False;
if(aFindPlane.Found() && aFindPlane.ToleranceReached() <= anEdgeTol)
{
NewFace = MF.Face();
IsPlanar = Standard_True;
Standard_Real f, l;
Handle(Geom_Curve) aGC = BRep_Tool::Curve(anEdge, f, l);
Handle(Geom_Plane) aPln = Handle(Geom_Plane)::DownCast(aFindPlane.Surface());
Standard_Real aMaxDist = ComputeMaxDist(aPln->Pln(), aGC, f, l);
if (aMaxDist <= anEdgeTol)
{
BRepLib_MakeFace MF(aPln->Pln(), theWire);
if (MF.IsDone())
{
NewFace = MF.Face();
TopoDS_Iterator anItE(theWire);
for (; anItE.More(); anItE.Next())
{
const TopoDS_Edge& anE = TopoDS::Edge(anItE.Value());
if (anE.IsSame(anEdge))
continue;
aGC = BRep_Tool::Curve(anE, f, l);
aMaxDist = ComputeMaxDist(aPln->Pln(), aGC, f, l);
BB.UpdateEdge(anE, aMaxDist);
}
IsPlanar = Standard_True;
}
}
}
else //Extrusion (by thrusections)
//
if(!IsPlanar) //Extrusion (by thrusections)
{
Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(anEdge, fpar, lpar);
Handle(Geom_TrimmedCurve) TrEdgeCurve =
@@ -3185,7 +3220,6 @@ void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRa
ThrusecGenerator.AddCurve( TrOffsetCurve );
ThrusecGenerator.Perform( Precision::PConfusion() );
theSurf = ThrusecGenerator.Surface();
//theSurf = new Geom_SurfaceOfLinearExtrusion( TrOffsetCurve, OffsetDir );
Standard_Real Uf, Ul, Vf, Vl;
theSurf->Bounds(Uf, Ul, Vf, Vl);
TopLoc_Location Loc;
@@ -3272,8 +3306,14 @@ void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRa
BB.Range( anE3, FirstPar, LastPar );
}
}
BRepLib::SameParameter(NewFace);
BRepTools::Update(NewFace);
if (!IsPlanar)
{
// For planar faces these operations are useless,
// because there are no curves on surface
BRepLib::SameParameter(NewFace);
BRepTools::Update(NewFace);
}
//Check orientation
TopAbs_Orientation anOr = OrientationOfEdgeInFace(anEdge, aFaceOfEdge);
TopAbs_Orientation OrInNewFace = OrientationOfEdgeInFace(anEdge, NewFace);
@@ -3781,6 +3821,7 @@ void BRepOffset_MakeOffset::EncodeRegularity ()
#endif
}
//=======================================================================
//function : ComputeMaxDist
//purpose :
@@ -3807,13 +3848,15 @@ Standard_Real ComputeMaxDist(const gp_Pln& thePlane,
}
return sqrt(aMaxDist)*1.05;
}
//=======================================================================
//function : UpDateTolerance
//function : UpdateTolerance
//purpose :
//=======================================================================
void UpdateTolerance (TopoDS_Shape& S,
const TopTools_IndexedMapOfShape& Faces)
const TopTools_IndexedMapOfShape& Faces,
const TopoDS_Shape& theInitShape)
{
BRep_Builder B;
TopTools_MapOfShape View;
@@ -3829,12 +3872,31 @@ void UpdateTolerance (TopoDS_Shape& S,
}
}
Standard_Real Tol;
TopExp_Explorer ExpF;
for (ExpF.Init(S, TopAbs_FACE); ExpF.More(); ExpF.Next())
// The edges of initial shape are not modified
TopTools_MapOfShape aMapInitF;
if (!theInitShape.IsNull())
{
const TopoDS_Shape& F = ExpF.Current();
if (Faces.Contains(F))
TopExp_Explorer anExpF(theInitShape, TopAbs_FACE);
for (; anExpF.More(); anExpF.Next()) {
aMapInitF.Add(anExpF.Current());
TopExp_Explorer anExpE;
for (anExpE.Init(anExpF.Current(), TopAbs_EDGE); anExpE.More(); anExpE.Next()) {
View.Add(anExpE.Current());
TopoDS_Iterator anItV(anExpE.Current());
for (; anItV.More(); anItV.Next())
{
View.Add(anItV.Value());
}
}
}
}
Standard_Real Tol;
TopExp_Explorer anExpF(S, TopAbs_FACE);
for (; anExpF.More(); anExpF.Next())
{
const TopoDS_Shape& F = anExpF.Current();
if (Faces.Contains(F) || aMapInitF.Contains(F))
{
continue;
}
@@ -3843,6 +3905,7 @@ void UpdateTolerance (TopoDS_Shape& S,
for (Exp.Init(F, TopAbs_EDGE); Exp.More(); Exp.Next()) {
TopoDS_Edge E = TopoDS::Edge(Exp.Current());
Standard_Boolean isUpdated = Standard_False;
Standard_Real aCurrTol = BRep_Tool::Tolerance(E);
if (aBAS.GetType() == GeomAbs_Plane)
{
//Edge does not seem to have pcurve on plane,
@@ -3850,17 +3913,22 @@ void UpdateTolerance (TopoDS_Shape& S,
Standard_Real aFirst, aLast;
Handle(Geom_Curve) aCrv = BRep_Tool::Curve(E, aFirst, aLast);
Standard_Real aMaxDist = ComputeMaxDist(aBAS.Plane(), aCrv, aFirst, aLast);
E.Locked (Standard_False);
B.UpdateEdge(E, aMaxDist);
isUpdated = Standard_True;
if (aMaxDist > aCurrTol)
{
B.UpdateEdge(E, aMaxDist);
isUpdated = Standard_True;
}
}
if (View.Add(E))
{
E.Locked(Standard_False);
BRepCheck_Edge EdgeCorrector(E);
Tol = EdgeCorrector.Tolerance();
B.UpdateEdge(E, Tol);
isUpdated = Standard_True;
if (Tol > aCurrTol)
{
B.UpdateEdge(E, Tol);
isUpdated = Standard_True;
}
}
if (isUpdated)
{
@@ -3869,11 +3937,11 @@ void UpdateTolerance (TopoDS_Shape& S,
TopExp::Vertices(E, V[0], V[1]);
for (Standard_Integer i = 0; i <= 1; i++) {
V[i].Locked(Standard_False);
if (View.Add(V[i])) {
Handle(BRep_TVertex) TV = Handle(BRep_TVertex)::DownCast(V[i].TShape());
TV->Tolerance(0.);
BRepCheck_Vertex VertexCorrector(V[i]);
V[i].Locked (Standard_False);
B.UpdateVertex(V[i], VertexCorrector.Tolerance());
// use the occasion to clean the vertices.
(TV->ChangePoints()).Clear();
@@ -4953,6 +5021,53 @@ Standard_Boolean BRepOffset_MakeOffset::IsPlanar()
if (aPlanarityChecker.IsPlanar())
{
gp_Pln aPln = aPlanarityChecker.Plan();
Standard_Real u1, u2, v1, v2, um, vm;
aSurf->Bounds(u1, u2, v1, v2);
Standard_Boolean isInf1 = Precision::IsInfinite(u1), isInf2 = Precision::IsInfinite(u2);
if (!isInf1 && !isInf2)
{
um = (u1 + u2) / 2.;
}
else if(isInf1 && !isInf2)
{
um = u2 - 1.;
}
else if(!isInf1 && isInf2)
{
um = u1 + 1.;
}
else //isInf1 && isInf2
{
um = 0.;
}
isInf1 = Precision::IsInfinite(v1), isInf2 = Precision::IsInfinite(v2);
if (!isInf1 && !isInf2)
{
vm = (v1 + v2) / 2.;
}
else if (isInf1 && !isInf2)
{
vm = v2 - 1.;
}
else if(!isInf1 && isInf2)
{
vm = v1 + 1.;
}
else //isInf1 && isInf2
{
vm = 0.;
}
gp_Pnt aP;
gp_Vec aD1, aD2;
aBAS.D1(um, vm, aP, aD1, aD2);
gp_Vec aNorm = aD1.Crossed(aD2);
gp_Dir aPlnNorm = aPln.Position().Direction();
if (aNorm.Dot(aPlnNorm) < 0.)
{
aPlnNorm.Reverse();
gp_Ax1 anAx(aPln.Position().Location(), aPlnNorm);
aPln.SetAxis(anAx);
}
Handle(Geom_Plane) aPlane = new Geom_Plane(aPln);
TopoDS_Face aPlanarFace;
aBB.MakeFace(aPlanarFace, aPlane, aTolForFace);

View File

@@ -308,15 +308,10 @@ Standard_Boolean BRepTools_GTrsfModification::NewTriangulation(const TopoDS_Face
// modify normals
if (theTriangulation->HasNormals())
{
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbNodes(); ++anInd)
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbTriangles(); ++anInd)
{
gp_Dir aNormal = theTriangulation->Normal(anInd);
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);
aNormal.Transform(aGTrsf.Trsf());
theTriangulation->SetNormal(anInd, aNormal);
}
}

View File

@@ -4234,6 +4234,133 @@ void BSplCLib::Resolution( Standard_Real& Poles,
UTolerance = Tolerance3D / RealSmall();
}
//=======================================================================
// function : Intervals
// purpose :
//=======================================================================
Standard_Integer BSplCLib::Intervals (const TColStd_Array1OfReal& theKnots,
const TColStd_Array1OfInteger& theMults,
Standard_Integer theDegree,
Standard_Boolean isPeriodic,
Standard_Integer theContinuity,
Standard_Real theFirst,
Standard_Real theLast,
Standard_Real theTolerance,
TColStd_Array1OfReal* theIntervals)
{
// remove all knots with multiplicity less or equal than (degree - continuity) except first and last
Standard_Integer aFirstIndex = isPeriodic ? 1 : FirstUKnotIndex (theDegree, theMults);
Standard_Integer aLastIndex = isPeriodic ? theKnots.Size() : LastUKnotIndex (theDegree, theMults);
TColStd_Array1OfReal aNewKnots (1, aLastIndex - aFirstIndex + 1);
Standard_Integer aNbNewKnots = 0;
for (Standard_Integer anIndex = aFirstIndex; anIndex <= aLastIndex; anIndex++)
{
if (theMults(anIndex) > (theDegree - theContinuity) ||
anIndex == aFirstIndex ||
anIndex == aLastIndex)
{
aNbNewKnots++;
aNewKnots(aNbNewKnots) = theKnots[anIndex];
}
}
aNewKnots.Resize (1, aNbNewKnots, Standard_True);
// the range boundaries
Standard_Real aCurFirst = theFirst;
Standard_Real aCurLast = theLast;
Standard_Real aPeriod = 0.0;
Standard_Integer aFirstPeriod = 0;
Standard_Integer aLastPeriod = 0;
// move boundaries into period
if (isPeriodic)
{
Standard_Real aLower = theKnots.First();
Standard_Real anUpper = theKnots.Last();
aPeriod = anUpper - aLower;
while (aCurFirst < aLower)
{
aCurFirst += aPeriod;
aFirstPeriod--;
}
while (aCurLast < aLower)
{
aCurLast += aPeriod;
aLastPeriod--;
}
while (aCurFirst >= anUpper)
{
aCurFirst -= aPeriod;
aFirstPeriod += 1;
}
while (aCurLast >= anUpper)
{
aCurLast -= aPeriod;
aLastPeriod += 1;
}
}
// locate the left and nearest knot for boundaries
Standard_Integer anIndex1 = 0;
Standard_Integer anIndex2 = 0;
Standard_Real aDummyDouble;
// we use version of LocateParameter that doesn't need multiplicities
LocateParameter(theDegree, aNewKnots, TColStd_Array1OfInteger(), aCurFirst, Standard_False, 1, aNbNewKnots, anIndex1, aDummyDouble);
LocateParameter(theDegree, aNewKnots, TColStd_Array1OfInteger(), aCurLast, Standard_False, 1, aNbNewKnots, anIndex2, aDummyDouble);
// the case when the beginning of the range coincides with the next knot
if (anIndex1 < aNbNewKnots && Abs(aNewKnots[anIndex1 + 1] - aCurFirst) < theTolerance)
{
anIndex1 += 1;
}
// the case when the ending of the range coincides with the current knot
if (aNbNewKnots && Abs(aNewKnots[anIndex2] - aCurLast) < theTolerance)
{
anIndex2 -= 1;
}
Standard_Integer aNbIntervals = anIndex2 - anIndex1 + 1 + (aLastPeriod - aFirstPeriod) * (aNbNewKnots - 1);
// fill the interval array
if (theIntervals)
{
theIntervals->Resize (1, aNbIntervals + 1, Standard_False);
if (isPeriodic && aLastPeriod != aFirstPeriod)
{
Standard_Integer anIndex = 1;
// part from the begging of range to the end of the first period
for (Standard_Integer i = anIndex1; i < aNewKnots.Size(); i++, anIndex++)
{
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aFirstPeriod * aPeriod;
}
// full periods
for (Standard_Integer aPeriodNum = aFirstPeriod + 1; aPeriodNum < aLastPeriod; aPeriodNum++)
{
for (Standard_Integer i = 1; i < aNewKnots.Size(); i++, anIndex++)
{
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aPeriodNum * aPeriod;
}
}
// part from the begging of the last period to the end of range
for (Standard_Integer i = 1; i <= anIndex2; i++, anIndex++)
{
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aLastPeriod * aPeriod;
}
}
else
{
Standard_Integer anIndex = 1;
for (Standard_Integer i = anIndex1; i <= anIndex2; i++, anIndex++)
{
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aFirstPeriod * aPeriod;
}
}
// update the first position (the begging of range doesn't coincide with the knot at anIndex1 in general)
theIntervals->ChangeValue(1) = theFirst;
// write the ending of the range (we didn't write it at all)
theIntervals->ChangeValue(aNbIntervals + 1) = theLast;
}
return aNbIntervals;
}
//=======================================================================
// function: FlatBezierKnots
// purpose :

View File

@@ -1456,8 +1456,26 @@ public:
//! we have |f (u1) - f (u0)| < Tolerance3D
Standard_EXPORT static void Resolution (const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const Standard_Integer NumPoles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer Degree, const Standard_Real Tolerance3D, Standard_Real& UTolerance);
//! Splits the given range to BSpline intervals of given continuity
//! @param[in] theKnots the knots of BSpline
//! @param[in] theMults the knots' multiplicities
//! @param[in] theDegree the degree of BSpline
//! @param[in] isPeriodic the periodicity of BSpline
//! @param[in] theContinuity the target interval's continuity
//! @param[in] theFirst the begin of the target range
//! @param[in] theLast the end of the target range
//! @param[in] theTolerance the tolerance
//! @param[in,out] theIntervals the array to store intervals if isn't nullptr
//! @return the number of intervals
Standard_EXPORT static Standard_Integer Intervals (const TColStd_Array1OfReal& theKnots,
const TColStd_Array1OfInteger& theMults,
Standard_Integer theDegree,
Standard_Boolean isPeriodic,
Standard_Integer theContinuity,
Standard_Real theFirst,
Standard_Real theLast,
Standard_Real theTolerance,
TColStd_Array1OfReal* theIntervals);
protected:

View File

@@ -1157,82 +1157,97 @@ void BSplCLib::MergeBSplineKnots
index,
num_knots ;
if (StartValue < EndValue - Tolerance) {
TColStd_Array1OfReal knots1(1,Knots1.Length()) ;
TColStd_Array1OfReal knots2(1,Knots2.Length()) ;
degree = Degree1 + Degree2 ;
index = 1 ;
TColStd_Array1OfReal knots1(1, Knots1.Length());
TColStd_Array1OfReal knots2(1, Knots2.Length());
degree = Degree1 + Degree2;
index = 1;
for (ii = Knots1.Lower() ; ii <= Knots1.Upper() ; ii++) {
knots1(index) = Knots1(ii) ;
index += 1 ;
for (ii = Knots1.Lower(); ii <= Knots1.Upper(); ii++) {
knots1(index) = Knots1(ii);
index += 1;
}
index = 1 ;
index = 1;
for (ii = Knots2.Lower() ; ii <= Knots2.Upper() ; ii++) {
knots2(index) = Knots2(ii) ;
index += 1 ;
for (ii = Knots2.Lower(); ii <= Knots2.Upper(); ii++) {
knots2(index) = Knots2(ii);
index += 1;
}
BSplCLib::Reparametrize(StartValue,
EndValue,
knots1) ;
BSplCLib::Reparametrize(StartValue,
EndValue,
knots2) ;
num_knots = 0 ;
jj = 1 ;
EndValue,
knots1);
for (ii = 1 ; ii <= knots1.Length() ; ii++) {
BSplCLib::Reparametrize(StartValue,
EndValue,
knots2);
num_knots = 0;
jj = 1;
for (ii = 1; ii <= knots1.Length(); ii++) {
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) - Tolerance) {
jj += 1 ;
num_knots += 1 ;
jj += 1;
num_knots += 1;
}
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) + Tolerance) {
jj += 1 ;
jj += 1;
}
num_knots += 1 ;
num_knots += 1;
}
NewKnots =
new TColStd_HArray1OfReal(1,num_knots) ;
NewKnots =
new TColStd_HArray1OfReal(1, num_knots);
NewMults =
new TColStd_HArray1OfInteger(1,num_knots) ;
num_knots = 1 ;
jj = 1 ;
new TColStd_HArray1OfInteger(1, num_knots);
num_knots = 1;
jj = 1;
for (ii = 1 ; ii <= knots1.Length() ; ii++) {
for (ii = 1; ii <= knots1.Length(); ii++) {
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) - Tolerance) {
NewKnots->ChangeArray1()(num_knots) = knots2(jj) ;
NewMults->ChangeArray1()(num_knots) = Mults2(jj) + Degree1 ;
jj += 1 ;
num_knots += 1 ;
NewKnots->ChangeArray1()(num_knots) = knots2(jj);
NewMults->ChangeArray1()(num_knots) = Mults2(jj) + Degree1;
jj += 1;
num_knots += 1;
}
set_mults_flag = 0 ;
set_mults_flag = 0;
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) + Tolerance) {
continuity = Min(Degree1 - Mults1(ii), Degree2 - Mults2(jj)) ;
set_mults_flag = 1 ;
NewMults->ChangeArray1()(num_knots) = degree - continuity ;
jj += 1 ;
continuity = Min(Degree1 - Mults1(ii), Degree2 - Mults2(jj));
set_mults_flag = 1;
NewMults->ChangeArray1()(num_knots) = degree - continuity;
jj += 1;
}
NewKnots->ChangeArray1()(num_knots) = knots1(ii) ;
if (! set_mults_flag) {
NewMults->ChangeArray1()(num_knots) = Mults1(ii) + Degree2 ;
NewKnots->ChangeArray1()(num_knots) = knots1(ii);
if (!set_mults_flag) {
NewMults->ChangeArray1()(num_knots) = Mults1(ii) + Degree2;
}
num_knots += 1 ;
num_knots += 1;
}
num_knots -= 1 ;
NewMults->ChangeArray1()(1) = degree + 1 ;
NewMults->ChangeArray1()(num_knots) = degree + 1 ;
index = 0 ;
num_knots -= 1;
NewMults->ChangeArray1()(1) = degree + 1;
NewMults->ChangeArray1()(num_knots) = degree + 1;
index = 0;
for (ii = 1 ; ii <= num_knots ; ii++) {
index += NewMults->Value(ii) ;
for (ii = 1; ii <= num_knots; ii++) {
index += NewMults->Value(ii);
}
NumPoles = index - degree - 1 ;
NumPoles = index - degree - 1;
}
else
{
degree = Degree1 + Degree2;
num_knots = 2;
NewKnots =
new TColStd_HArray1OfReal(1, num_knots);
NewKnots->ChangeArray1()(1) = StartValue;
NewKnots->ChangeArray1()(num_knots) = EndValue;
NewMults =
new TColStd_HArray1OfInteger(1, num_knots);
NewMults->ChangeArray1()(1) = degree + 1;
NewMults->ChangeArray1()(num_knots) = degree + 1;
NumPoles = BSplCLib::NbPoles(degree, Standard_False, NewMults->Array1());
}
}

View File

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

View File

@@ -85,12 +85,9 @@ public:
//! @return new object with the same field values
Standard_EXPORT virtual Handle(DE_ConfigurationNode) Copy() const = 0;
//! 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
//! Update loading status. Checking for the license.
//! @return Standard_True, if node can be used
Standard_EXPORT virtual bool UpdateLoad(const Standard_Boolean theToImport,
const Standard_Boolean theToKeep);
Standard_EXPORT virtual bool UpdateLoad();
public:

View File

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

View File

@@ -61,15 +61,10 @@ public:
//! @param[in] theWrapper object to copy
Standard_EXPORT DE_Wrapper(const Handle(DE_Wrapper)& theWrapper);
//! Gets global configuration singleton.
//! If wrapper is not set, create it by default as base class object.
//! Gets global configuration singleton
//! @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
@@ -79,7 +74,7 @@ public:
//! @param theProgress[in] progress indicator
//! @return true if Read operation has ended correctly
Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -100,7 +95,7 @@ public:
//! @param theProgress[in] progress indicator
//! @return true if Read operation has ended correctly
Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
Handle(TDocStd_Document)& theDocument,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Writes a CAD file, according internal configuration
@@ -216,33 +211,13 @@ 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 virtual Handle(DE_Wrapper) Copy() const;
Standard_EXPORT Handle(DE_Wrapper) Copy() const;
protected:
@@ -252,13 +227,22 @@ protected:
//! @param[in] theResource resource to get priority
void sort(const Handle(DE_ConfigurationContext)& theResource);
//! Find available provider from the configuration.
//! If there are several providers, choose the one with the highest priority.
//! @param[in] thePath path to the CAD file
//! @param[in] theToImport flag to finds for import. Standard_True-import, Standard_False-export
//! @param[out] theProvider created new provider
//! @return Standard_True if provider found and created
Standard_Boolean findProvider(const TCollection_AsciiString& thePath,
const Standard_Boolean theToImport,
Handle(DE_Provider)& theProvider) const;
public:
DE_ConfigurationNode::DE_SectionGlobal GlobalParameters; //!< Internal parameters for the all translators
private:
Standard_Boolean myKeepUpdates; //!< Flag to save updates operation while transfer checks
DE_ConfigurationFormatMap myConfiguration; //!< Internal map of formats
};

View File

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

View File

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

View File

@@ -37,9 +37,7 @@ Draft_FaceInfo::Draft_FaceInfo (const Handle(Geom_Surface)& S,\
const Standard_Boolean HasNewGeometry):
myNewGeom(HasNewGeometry)
{
Handle(Geom_RectangularTrimmedSurface) T = Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
if (!T.IsNull()) myGeom = T->BasisSurface();
else myGeom = S;
myGeom = S;
}

View File

@@ -481,7 +481,7 @@ Standard_Boolean Draft_Modification::Propagate ()
Handle(Geom_Surface)::DownCast(S->Transformed(L.Transformation()));
const Handle(Standard_Type)& typs = S->DynamicType();
if (typs == STANDARD_TYPE(Geom_CylindricalSurface) ||
if (/*typs == STANDARD_TYPE(Geom_CylindricalSurface) ||*/
typs == STANDARD_TYPE(Geom_ConicalSurface)) {
Standard_Real umin,umax,vmin,vmax;
BRepTools::UVBounds(F,umin,umax,vmin,vmax);
@@ -1062,7 +1062,11 @@ void Draft_Modification::Perform ()
//Find the first curve to glue
TColGeom_SequenceOfCurve Candidates;
if (S1->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface) ||
S1->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface))
S1->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface) ||
S1->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface) &&
Handle(Geom_RectangularTrimmedSurface)::DownCast(S1)->BasisSurface()->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface) ||
S1->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface) &&
Handle(Geom_RectangularTrimmedSurface)::DownCast(S1)->BasisSurface()->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface))
{
for (i = 1; i <= i2s.NbLines(); i++)
{

View File

@@ -27,7 +27,7 @@
// intended for use from debugger prompt (Command Window in Visual Studio)
//! Save geometric object identified by pointer to handle
const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr)
Standard_EXPORT const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr)
{
if (theNameStr == 0 || theHandlePtr == 0)
{
@@ -57,7 +57,7 @@ const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr)
}
//! Set point to DRAW variable
const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr)
Standard_EXPORT const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr)
{
if (theNameStr == 0 || thePntPtr == 0)
{
@@ -77,7 +77,7 @@ const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr)
}
//! Set 2d point to DRAW variable
const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* thePnt2dPtr)
Standard_EXPORT const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* thePnt2dPtr)
{
if (theNameStr == 0 || thePnt2dPtr == 0)
{
@@ -102,17 +102,17 @@ const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* thePnt2dPtr)
// work with them (DBX could, on SUN Solaris).
#ifndef _MSC_VER
const char* DrawTrSurf_Set (const char* name, const Handle(Standard_Transient)& G)
Standard_EXPORT const char* DrawTrSurf_Set (const char* name, const Handle(Standard_Transient)& G)
{
return DrawTrSurf_Set (name, (void*)&G);
}
const char* DrawTrSurf_Set (const char* theName, const gp_Pnt& thePnt)
Standard_EXPORT const char* DrawTrSurf_Set (const char* theName, const gp_Pnt& thePnt)
{
return DrawTrSurf_SetPnt (theName, (void*)&thePnt);
}
const char* DrawTrSurf_Set (const char* theName, const gp_Pnt2d& thePnt2d)
Standard_EXPORT const char* DrawTrSurf_Set (const char* theName, const gp_Pnt2d& thePnt2d)
{
return DrawTrSurf_SetPnt2d (theName, (void*)&thePnt2d);
}

View File

@@ -674,7 +674,10 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
Extrema_ExtPElC ExtPCir(aPCirc2,
Extrema_CurveTool::Circle (*myC[0]),
Precision::Confusion(), theUt11, theUt12);
if (ExtPCir.NbExt() < 1)
{
continue;
}
Standard_Real aMinSqD = ExtPCir.SquareDistance(1);
for (Standard_Integer anExtID = 2; anExtID <= ExtPCir.NbExt(); anExtID++)
{

View File

@@ -58,65 +58,6 @@ static const Standard_Real PosTol = Precision::PConfusion() / 2;
IMPLEMENT_STANDARD_RTTIEXT(Geom2dAdaptor_Curve, Adaptor2d_Curve2d)
static void DefinFPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurFirst,
Standard_Integer &theFPer);
static void DefinLPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurLast,
Standard_Integer &theLPer);
static Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
const TColStd_Array1OfInteger& theTM,
const TColStd_Array1OfInteger& theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theNbInt,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real theEps,
const Standard_Boolean thePeriodicCur,
Standard_Integer theNbIntervals,
Standard_Real theLower = 0,
Standard_Real thePeriod = 0,
Standard_Integer theIndex1 = 0,
Standard_Integer theIndex2 = 0);
static void WriteIntervals(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theNbInt,
const Standard_Integer theIndex1,
const Standard_Integer theIndex2,
const Standard_Real theCurPeriod,
const Standard_Boolean theFlagForFirst,
TColStd_Array1OfReal &theT,
TColStd_Array1OfInteger &theFinalIntervals,
Standard_Integer &theNbIntervals,
Standard_Integer &theCurInt);
static void SpreadInt(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theTM,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theFPer,
const Standard_Integer theLPer,
const Standard_Integer theNbInt,
const Standard_Real theLower,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real thePeriod,
const Standard_Real theLastParam,
const Standard_Real theEps,
TColStd_Array1OfReal &theT,
Standard_Integer &theNbIntervals);
//=======================================================================
//function : ShallowCopy
//purpose :
@@ -354,158 +295,6 @@ GeomAbs_Shape Geom2dAdaptor_Curve::Continuity() const
}
}
//=======================================================================
//function : DefinFPeriod
//purpose :
//=======================================================================
void DefinFPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurFirst,
Standard_Integer &theFPer)
{
if (theCurFirst >= theLower)
{
while (theCurFirst >= theUpper)
{
theCurFirst = theCurFirst - thePeriod;
theFPer++;
}
if (Abs(theUpper - theCurFirst) <= theEps)
{
theFPer++;
theCurFirst = theLower;
}
}
else
{
while (theCurFirst < theLower)
{
theCurFirst = theCurFirst + thePeriod;
if (Abs(theLower - theCurFirst) > theEps)
{
theFPer--;
}
}
if (Abs(theUpper - theCurFirst) <= theEps)
{
theCurFirst = theLower;
}
}
}
//=======================================================================
//function : DefinLPeriod
//purpose :
//=======================================================================
void DefinLPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurLast,
Standard_Integer &theLPer)
{
if (theCurLast >= theLower)
{
if ((theCurLast >= theUpper) && (Abs(theCurLast - theUpper) <= theEps))
{
theCurLast = theUpper;
}
else
{
while (theCurLast >= theUpper)
{
theCurLast = theCurLast - thePeriod;
theLPer++;
}
if (Abs(theUpper - theCurLast) <= theEps)
{
theCurLast = theLower;
}
}
}
else
{
while (theCurLast < theLower)
{
theCurLast = theCurLast + thePeriod;
if (Abs(theLower - theCurLast) > theEps)
{
theLPer--;
}
}
if (Abs(theUpper - theCurLast) <= theEps)
{
theCurLast = theLower;
}
}
}
//=======================================================================
//function : LocalNbIntervals
//purpose :
//=======================================================================
Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
const TColStd_Array1OfInteger& theTM,
const TColStd_Array1OfInteger& theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theNbInt,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real theEps,
const Standard_Boolean thePeriodicCur,
Standard_Integer theNbIntervals,
Standard_Real theLower,
Standard_Real thePeriod,
Standard_Integer theIndex1,
Standard_Integer theIndex2)
{
Standard_Real aNewFirst = theFirst;
Standard_Real aNewLast = theLast;
if (theIndex1 == 0)
{
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
thePeriodicCur, 1, theNb, theIndex1, aNewFirst);
}
if (theIndex2 == 0)
{
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLast,
thePeriodicCur, 1, theNb, theIndex2, aNewLast);
}
// Protection against theFirst = UFirst - eps, which located as ULast - eps
if (thePeriodicCur && ((aNewLast - aNewFirst) < Precision::PConfusion()))
{
if (Abs(aNewLast - theLower) < Precision::PConfusion())
{
aNewLast += thePeriod;
}
else
{
aNewFirst -= thePeriod;
}
}
if (Abs(aNewFirst - theTK(theIndex1 + 1)) < theEps)
{
theIndex1++;
}
if ((aNewLast - theTK(theIndex2)) > theEps)
{
theIndex2++;
}
for (Standard_Integer i = 1; i <= theNbInt; i++)
{
if (theInter(i) > theIndex1 && theInter(i) < theIndex2) theNbIntervals++;
}
return theNbIntervals;
}
//=======================================================================
//function : NbIntervals
//purpose :
@@ -513,187 +302,49 @@ Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
Standard_Integer Geom2dAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
{
Standard_Integer myNbIntervals = 1;
Standard_Integer NbSplit;
if (myTypeCurve == GeomAbs_BSplineCurve) {
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
TColStd_Array1OfInteger Inter(1, LastIndex - FirstIndex + 1);
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
if (aContPer || aContNotPer) {
Standard_Integer Cont;
switch (S) {
case GeomAbs_G1:
case GeomAbs_G2:
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0:
myNbIntervals = 1;
break;
case GeomAbs_C1:
case GeomAbs_C2:
case GeomAbs_C3:
case GeomAbs_CN:
{
if (S == GeomAbs_C1) Cont = 1;
else if (S == GeomAbs_C2) Cont = 2;
else if (S == GeomAbs_C3) Cont = 3;
else Cont = myBSplineCurve->Degree();
Standard_Integer Degree = myBSplineCurve->Degree();
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
TColStd_Array1OfInteger Mults(1, NbKnots);
myBSplineCurve->Multiplicities(Mults);
NbSplit = 1;
Standard_Integer Index = FirstIndex;
Inter(NbSplit) = Index;
Index++;
NbSplit++;
while (Index < LastIndex)
{
if (Degree - Mults(Index) < Cont)
{
Inter(NbSplit) = Index;
NbSplit++;
}
Index++;
}
Inter(NbSplit) = Index;
Standard_Integer NbInt = NbSplit - 1;
Standard_Integer Nb = myBSplineCurve->NbKnots();
TColStd_Array1OfReal TK(1, Nb);
TColStd_Array1OfInteger TM(1, Nb);
myBSplineCurve->Knots(TK);
myBSplineCurve->Multiplicities(TM);
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
Precision::PConfusion());
myNbIntervals = 1;
if (!myBSplineCurve->IsPeriodic())
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
myFirst, myLast, Eps, Standard_False, myNbIntervals);
}
else
{
Standard_Real aCurFirst = myFirst;
Standard_Real aCurLast = myLast;
Standard_Real aLower = myBSplineCurve->FirstParameter();
Standard_Real anUpper = myBSplineCurve->LastParameter();
if ((Abs(aCurFirst - aLower) < Eps) && (aCurFirst < aLower))
{
aCurFirst = aLower;
}
if ((Abs(aCurLast - anUpper) < Eps) && (aCurLast < anUpper))
{
aCurLast = anUpper;
}
Standard_Real aPeriod = myBSplineCurve->Period();
Standard_Integer aLPer = 1; Standard_Integer aFPer = 1;
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
{
aCurFirst = aLower;
}
else
{
DefinFPeriod(aLower, anUpper,
Eps, aPeriod, aCurFirst, aFPer);
}
DefinLPeriod(aLower, anUpper,
Eps, aPeriod, aCurLast, aLPer);
if ((Abs(aLower - myFirst) < Eps) && (Abs(anUpper - myLast) < Eps))
{
myNbIntervals = NbInt;
}
else
{
Standard_Integer aSumPer = Abs(aLPer - aFPer);
Standard_Real aFirst = 0;
if (aLower < 0 && anUpper == 0)
{
if (Abs(aCurLast) < Eps)
{
aCurLast = 0;
}
aFirst = aLower;
}
if (aSumPer <= 1)
{
if ((Abs(myFirst - TK(Nb) - aPeriod * (aFPer - 1)) <= Eps) && (myLast < (TK(Nb) + aPeriod * (aLPer - 1))))
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
return myNbIntervals;
}
if ((Abs(myFirst - aLower) < Eps) && (Abs(myLast - anUpper) < Eps))
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
return myNbIntervals;
}
}
if (aSumPer != 0)
{
Standard_Integer aFInt = 0;
Standard_Integer aLInt = 0;
Standard_Integer aPInt = NbInt;
if ((aCurFirst != aPeriod) || ((aCurFirst != anUpper) && (Abs(myFirst) < Eps)))
{
aFInt = 1;
}
if ((aCurLast != 0) && (aCurLast != anUpper))
{
aLInt = 1;
}
aFInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aCurFirst, anUpper, Eps, Standard_True, aFInt, aLower, aPeriod);
if (aCurLast == anUpper)
{
aLInt = NbInt;
}
else
{
if (Abs(aCurLast - aFirst) > Eps)
{
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod, 1);
}
else
{
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod);
}
}
myNbIntervals = aFInt + aLInt + aPInt * (aSumPer - 1);
}
else
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aCurFirst, aCurLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
}
}
}
}
break;
}
if (myTypeCurve == GeomAbs_BSplineCurve)
{
if ((!myBSplineCurve->IsPeriodic() && S <= Continuity()) || S == GeomAbs_C0)
{
return 1;
}
Standard_Integer aDegree = myBSplineCurve->Degree();
Standard_Integer aCont;
switch (S)
{
case GeomAbs_C1:
aCont = 1;
break;
case GeomAbs_C2:
aCont = 2;
break;
case GeomAbs_C3:
aCont = 3;
break;
case GeomAbs_CN:
aCont = aDegree;
break;
default:
throw Standard_DomainError ("Geom2dAdaptor_Curve::NbIntervals()");
}
Standard_Real anEps = Min(Resolution(Precision::Confusion()), Precision::PConfusion());
return BSplCLib::Intervals(myBSplineCurve->Knots(),
myBSplineCurve->Multiplicities(),
aDegree,
myBSplineCurve->IsPeriodic(),
aCont,
myFirst,
myLast,
anEps,
nullptr);
}
else if (myTypeCurve == GeomAbs_OffsetCurve){
Standard_Integer myNbIntervals = 1;
GeomAbs_Shape BaseS=GeomAbs_C0;
switch(S){
case GeomAbs_G1:
@@ -705,208 +356,14 @@ Standard_Integer Geom2dAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
case GeomAbs_C2: BaseS = GeomAbs_C3; break;
default: BaseS = GeomAbs_CN;
}
Geom2dAdaptor_Curve anAdaptor( Handle(Geom2d_OffsetCurve)::DownCast(myCurve)->BasisCurve() );
Geom2dAdaptor_Curve anAdaptor (Handle(Geom2d_OffsetCurve)::DownCast(myCurve)->BasisCurve(), myFirst, myLast);
myNbIntervals = anAdaptor.NbIntervals(BaseS);
return myNbIntervals;
}
return myNbIntervals;
}
//=======================================================================
//function : WriteIntervals
//purpose :
//=======================================================================
void WriteIntervals(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theNbInt,
const Standard_Integer theIndex1,
const Standard_Integer theIndex2,
const Standard_Real theCurPeriod,
const Standard_Boolean theFlagForFirst,
TColStd_Array1OfReal &theT,
TColStd_Array1OfInteger &theFinalIntervals,
Standard_Integer &theNbIntervals,
Standard_Integer &theCurInt)
{
if (theFlagForFirst)
{
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
{
if (theInter(anId) > theIndex1 && theInter(anId) <= theIndex2)
{
theNbIntervals++;
theFinalIntervals(theNbIntervals) = theInter(anId);
}
}
}
else
{
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
{
if (theInter(anId) > theIndex1 && theInter(anId) < theIndex2)
{
theNbIntervals++;
theFinalIntervals(theNbIntervals) = theInter(anId);
}
}
}
theFinalIntervals(theNbIntervals + 1) = theIndex2;
for (Standard_Integer anId = theCurInt; anId <= theNbIntervals + 1; anId++)
{
theT(anId) = theTK(theFinalIntervals(anId)) + theCurPeriod;
theCurInt++;
}
}
//=======================================================================
//function : SpreadInt
//purpose :
//=======================================================================
void SpreadInt(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theTM,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theFPer,
const Standard_Integer theLPer,
const Standard_Integer theNbInt,
const Standard_Real theLower,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real thePeriod,
const Standard_Real theLastParam,
const Standard_Real theEps,
TColStd_Array1OfReal &theT,
Standard_Integer &theNbIntervals)
{
Standard_Integer anIndex1 = 0;
Standard_Integer anIndex2 = 0;
Standard_Real aNewFirst, aNewLast;
Standard_Integer anUpper;
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
Standard_True, 1, theNb, anIndex1, aNewFirst);
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLastParam,
Standard_True, 1, theNb, anIndex2, aNewLast);
if (Abs(aNewFirst - theTK(anIndex1 + 1)) < theEps)
{
anIndex1++;
}
if ((aNewLast - theTK(anIndex2)) > theEps)
{
anIndex2++;
}
theNbIntervals = 1;
if (anIndex1 == theNb)
{
anIndex1 = 1;
}
// Count the max number of boundaries of intervals
if (Abs(theLPer - theFPer) > 1)
{
anUpper = theNb - anIndex1 + anIndex2 + (theLPer - theFPer - 1) * theNb + 1;
}
else
{
anUpper = theNb - anIndex1 + anIndex2 + 1;
}
if (theLPer == theFPer)
{
anUpper = theInter.Upper();
}
TColStd_Array1OfInteger aFinalIntervals(1, anUpper);
aFinalIntervals(1) = anIndex1;
// If first and last are in the same period
if ((Abs(theLPer - theFPer) == 0))
{
Standard_Integer aCurInt = 1;
Standard_Real aCurPeriod = theFPer * thePeriod;
if (theFirst == aNewFirst && theLast == aNewLast)
{
aCurPeriod = 0;
}
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
anIndex2, aCurPeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
// If the first and the last are in neighboring periods
if (Abs(theLPer - theFPer) == 1)
{
Standard_Integer aCurInt = 1;
if (Abs(theLastParam - theLower) < theEps)
{
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
else
{
// For period with first
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
// For period with last
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
}
// If the first and the last are far apart
if (Abs(theLPer - theFPer) > 1)
{
Standard_Integer aCurInt = 1;
if (Abs(theLastParam - theLower) < theEps)
{
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
Standard_Integer aNbPer = Abs(theLPer - theFPer);
Standard_Integer aCurPer = theFPer + 1;
while (aNbPer > 1)
{
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
aNbPer--;
aCurPer++;
}
return;
}
else
{
// For period with first
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
Standard_Integer aNbPer = Abs(theLPer - theFPer);
Standard_Integer aCurPer = theFPer + 1;
while (aNbPer > 1)
{
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
aNbPer--;
aCurPer++;
}
// For period with last
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
return 1;
}
}
@@ -915,156 +372,53 @@ void SpreadInt(const TColStd_Array1OfReal &theTK,
//purpose :
//=======================================================================
void Geom2dAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
const GeomAbs_Shape S ) const
void Geom2dAdaptor_Curve::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
{
Standard_Integer myNbIntervals = 1;
Standard_Integer NbSplit;
if (myTypeCurve == GeomAbs_BSplineCurve) {
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
TColStd_Array1OfInteger Inter (1, LastIndex-FirstIndex+1);
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
if (aContPer || aContNotPer) {
Standard_Integer Cont;
switch ( S) {
case GeomAbs_G1:
case GeomAbs_G2:
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0:
myNbIntervals = 1;
break;
case GeomAbs_C1:
case GeomAbs_C2:
case GeomAbs_C3:
case GeomAbs_CN:
{
if (S == GeomAbs_C1) Cont = 1;
else if (S == GeomAbs_C2) Cont = 2;
else if (S == GeomAbs_C3) Cont = 3;
else Cont = myBSplineCurve->Degree();
Standard_Integer Degree = myBSplineCurve->Degree();
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
TColStd_Array1OfInteger Mults(1, NbKnots);
myBSplineCurve->Multiplicities(Mults);
NbSplit = 1;
Standard_Integer Index = FirstIndex;
Inter(NbSplit) = Index;
Index++;
NbSplit++;
while (Index < LastIndex)
{
if (Degree - Mults(Index) < Cont)
{
Inter(NbSplit) = Index;
NbSplit++;
}
Index++;
}
Inter(NbSplit) = Index;
Standard_Integer NbInt = NbSplit - 1;
Standard_Integer Nb = myBSplineCurve->NbKnots();
Standard_Integer Index1 = 0;
Standard_Integer Index2 = 0;
Standard_Real newFirst, newLast;
TColStd_Array1OfReal TK(1, Nb);
TColStd_Array1OfInteger TM(1, Nb);
myBSplineCurve->Knots(TK);
myBSplineCurve->Multiplicities(TM);
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
Precision::PConfusion());
if (!myBSplineCurve->IsPeriodic())
{
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myFirst,
myBSplineCurve->IsPeriodic(),
1, Nb, Index1, newFirst);
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myLast,
myBSplineCurve->IsPeriodic(),
1, Nb, Index2, newLast);
// On decale eventuellement les indices
// On utilise une "petite" tolerance, la resolution ne doit
// servir que pour les tres longue courbes....(PRO9248)
if (Abs(newFirst - TK(Index1 + 1)) < Eps) Index1++;
if (newLast - TK(Index2) > Eps) Index2++;
Inter(1) = Index1;
myNbIntervals = 1;
for (Standard_Integer i = 1; i <= NbInt; i++) {
if (Inter(i) > Index1 && Inter(i) < Index2) {
myNbIntervals++;
Inter(myNbIntervals) = Inter(i);
}
}
Inter(myNbIntervals + 1) = Index2;
Standard_Integer ii = T.Lower() - 1;
for (Standard_Integer I = 1; I <= myNbIntervals + 1; I++) {
T(ii + I) = TK(Inter(I));
}
}
else
{
Standard_Real aFirst = myFirst;
Standard_Real aLast = myLast;
Standard_Real aCurFirst = aFirst;
Standard_Real aCurLast = aLast;
Standard_Real aPeriod = myBSplineCurve->Period();
Standard_Real aLower = myBSplineCurve->FirstParameter();
Standard_Real anUpper = myBSplineCurve->LastParameter();
Standard_Integer aLPer = 0; Standard_Integer aFPer = 0;
if (Abs(myFirst - aLower) <= Eps)
{
aCurFirst = aLower;
aFirst = aCurFirst;
}
if (Abs(myLast - anUpper) <= Eps)
{
aCurLast = anUpper;
aLast = aCurLast;
}
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
{
aCurFirst = aLower;
}
else
{
DefinFPeriod(aLower, anUpper,
Eps, aPeriod, aCurFirst, aFPer);
}
DefinLPeriod(aLower, anUpper,
Eps, aPeriod, aCurLast, aLPer);
if (myFirst == aLower)
{
aFPer = 0;
}
SpreadInt(TK, TM, Inter, myBSplineCurve->Degree(), Nb, aFPer, aLPer, NbInt, aLower, myFirst, myLast, aPeriod,
aCurLast, Eps, T, myNbIntervals);
T(T.Lower()) = aFirst;
T(T.Lower() + myNbIntervals) = aLast;
return;
}
}
T(T.Lower()) = myFirst;
T(T.Lower() + myNbIntervals) = myLast;
if (myTypeCurve == GeomAbs_BSplineCurve)
{
if ((!myBSplineCurve->IsPeriodic() && S <= Continuity()) || S == GeomAbs_C0)
{
T( T.Lower() ) = myFirst;
T( T.Lower() + 1 ) = myLast;
return;
}
}
Standard_Integer aDegree = myBSplineCurve->Degree();
Standard_Integer aCont;
switch (S)
{
case GeomAbs_C1:
aCont = 1;
break;
case GeomAbs_C2:
aCont = 2;
break;
case GeomAbs_C3:
aCont = 3;
break;
case GeomAbs_CN:
aCont = aDegree;
break;
default:
throw Standard_DomainError ("Geom2dAdaptor_Curve::Intervals()");
}
Standard_Real anEps = Min(Resolution(Precision::Confusion()), Precision::PConfusion());
BSplCLib::Intervals(myBSplineCurve->Knots(),
myBSplineCurve->Multiplicities(),
aDegree,
myBSplineCurve->IsPeriodic(),
aCont,
myFirst,
myLast,
anEps,
&T);
}
else if (myTypeCurve == GeomAbs_OffsetCurve){
Standard_Integer myNbIntervals = 1;
GeomAbs_Shape BaseS=GeomAbs_C0;
switch(S){
case GeomAbs_G1:
@@ -1077,13 +431,18 @@ void Geom2dAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
default: BaseS = GeomAbs_CN;
}
Geom2dAdaptor_Curve anAdaptor( Handle(Geom2d_OffsetCurve)::DownCast(myCurve)->BasisCurve() );
Geom2dAdaptor_Curve anAdaptor (Handle(Geom2d_OffsetCurve)::DownCast(myCurve)->BasisCurve(), myFirst, myLast);
myNbIntervals = anAdaptor.NbIntervals(BaseS);
anAdaptor.Intervals(T, BaseS);
T( T.Lower() ) = myFirst;
T( T.Lower() + myNbIntervals ) = myLast;
}
T( T.Lower() ) = myFirst;
T( T.Lower() + myNbIntervals ) = myLast;
else
{
T( T.Lower() ) = myFirst;
T( T.Lower() + 1 ) = myLast;
}
}
//=======================================================================

View File

@@ -515,7 +515,6 @@ static Handle(Geom2d_BSplineCurve) MultNumandDenom(const Handle(Geom2d_BSplineCu
Handle(TColStd_HArray1OfReal) resKnots;
Handle(TColStd_HArray1OfInteger) resMults;
Standard_Real start_value,end_value;
Standard_Real tolerance=Precision::Confusion();
Standard_Integer resNbPoles,degree,
ii,jj,
aStatus;
@@ -527,6 +526,7 @@ static Handle(Geom2d_BSplineCurve) MultNumandDenom(const Handle(Geom2d_BSplineCu
BS->KnotSequence(BSFlatKnots);
start_value = BSKnots(1);
end_value = BSKnots(BS->NbKnots());
Standard_Real tolerance = 10.*Epsilon(Abs(end_value));
a->Knots(aKnots);
a->Poles(aPoles);
@@ -565,22 +565,6 @@ static Handle(Geom2d_BSplineCurve) MultNumandDenom(const Handle(Geom2d_BSplineCu
degree,
resDenPoles,
aStatus);
// BSplCLib::FunctionMultiply(law_evaluator,
// BS->Degree(),
// BSFlatKnots,
// BSPoles,
// resFlatKnots,
// degree,
// resNumPoles,
// aStatus);
// BSplCLib::FunctionMultiply(law_evaluator,
// BS->Degree(),
// BSFlatKnots,
// BSWeights,
// resFlatKnots,
// degree,
// resDenPoles,
// aStatus);
for (ii=1;ii<=resNbPoles;ii++)
for(jj=1;jj<=2;jj++)
resPoles(ii).SetCoord(jj,resNumPoles(ii).Coord(jj)/resDenPoles(ii));
@@ -1339,24 +1323,22 @@ void Geom2dConvert::ConcatC1(TColGeom2d_Array1OfBSplineCurve& ArrayOf
Curve1Poles(ii).SetCoord(jj,Curve1Poles(ii).Coord(jj)*Curve1Weights(ii));
//POP pour NT
Geom2dConvert_reparameterise_evaluator ev (aPolynomialCoefficient);
// BSplCLib::FunctionReparameterise(reparameterise_evaluator,
BSplCLib::FunctionReparameterise(ev,
Curve1->Degree(),
Curve1FlatKnots,
Curve1Poles,
FlatKnots,
aNewCurveDegree,
aNewCurveDegree,
NewPoles,
aStatus
);
TColStd_Array1OfReal NewWeights(1, FlatKnots.Length() - (aNewCurveDegree + 1));
// BSplCLib::FunctionReparameterise(reparameterise_evaluator,
TColStd_Array1OfReal NewWeights(1, FlatKnots.Length() - (aNewCurveDegree + 1));
BSplCLib::FunctionReparameterise(ev,
Curve1->Degree(),
Curve1FlatKnots,
Curve1Weights,
FlatKnots,
aNewCurveDegree,
aNewCurveDegree,
NewWeights,
aStatus
);

View File

@@ -58,65 +58,6 @@ static const Standard_Real PosTol = Precision::PConfusion() / 2;
IMPLEMENT_STANDARD_RTTIEXT(GeomAdaptor_Curve, Adaptor3d_Curve)
static void DefinFPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurFirst,
Standard_Integer &theFPer);
static void DefinLPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurLast,
Standard_Integer &theLPer);
static Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
const TColStd_Array1OfInteger& theTM,
const TColStd_Array1OfInteger& theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theNbInt,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real theEps,
const Standard_Boolean thePeriodicCur,
Standard_Integer theNbIntervals,
Standard_Real theLower = 0,
Standard_Real thePeriod = 0,
Standard_Integer theIndex1 = 0,
Standard_Integer theIndex2 = 0);
static void WriteIntervals(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theNbInt,
const Standard_Integer theIndex1,
const Standard_Integer theIndex2,
const Standard_Real theCurPeriod,
const Standard_Boolean theFlagForFirst,
TColStd_Array1OfReal &theT,
TColStd_Array1OfInteger &theFinalIntervals,
Standard_Integer &theNbIntervals,
Standard_Integer &theCurInt);
static void SpreadInt(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theTM,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theFPer,
const Standard_Integer theLPer,
const Standard_Integer theNbInt,
const Standard_Real theLower,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real thePeriod,
const Standard_Real theLastParam,
const Standard_Real theEps,
TColStd_Array1OfReal &theT,
Standard_Integer &theNbIntervals);
//=======================================================================
//function : ShallowCopy
//purpose :
@@ -310,159 +251,6 @@ GeomAbs_Shape GeomAdaptor_Curve::Continuity() const
return GeomAbs_CN;
}
//=======================================================================
//function : DefinFPeriod
//purpose :
//=======================================================================
void DefinFPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurFirst,
Standard_Integer &theFPer)
{
if (theCurFirst >= theLower)
{
while (theCurFirst >= theUpper)
{
theCurFirst = theCurFirst - thePeriod;
theFPer++;
}
if (Abs(theUpper - theCurFirst) <= theEps)
{
theFPer++;
theCurFirst = theLower;
}
}
else
{
while (theCurFirst < theLower)
{
theCurFirst = theCurFirst + thePeriod;
if ((Abs(theLower - theCurFirst)) > theEps)
{
theFPer--;
}
}
if (Abs(theUpper - theCurFirst) <= theEps)
{
theCurFirst = theLower;
}
}
}
//=======================================================================
//function : DefinLPeriod
//purpose :
//=======================================================================
void DefinLPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurLast,
Standard_Integer &theLPer)
{
if (theCurLast >= theLower)
{
if ((theCurLast >= theUpper) && (Abs(theCurLast - theUpper) <= theEps))
{
theCurLast = theUpper;
}
else
{
while (theCurLast >= theUpper)
{
theCurLast = theCurLast - thePeriod;
theLPer++;
}
if (Abs(theUpper - theCurLast) <= theEps)
{
theCurLast = theLower;
}
}
}
else
{
while (theCurLast < theLower)
{
theCurLast = theCurLast + thePeriod;
if (Abs(theLower - theCurLast) > theEps)
{
theLPer--;
}
}
if ((theUpper - theCurLast) <= theEps)
{
theCurLast = theLower;
}
}
}
//=======================================================================
//function : LocalNbIntervals
//purpose :
//=======================================================================
Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
const TColStd_Array1OfInteger& theTM,
const TColStd_Array1OfInteger& theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theNbInt,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real theEps,
const Standard_Boolean thePeriodicCur,
Standard_Integer theNbIntervals,
Standard_Real theLower,
Standard_Real thePeriod,
Standard_Integer theIndex1,
Standard_Integer theIndex2)
{
Standard_Real aNewFirst = theFirst;
Standard_Real aNewLast = theLast;
if (theIndex1 == 0)
{
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
thePeriodicCur, 1, theNb, theIndex1, aNewFirst);
}
if (theIndex2 == 0)
{
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLast,
thePeriodicCur, 1, theNb, theIndex2, aNewLast);
}
// Protection against theFirst = UFirst - eps, which located as ULast - eps
if (thePeriodicCur && ((aNewLast - aNewFirst) < Precision::PConfusion()))
{
if (Abs(aNewLast - theLower) < Precision::PConfusion())
{
aNewLast += thePeriod;
}
else
{
aNewFirst -= thePeriod;
}
}
if (Abs(aNewFirst - theTK(theIndex1 + 1)) < theEps)
{
theIndex1++;
}
if ((aNewLast - theTK(theIndex2)) > theEps)
{
theIndex2++;
}
for (Standard_Integer i = 1; i <= theNbInt; i++)
{
if (theInter(i) > theIndex1 && theInter(i) < theIndex2) theNbIntervals++;
}
return theNbIntervals;
}
//=======================================================================
//function : NbIntervals
//purpose :
@@ -470,207 +258,61 @@ Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
{
Standard_Integer myNbIntervals = 1;
Standard_Integer NbSplit;
if (myTypeCurve == GeomAbs_BSplineCurve) {
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
TColStd_Array1OfInteger Inter(1, LastIndex - FirstIndex + 1);
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
if(aContPer || aContNotPer) {
Standard_Integer Cont;
switch (S) {
case GeomAbs_G1:
case GeomAbs_G2:
throw Standard_DomainError("GeomAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0:
myNbIntervals = 1;
break;
case GeomAbs_C1:
case GeomAbs_C2:
case GeomAbs_C3:
case GeomAbs_CN:
{
if (S == GeomAbs_C1) Cont = 1;
else if (S == GeomAbs_C2) Cont = 2;
else if (S == GeomAbs_C3) Cont = 3;
else Cont = myBSplineCurve->Degree();
Standard_Integer Degree = myBSplineCurve->Degree();
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
TColStd_Array1OfInteger Mults(1, NbKnots);
myBSplineCurve->Multiplicities(Mults);
NbSplit = 1;
Standard_Integer Index = FirstIndex;
Inter(NbSplit) = Index;
Index++;
NbSplit++;
while (Index < LastIndex)
{
if (Degree - Mults(Index) < Cont)
{
Inter(NbSplit) = Index;
NbSplit++;
}
Index++;
}
Inter(NbSplit) = Index;
Standard_Integer NbInt = NbSplit - 1;
Standard_Integer Nb = myBSplineCurve->NbKnots();
Standard_Integer Index1 = 0;
Standard_Integer Index2 = 0;
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
Precision::PConfusion());
myNbIntervals = 1;
if (!myBSplineCurve->IsPeriodic())
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
myFirst, myLast, Eps, Standard_False, myNbIntervals);
}
else
{
Standard_Real aCurFirst = myFirst;
Standard_Real aCurLast = myLast;
Standard_Real aLower = myBSplineCurve->FirstParameter();
Standard_Real anUpper = myBSplineCurve->LastParameter();
if ((Abs(aCurFirst - aLower) < Eps) && (aCurFirst < aLower))
{
aCurFirst = aLower;
}
if ((Abs(aCurLast - anUpper) < Eps) && (aCurLast < anUpper))
{
aCurLast = anUpper;
}
Standard_Real aPeriod = myBSplineCurve->Period();
Standard_Integer aLPer = 1; Standard_Integer aFPer = 1;
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
{
aCurFirst = aLower;
}
else
{
DefinFPeriod(aLower, anUpper,
Eps, aPeriod, aCurFirst, aFPer);
}
DefinLPeriod(aLower, anUpper,
Eps, aPeriod, aCurLast, aLPer);
Standard_Real aNewFirst;
Standard_Real aNewLast;
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myFirst,
Standard_True, 1, Nb, Index1, aNewFirst);
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myLast,
Standard_True, 1, Nb, Index2, aNewLast);
if ((aNewFirst == myFirst && aNewLast == myLast) && (aFPer != aLPer))
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
}
else
{
Standard_Integer aSumPer = Abs(aLPer - aFPer);
Standard_Real aFirst = 0;
if (aLower < 0 && anUpper == 0)
{
if (Abs(aCurLast) < Eps)
{
aCurLast = 0;
}
aFirst = aLower;
}
if (aSumPer <= 1)
{
if ((Abs(myFirst - TK(Nb) - aPeriod * (aFPer - 1)) <= Eps) && (myLast < (TK(Nb) + aPeriod * (aLPer - 1))))
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
return myNbIntervals;
}
if ((Abs(myFirst - aLower) < Eps) && (Abs(myLast - anUpper) < Eps))
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
return myNbIntervals;
}
}
if (aSumPer != 0)
{
Standard_Integer aFInt = 0;
Standard_Integer aLInt = 0;
Standard_Integer aPInt = NbInt;
if ((aCurFirst != aPeriod) || ((aCurFirst != anUpper) && (Abs(myFirst) < Eps)))
{
aFInt = 1;
}
if ((aCurLast != aLower) && (aCurLast != anUpper))
{
aLInt = 1;
}
aFInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aCurFirst, anUpper, Eps, Standard_True, aFInt, aLower, aPeriod);
if (aCurLast == anUpper)
{
aLInt = NbInt;
}
else
{
if (Abs(aCurLast - aFirst) > Eps)
{
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod, 1);
}
else
{
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod);
}
}
myNbIntervals = aFInt + aLInt + aPInt * (aSumPer - 1);
}
else
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aCurFirst, aCurLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
}
}
}
}
break;
}
if (myTypeCurve == GeomAbs_BSplineCurve)
{
if ((!myBSplineCurve->IsPeriodic() && S <= Continuity()) || S == GeomAbs_C0)
{
return 1;
}
Standard_Integer aDegree = myBSplineCurve->Degree();
Standard_Integer aCont;
switch (S)
{
case GeomAbs_C1:
aCont = 1;
break;
case GeomAbs_C2:
aCont = 2;
break;
case GeomAbs_C3:
aCont = 3;
break;
case GeomAbs_CN:
aCont = aDegree;
break;
default:
throw Standard_DomainError ("GeomAdaptor_Curve::NbIntervals()");
}
Standard_Real anEps = Min(Resolution(Precision::Confusion()), Precision::PConfusion());
return BSplCLib::Intervals(myBSplineCurve->Knots(),
myBSplineCurve->Multiplicities(),
aDegree,
myBSplineCurve->IsPeriodic(),
aCont,
myFirst,
myLast,
anEps,
nullptr);
}
else if (myTypeCurve == GeomAbs_OffsetCurve) {
Standard_Integer myNbIntervals = 1;
GeomAbs_Shape BaseS=GeomAbs_C0;
switch(S){
case GeomAbs_G1:
case GeomAbs_G2:
throw Standard_DomainError("GeomAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0: BaseS = GeomAbs_C1; break;
case GeomAbs_C1: BaseS = GeomAbs_C2; break;
case GeomAbs_C2: BaseS = GeomAbs_C3; break;
default: BaseS = GeomAbs_CN;
case GeomAbs_G1:
case GeomAbs_G2:
throw Standard_DomainError("GeomAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0: BaseS = GeomAbs_C1; break;
case GeomAbs_C1: BaseS = GeomAbs_C2; break;
case GeomAbs_C2: BaseS = GeomAbs_C3; break;
default: BaseS = GeomAbs_CN;
}
GeomAdaptor_Curve C
(Handle(Geom_OffsetCurve)::DownCast (myCurve)->BasisCurve());
GeomAdaptor_Curve C (Handle(Geom_OffsetCurve)::DownCast (myCurve)->BasisCurve(), myFirst, myLast);
// akm 05/04/02 (OCC278) If our curve is trimmed we must recalculate
// the number of intervals obtained from the basis to
// vvv reflect parameter bounds
@@ -680,211 +322,16 @@ Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
TColStd_Array1OfReal rdfInter(1,1+iNbBasisInt);
C.Intervals(rdfInter,BaseS);
for (iInt=1; iInt<=iNbBasisInt; iInt++)
if (rdfInter(iInt)>myFirst && rdfInter(iInt)<myLast)
myNbIntervals++;
if (rdfInter(iInt)>myFirst && rdfInter(iInt)<myLast)
myNbIntervals++;
}
// akm 05/04/02 ^^^
return myNbIntervals;
}
return myNbIntervals;
}
//=======================================================================
//function : WriteIntervals
//purpose :
//=======================================================================
static void WriteIntervals(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theNbInt,
const Standard_Integer theIndex1,
const Standard_Integer theIndex2,
const Standard_Real theCurPeriod,
const Standard_Boolean theFlagForFirst,
TColStd_Array1OfReal &theT,
TColStd_Array1OfInteger &theFinalIntervals,
Standard_Integer &theNbIntervals,
Standard_Integer &theCurInt)
{
if (theFlagForFirst)
{
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
{
if (theInter(anId) > theIndex1 && theInter(anId) <= theIndex2)
{
theNbIntervals++;
theFinalIntervals(theNbIntervals) = theInter(anId);
}
}
}
else
{
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
{
if (theInter(anId) > theIndex1 && theInter(anId) < theIndex2)
{
theNbIntervals++;
theFinalIntervals(theNbIntervals) = theInter(anId);
}
}
}
theFinalIntervals(theNbIntervals + 1) = theIndex2;
for (Standard_Integer anId = theCurInt; anId <= theNbIntervals + 1; anId++)
{
theT(anId) = theTK(theFinalIntervals(anId)) + theCurPeriod;
theCurInt++;
}
}
//=======================================================================
//function : SpreadInt
//purpose :
//=======================================================================
void SpreadInt(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theTM,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theFPer,
const Standard_Integer theLPer,
const Standard_Integer theNbInt,
const Standard_Real theLower,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real thePeriod,
const Standard_Real theLastParam,
const Standard_Real theEps,
TColStd_Array1OfReal &theT,
Standard_Integer &theNbIntervals)
{
Standard_Integer anIndex1 = 0;
Standard_Integer anIndex2 = 0;
Standard_Real aNewFirst, aNewLast;
Standard_Integer anUpper;
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
Standard_True, 1, theNb, anIndex1, aNewFirst);
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLastParam,
Standard_True, 1, theNb, anIndex2, aNewLast);
if (Abs(aNewFirst - theTK(anIndex1 + 1)) < theEps)
{
anIndex1++;
}
if ((aNewLast - theTK(anIndex2)) > theEps)
{
anIndex2++;
}
theNbIntervals = 1;
if (anIndex1 == theNb)
{
anIndex1 = 1;
}
// Count the max number of boundaries of intervals
if (Abs(theLPer - theFPer) > 1)
{
anUpper = theNb - anIndex1 + anIndex2 + (theLPer - theFPer - 1) * theNb + 1;
}
else
{
anUpper = theNb - anIndex1 + anIndex2 + 1;
}
if (theLPer == theFPer)
{
anUpper = theInter.Upper();
}
TColStd_Array1OfInteger aFinalIntervals(1, anUpper);
aFinalIntervals(1) = anIndex1;
// If first and last are in the same period
if ((Abs(theLPer - theFPer) == 0))
{
Standard_Integer aCurInt = 1;
Standard_Real aCurPeriod = theFPer * thePeriod;
if (theFirst == aNewFirst && theLast == aNewLast)
{
aCurPeriod = 0;
}
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
anIndex2, aCurPeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
// If the first and the last are in neighboring periods
if (Abs(theLPer - theFPer) == 1)
{
Standard_Integer aCurInt = 1;
if (Abs(theLastParam - theLower) < theEps)
{
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
else
{
// For period with first
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
// For period with last
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
}
// If the first and the last are far apart
if (Abs(theLPer - theFPer) > 1)
{
Standard_Integer aCurInt = 1;
if (Abs(theLastParam - theLower) < theEps)
{
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
Standard_Integer aNbPer = Abs(theLPer - theFPer);
Standard_Integer aCurPer = theFPer + 1;
while (aNbPer > 1)
{
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
aNbPer--;
aCurPer++;
}
return;
}
else
{
// For period with first
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
Standard_Integer aNbPer = Abs(theLPer - theFPer);
Standard_Integer aCurPer = theFPer + 1;
while (aNbPer > 1)
{
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
aNbPer--;
aCurPer++;
}
// For period with last
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
return 1;
}
}
@@ -893,175 +340,53 @@ void SpreadInt(const TColStd_Array1OfReal &theTK,
//purpose :
//=======================================================================
void GeomAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
const GeomAbs_Shape S ) const
void GeomAdaptor_Curve::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
{
Standard_Integer myNbIntervals = 1;
Standard_Integer NbSplit;
Standard_Real FirstParam = myFirst, LastParam = myLast;
if (myTypeCurve == GeomAbs_BSplineCurve)
{
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
TColStd_Array1OfInteger Inter(1, LastIndex - FirstIndex + 1);
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
if (aContPer || aContNotPer) {
Standard_Integer Cont;
switch (S) {
case GeomAbs_G1:
case GeomAbs_G2:
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0:
myNbIntervals = 1;
break;
case GeomAbs_C1:
case GeomAbs_C2:
case GeomAbs_C3:
case GeomAbs_CN:
{
if (S == GeomAbs_C1) Cont = 1;
else if (S == GeomAbs_C2) Cont = 2;
else if (S == GeomAbs_C3) Cont = 3;
else Cont = myBSplineCurve->Degree();
Standard_Integer Degree = myBSplineCurve->Degree();
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
TColStd_Array1OfInteger Mults(1, NbKnots);
myBSplineCurve->Multiplicities(Mults);
NbSplit = 1;
Standard_Integer Index = FirstIndex;
Inter(NbSplit) = Index;
Index++;
NbSplit++;
while (Index < LastIndex)
{
if (Degree - Mults(Index) < Cont)
{
Inter(NbSplit) = Index;
NbSplit++;
}
Index++;
}
Inter(NbSplit) = Index;
Standard_Integer NbInt = NbSplit - 1;
// GeomConvert_BSplineCurveKnotSplitting Convector(myBspl, Cont);
// Standard_Integer NbInt = Convector.NbSplits()-1;
// TColStd_Array1OfInteger Inter(1,NbInt+1);
// Convector.Splitting( Inter);
Standard_Integer Nb = myBSplineCurve->NbKnots();
Standard_Integer Index1 = 0;
Standard_Integer Index2 = 0;
Standard_Real newFirst, newLast;
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
Precision::PConfusion());
if (!myBSplineCurve->IsPeriodic() || ((Abs(myFirst - myBSplineCurve->FirstParameter()) < Eps) &&
(Abs(myLast - myBSplineCurve->LastParameter()) < Eps)))
{
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myFirst,
myBSplineCurve->IsPeriodic(),
1, Nb, Index1, newFirst);
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myLast,
myBSplineCurve->IsPeriodic(),
1, Nb, Index2, newLast);
FirstParam = newFirst;
LastParam = newLast;
// Protection against myFirst = UFirst - eps, which located as ULast - eps
if (myBSplineCurve->IsPeriodic() && (LastParam - FirstParam) < Precision::PConfusion())
{
if (Abs(LastParam - myBSplineCurve->FirstParameter()) < Precision::PConfusion())
LastParam += myBSplineCurve->Period();
else
FirstParam -= myBSplineCurve->Period();
}
// On decale eventuellement les indices
// On utilise une "petite" tolerance, la resolution ne doit
// servir que pour les tres longue courbes....(PRO9248)
if (Abs(FirstParam - TK(Index1 + 1)) < Eps) Index1++;
if (LastParam - TK(Index2) > Eps) Index2++;
myNbIntervals = 1;
TColStd_Array1OfInteger aFinalIntervals(1, Inter.Upper());
aFinalIntervals(1) = Index1;
for (Standard_Integer i = 1; i <= NbInt; i++) {
if (Inter(i) > Index1 && Inter(i) < Index2) {
myNbIntervals++;
aFinalIntervals(myNbIntervals) = Inter(i);
}
}
aFinalIntervals(myNbIntervals + 1) = Index2;
for (Standard_Integer I = 1; I <= myNbIntervals + 1; I++) {
T(I) = TK(aFinalIntervals(I));
}
}
else
{
Standard_Real aFirst = myFirst;
Standard_Real aLast = myLast;
Standard_Real aCurFirst = aFirst;
Standard_Real aCurLast = aLast;
Standard_Real aPeriod = myBSplineCurve->Period();
Standard_Real aLower = myBSplineCurve->FirstParameter();
Standard_Real anUpper = myBSplineCurve->LastParameter();
Standard_Integer aLPer = 0; Standard_Integer aFPer = 0;
if (Abs(myFirst - aLower) <= Eps)
{
aCurFirst = aLower;
aFirst = aCurFirst;
}
if (Abs(myLast - anUpper) <= Eps)
{
aCurLast = anUpper;
aLast = aCurLast;
}
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
{
aCurFirst = aLower;
}
else
{
DefinFPeriod(aLower, anUpper,
Eps, aPeriod, aCurFirst, aFPer);
}
DefinLPeriod(aLower, anUpper,
Eps, aPeriod, aCurLast, aLPer);
if (myFirst == aLower)
{
aFPer = 0;
}
SpreadInt(TK, TM, Inter, myBSplineCurve->Degree(), Nb, aFPer, aLPer, NbInt, aLower, myFirst, myLast, aPeriod,
aCurLast, Eps, T, myNbIntervals);
T(T.Lower()) = aFirst;
T(T.Lower() + myNbIntervals) = aLast;
return;
}
}
T(T.Lower()) = myFirst;
T(T.Lower() + myNbIntervals) = myLast;
if ((!myBSplineCurve->IsPeriodic() && S <= Continuity()) || S == GeomAbs_C0)
{
T( T.Lower() ) = myFirst;
T( T.Lower() + 1 ) = myLast;
return;
}
}
Standard_Integer aDegree = myBSplineCurve->Degree();
Standard_Integer aCont;
switch (S)
{
case GeomAbs_C1:
aCont = 1;
break;
case GeomAbs_C2:
aCont = 2;
break;
case GeomAbs_C3:
aCont = 3;
break;
case GeomAbs_CN:
aCont = aDegree;
break;
default:
throw Standard_DomainError ("GeomAdaptor_Curve::Intervals()");
}
Standard_Real anEps = Min(Resolution(Precision::Confusion()), Precision::PConfusion());
BSplCLib::Intervals(myBSplineCurve->Knots(),
myBSplineCurve->Multiplicities(),
aDegree,
myBSplineCurve->IsPeriodic(),
aCont,
myFirst,
myLast,
anEps,
&T);
}
else if (myTypeCurve == GeomAbs_OffsetCurve){
Standard_Integer myNbIntervals = 1;
GeomAbs_Shape BaseS=GeomAbs_C0;
switch(S){
case GeomAbs_G1:
@@ -1073,8 +398,7 @@ void GeomAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
case GeomAbs_C2: BaseS = GeomAbs_C3; break;
default: BaseS = GeomAbs_CN;
}
GeomAdaptor_Curve C
(Handle(Geom_OffsetCurve)::DownCast (myCurve)->BasisCurve());
GeomAdaptor_Curve C (Handle(Geom_OffsetCurve)::DownCast (myCurve)->BasisCurve(), myFirst, myLast);
// akm 05/04/02 (OCC278) If our curve is trimmed we must recalculate
// the array of intervals obtained from the basis to
// vvv reflect parameter bounds
@@ -1090,10 +414,15 @@ void GeomAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
// old - myNbIntervals = C.NbIntervals(BaseS);
// old - C.Intervals(T, BaseS);
// akm 05/04/02 ^^^
T( T.Lower() ) = myFirst;
T( T.Lower() + myNbIntervals ) = myLast;
}
T( T.Lower() ) = FirstParam;
T( T.Lower() + myNbIntervals ) = LastParam;
else
{
T( T.Lower() ) = myFirst;
T( T.Lower() + 1 ) = myLast;
}
}
//=======================================================================

View File

@@ -429,8 +429,6 @@ 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);
@@ -441,16 +439,12 @@ static Standard_Boolean ConicDefinition
}
}
else if (term1 <= eps){
if (-term1 <= eps || term2 <= eps)
return Standard_False;
Xax = -sint;
Yax = cost;
Rmin = sqrt (-term1);
Rmax = sqrt (term2);
}
else {
if (term1 <= eps || -term2 <= eps)
return Standard_False;
Xax = cost;
Yax = sint;
Rmin = sqrt (-term2);

View File

@@ -276,6 +276,8 @@ GeomFill_SectionPlacement(const Handle(GeomFill_LocationLaw)& L,
Standard_Integer NbLocalPnts = 10;
Standard_Integer NbPnts = (NbKnots-1) * NbLocalPnts;
if (NbPnts < 0)
NbPnts = 0;
if (I1 != I2)
NbPnts += NbLocalPnts;
if (I3 != I4 && first < BC->Knot(I3))

View File

@@ -30,18 +30,6 @@
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_HArray1OfPnt.hxx>
static Standard_Boolean Controle(const TColgp_Array1OfPnt& P,
const gp_Pln& Plan,
const Standard_Real Tol)
{
Standard_Integer ii;
Standard_Boolean B=Standard_True;
for (ii=1; ii<=P.Length() && B; ii++)
B = (Plan.Distance(P(ii)) < Tol);
return B;
}
static Standard_Boolean Controle(const TColgp_Array1OfPnt& Poles,
const Standard_Real Tol,
@@ -49,51 +37,36 @@ static Standard_Boolean Controle(const TColgp_Array1OfPnt& Poles,
gp_Pln& Plan)
{
Standard_Boolean IsPlan = Standard_False;
Standard_Boolean Essai = Standard_True;
Standard_Real gx,gy,gz;
Standard_Integer Nb = Poles.Length();
gp_Pnt Bary;
gp_Pnt Bary;
gp_Dir DX, DY;
Standard_Real aTolSingular = Precision::Confusion();
if (Nb > 10) {
// Test allege (pour une rejection rapide)
TColgp_Array1OfPnt Aux(1,5);
Aux(1) = Poles(1);
Aux(2) = Poles(Nb/3);
Aux(3) = Poles(Nb/2);
Aux(4) = Poles(Nb/2+Nb/3);
Aux(5) = Poles(Nb);
GeomLib::Inertia(Aux, Bary, DX, DY, gx, gy, gz);
Essai = (gz<Tol);
}
if (Essai) { // Test Grandeur nature...
GeomLib::Inertia(Poles, Bary, DX, DY, gx, gy, gz);
if (gz<Tol && gy>Tol) {
gp_Pnt P;
gp_Vec DU, DV;
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;
GeomLib::Inertia(Poles, Bary, DX, DY, gx, gy, gz);
if (gz < Tol && gy > aTolSingular) {
gp_Pnt P;
gp_Vec DU, DV;
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;
}
return IsPlan;
}
@@ -106,8 +79,6 @@ static Standard_Boolean Controle(const Handle(Geom_Curve)& C,
GeomAbs_CurveType Type;
GeomAdaptor_Curve AC(C);
Type = AC.GetType();
Handle(TColgp_HArray1OfPnt) TabP;
TabP.Nullify();
switch (Type) {
case GeomAbs_Line :
@@ -131,40 +102,27 @@ static Standard_Boolean Controle(const Handle(Geom_Curve)& C,
case GeomAbs_BezierCurve:
{
Nb = AC.NbPoles();
Handle (Geom_BezierCurve) BZ = AC.Bezier();
TabP = new (TColgp_HArray1OfPnt) (1, AC.NbPoles());
for (ii=1; ii<=Nb; ii++)
TabP->SetValue(ii, BZ->Pole(ii));
break;
}
case GeomAbs_BSplineCurve:
{
Nb = AC.NbPoles();
Handle (Geom_BSplineCurve) BZ = AC.BSpline();
TabP = new (TColgp_HArray1OfPnt) (1, AC.NbPoles());
for (ii=1; ii<=Nb; ii++)
TabP->SetValue(ii, BZ->Pole(ii));
break;
}
default :
{
Nb = 8 + 3*AC.NbIntervals(GeomAbs_CN);
}
}
if (TabP.IsNull()) {
Standard_Real u, du, f, l, d;
f = AC.FirstParameter();
l = AC.LastParameter();
du = (l-f)/(Nb-1);
for (ii=1; ii<=Nb && B ; ii++) {
u = (ii-1)*du + f;
d = Plan.Distance(C->Value(u));
B = (d < Tol);
default :
{
Nb = 8 + 3*AC.NbIntervals(GeomAbs_CN);
}
}
else {
B = Controle(TabP->Array1(), Plan, Tol);
Standard_Real u, du, f, l, d;
f = AC.FirstParameter();
l = AC.LastParameter();
du = (l - f) / (Nb - 1);
for (ii = 1; ii <= Nb && B; ii++) {
u = (ii - 1)*du + f;
d = Plan.Distance(C->Value(u));
B = d < Tol;
}
return B;
@@ -196,30 +154,6 @@ GeomLib_IsPlanarSurface::GeomLib_IsPlanarSurface(const Handle(Geom_Surface)& S,
IsPlan = Standard_False;
break;
}
case GeomAbs_BezierSurface :
case GeomAbs_BSplineSurface :
{
Standard_Integer ii, jj, kk,
NbU = AS.NbUPoles(), NbV = AS.NbVPoles();
TColgp_Array1OfPnt Poles(1, NbU*NbV);
if (Type == GeomAbs_BezierSurface) {
Handle(Geom_BezierSurface) BZ;
BZ = AS.Bezier();
for(ii=1, kk=1; ii<=NbU; ii++)
for(jj=1; jj<=NbV; jj++,kk++)
Poles(kk) = BZ->Pole(ii,jj);
}
else {
Handle(Geom_BSplineSurface) BS;
BS = AS.BSpline();
for(ii=1, kk=1; ii<=NbU; ii++)
for(jj=1; jj<=NbV; jj++,kk++)
Poles(kk) = BS->Pole(ii,jj);
}
IsPlan = Controle(Poles, Tol, S, myPlan);
break;
}
case GeomAbs_SurfaceOfRevolution :
{
@@ -299,7 +233,7 @@ GeomLib_IsPlanarSurface::GeomLib_IsPlanarSurface(const Handle(Geom_Surface)& S,
break;
}
default :
default :
{
Standard_Integer NbU,NbV, ii, jj, kk;
NbU = 8 + 3*AS.NbUIntervals(GeomAbs_CN);

View File

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

View File

@@ -4359,6 +4359,120 @@ static Standard_Integer QACheckBends(Draw_Interpretor& theDI,
return 0;
}
static Standard_Integer OCC26441(Draw_Interpretor& theDi, Standard_Integer theNbArgs, const char** theArgVec)
{
if (theNbArgs < 3)
{
theDi << "Syntax error: wrong number of arguments!\n";
return 1;
}
const TopoDS_Shape& aShape = DBRep::Get(theArgVec[1]);
if (aShape.IsNull())
{
theDi << " Null Shape is not allowed here\n";
return 1;
}
const TopoDS_Shape& aRefShape = DBRep::Get(theArgVec[2]);
if (aRefShape.IsNull())
{
theDi << " Null Shape is not allowed here\n";
return 1;
}
if(aShape.ShapeType() != aRefShape.ShapeType())
{
theDi << " Shape types are not the same\n";
return 1;
}
Standard_Real anEps = Precision::Confusion();
if (theNbArgs > 3)
{
anEps = Draw::Atof(theArgVec[3]);
}
Standard_Boolean isAllDiff = Standard_False;
if (theNbArgs > 4)
{
Standard_Integer Inc = Draw::Atoi(theArgVec[4]);
if (Inc > 0)
isAllDiff = Standard_True;
}
BRep_Builder aBB;
TopExp_Explorer anExp, anExpRef;
Standard_Real aMaxE = 0., aMaxV = 0.;
TopTools_MapOfShape aChecked;
TopoDS_Vertex aV[2], aRefV[2];
//Checking edge and vertex tolerances
TopoDS_Compound aBadEdges;
aBB.MakeCompound(aBadEdges);
TopoDS_Compound aBadVerts;
aBB.MakeCompound(aBadVerts);
anExp.Init(aShape, TopAbs_EDGE);
anExpRef.Init(aRefShape, TopAbs_EDGE);
for (; anExpRef.More(); anExpRef.Next())
{
const TopoDS_Edge& aRefE = TopoDS::Edge(anExpRef.Current());
if (!anExp.More())
{
theDi << " Different number of edges\n";
return 1;
}
const TopoDS_Edge& anE = TopoDS::Edge(anExp.Current());
if (!aChecked.Add(anE))
continue;
Standard_Real aTolRef = BRep_Tool::Tolerance(aRefE);
Standard_Real aTol = BRep_Tool::Tolerance(anE);
Standard_Real aDiff = aTol - aTolRef;
if (isAllDiff && aDiff < 0)
aDiff = -aDiff;
if (aDiff > anEps)
{
if (aDiff > aMaxE)
aMaxE = aDiff;
aBB.Add(aBadEdges, anE);
}
TopExp::Vertices(aRefE, aRefV[0], aRefV[1]);
TopExp::Vertices(anE, aV[0], aV[1]);
for (int i = 0; i < 2; ++i)
{
if (aRefV[i].IsNull())
continue;
if (!aChecked.Add(aV[i]))
continue;
aTolRef = BRep_Tool::Tolerance(aRefV[i]);
aTol = BRep_Tool::Tolerance(aV[i]);
aDiff = aTol - aTolRef;
if (aDiff > anEps)
{
if (aDiff > aMaxV)
aMaxV = aDiff;
aBB.Add(aBadVerts, aV[i]);
}
}
anExp.Next();
}
if (aMaxE > anEps)
{
theDi << " Maximal difference for edges : " << aMaxE << "\n";
DBRep::Set("BadEdges", aBadEdges);
}
if (aMaxV > anEps)
{
theDi << " Maximal difference for vertices : " << aMaxV << "\n";
DBRep::Set("BadVerts", aBadVerts);
}
return 0;
}
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
@@ -4466,6 +4580,10 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
"QACheckBends curve [CosMaxAngle [theNbPoints]]",
__FILE__,
QACheckBends, group);
theCommands.Add("OCC26441",
"OCC26441 shape ref_shape [tol [all_diff 0/1]] \nif all_diff = 0, only icreasing tolerances is considered" ,
__FILE__,
OCC26441, group);
return;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -221,6 +221,10 @@
#include <StepVisual_TessellatedCurveSet.hxx>
#include <StepVisual_CoordinatesList.hxx>
#include <NCollection_Vector.hxx>
#include <StepVisual_OverRidingStyledItem.hxx>
#include <StepVisual_ContextDependentOverRidingStyledItem.hxx>
#include <StepRepr_ShapeRepresentationRelationshipWithTransformation.hxx>
#include <StepRepr_ItemDefinedTransformation.hxx>
#include <TColgp_HArray1OfXYZ.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
@@ -937,6 +941,306 @@ static void propagateColorToParts(const Handle(XCAFDoc_ShapeTool)& theSTool,
propagateColorToParts(theSTool, theCTool, anOriginalL);
}
}
//=======================================================================
//function : SetAssemblyComponentStyle
//purpose : auxiliary: set override style for assembly components
//=======================================================================
static void SetAssemblyComponentStyle(const Handle(Transfer_TransientProcess) &theTP,
const Handle(XCAFDoc_ColorTool)& theCTool,
const STEPConstruct_Styles& theStyles,
const Handle(StepVisual_ContextDependentOverRidingStyledItem)& theStyle)
{
if (theStyle.IsNull()) return;
Handle(StepVisual_Colour) aSurfCol, aBoundCol, aCurveCol, aRenderCol;
Standard_Real aRenderTransp;
// check if it is component style
Standard_Boolean anIsComponent = Standard_False;
if (!theStyles.GetColors(theStyle, aSurfCol, aBoundCol, aCurveCol, aRenderCol, aRenderTransp, anIsComponent))
return;
const Interface_Graph& aGraph = theTP->Graph();
TopLoc_Location aLoc; // init;
// find shape
TopoDS_Shape aShape;
Handle(Transfer_Binder) aBinder;
Handle(StepShape_ShapeRepresentation) aRepr = Handle(StepShape_ShapeRepresentation)::DownCast(theStyle->ItemAP242 ().Value ());
if (aRepr.IsNull())
return;
Handle(StepRepr_ShapeRepresentationRelationship) aSRR;
Interface_EntityIterator aSubs = theTP->Graph().Sharings(aRepr);
for (aSubs.Start(); aSubs.More(); aSubs.Next()) {
const Handle(Standard_Transient)& aSubsVal = aSubs.Value();
if (aSubsVal->IsKind (STANDARD_TYPE(StepRepr_ShapeRepresentationRelationship)))
{
// NB: C cast is used instead of DownCast() to improve performance on some cases.
// This saves ~10% of elapsed time on "testgrid perf de bug29* -parallel 0".
aSRR = (StepRepr_ShapeRepresentationRelationship*)(aSubsVal.get());
}
}
aBinder = theTP->Find(aSRR);
if (!aBinder.IsNull() ) {
aShape = TransferBRep::ShapeResult (aBinder);
}
if (aShape.IsNull())
return;
//get transformation
aSubs = aGraph.Shareds (theStyle);
aSubs.Start();
for(; aSubs.More(); aSubs.Next())
{
Handle(StepRepr_ShapeRepresentationRelationshipWithTransformation) aRelation = Handle(StepRepr_ShapeRepresentationRelationshipWithTransformation)::DownCast (aSubs.Value ());
if(aRelation.IsNull()) continue;
auto aTransf = aRelation->TransformationOperator ();
if(auto anItemTransf = aTransf.ItemDefinedTransformation ())
{
Handle(StepGeom_Axis2Placement3d) anAxp1 = Handle(StepGeom_Axis2Placement3d)::DownCast(anItemTransf->TransformItem1 ());
Handle(StepGeom_Axis2Placement3d) anAxp2 = Handle(StepGeom_Axis2Placement3d)::DownCast(anItemTransf->TransformItem2 ());
if(!anAxp1.IsNull() && !anAxp2.IsNull())
{
Handle(Geom_Axis2Placement) anOrig = StepToGeom::MakeAxis2Placement (anAxp1);
Handle(Geom_Axis2Placement) aTarg = StepToGeom::MakeAxis2Placement (anAxp2);
gp_Ax3 anAx3Orig(anOrig->Ax2());
gp_Ax3 anAx3Targ(aTarg->Ax2());
gp_Trsf aTr1;
aTr1.SetTransformation(anAx3Targ, anAx3Orig);
TopLoc_Location aLoc1 (aTr1);
aLoc = aLoc.Multiplied(aLoc1);
}
}
}
aShape.Location( aLoc, Standard_False );
if(!aSurfCol.IsNull() || !aBoundCol.IsNull() || !aCurveCol.IsNull() || !aRenderCol.IsNull())
{
Quantity_Color aSCol,aBCol,aCCol,aRCol;
Quantity_ColorRGBA aFullSCol;
if(!aSurfCol.IsNull()) {
theStyles.DecodeColor(aSurfCol,aSCol);
aFullSCol = Quantity_ColorRGBA(aSCol);
}
if(!aBoundCol.IsNull())
theStyles.DecodeColor(aBoundCol,aBCol);
if(!aCurveCol.IsNull())
theStyles.DecodeColor(aCurveCol,aCCol);
if(!aRenderCol.IsNull()) {
theStyles.DecodeColor(aRenderCol,aRCol);
aFullSCol = Quantity_ColorRGBA(aRCol,static_cast<float>(1.0f - aRenderTransp));
}
if(!aSurfCol.IsNull() || !aRenderCol.IsNull())
theCTool->SetInstanceColor(aShape,XCAFDoc_ColorSurf,aFullSCol);
if(!aBoundCol.IsNull())
theCTool->SetInstanceColor(aShape,XCAFDoc_ColorCurv,aBCol);
if(!aCurveCol.IsNull())
theCTool->SetInstanceColor(aShape,XCAFDoc_ColorCurv,aCCol);
}
}
//=======================================================================
//function : SetStyle
//purpose : auxiliary: set style for parts and instances
//=======================================================================
static void SetStyle(const Handle(XSControl_WorkSession) &theWS,
const XCAFDoc_DataMapOfShapeLabel& theMap,
const Handle(XCAFDoc_ColorTool)& theCTool,
const Handle(XCAFDoc_ShapeTool)& theSTool,
const STEPConstruct_Styles& theStyles,
const Handle(TColStd_HSequenceOfTransient)& theHSeqOfInvisStyle,
const Handle(StepVisual_StyledItem)& theStyle)
{
if (theStyle.IsNull()) return;
const Handle(Transfer_TransientProcess) &aTP = theWS->TransferReader()->TransientProcess();
if (Handle(StepVisual_OverRidingStyledItem) anOverridingStyle = Handle(StepVisual_OverRidingStyledItem)::DownCast (theStyle))
{
SetStyle (theWS, theMap, theCTool, theSTool, theStyles, theHSeqOfInvisStyle, anOverridingStyle->OverRiddenStyle ());
if (Handle(StepVisual_ContextDependentOverRidingStyledItem) anAssemblyComponentStyle = Handle(StepVisual_ContextDependentOverRidingStyledItem)::DownCast (theStyle))
{
SetAssemblyComponentStyle (aTP, theCTool, theStyles,anAssemblyComponentStyle);
return;
}
}
Standard_Boolean anIsVisible = Standard_True;
// check the visibility of styled item.
for (Standard_Integer si = 1; si <= theHSeqOfInvisStyle->Length(); si++) {
if (theStyle != theHSeqOfInvisStyle->Value(si))
continue;
// found that current style is invisible.
anIsVisible = Standard_False;
break;
}
Handle(StepVisual_Colour) aSurfCol, aBoundCol, aCurveCol, aRenderCol;
Standard_Real aRenderTransp;
// check if it is component style
Standard_Boolean anIsComponent = Standard_False;
if (!theStyles.GetColors(theStyle, aSurfCol, aBoundCol, aCurveCol, aRenderCol, aRenderTransp, anIsComponent) && anIsVisible)
return;
// collect styled items
NCollection_Vector<StepVisual_StyledItemTarget> anItems;
if (!theStyle->ItemAP242().IsNull()) {
anItems.Append(theStyle->ItemAP242());
}
for (Standard_Integer itemIt = 0; itemIt < anItems.Length(); itemIt++) {
Standard_Integer anIndex = aTP->MapIndex(anItems.Value(itemIt).Value());
TopoDS_Shape aS;
if (anIndex > 0) {
Handle(Transfer_Binder) aBinder = aTP->MapItem(anIndex);
aS = TransferBRep::ShapeResult(aBinder);
}
Standard_Boolean isSkipSHUOstyle = Standard_False;
// take shape with real location.
while (anIsComponent) {
// take SR of NAUO
Handle(StepShape_ShapeRepresentation) aSR;
findStyledSR(theStyle, aSR);
// search for SR along model
if (aSR.IsNull())
break;
Interface_EntityIterator aSubs = theWS->HGraph()->Graph().Sharings(aSR);
Handle(StepShape_ShapeDefinitionRepresentation) aSDR;
for (aSubs.Start(); aSubs.More(); aSubs.Next()) {
aSDR = Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(aSubs.Value());
if (aSDR.IsNull())
continue;
StepRepr_RepresentedDefinition aPDSselect = aSDR->Definition();
Handle(StepRepr_ProductDefinitionShape) PDS =
Handle(StepRepr_ProductDefinitionShape)::DownCast(aPDSselect.PropertyDefinition());
if (PDS.IsNull())
continue;
StepRepr_CharacterizedDefinition aCharDef = PDS->Definition();
Handle(StepRepr_AssemblyComponentUsage) ACU =
Handle(StepRepr_AssemblyComponentUsage)::DownCast(aCharDef.ProductDefinitionRelationship());
if (ACU.IsNull())
continue;
// PTV 10.02.2003 skip styled item that refer to SHUO
if (ACU->IsKind(STANDARD_TYPE(StepRepr_SpecifiedHigherUsageOccurrence))) {
isSkipSHUOstyle = Standard_True;
break;
}
Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO =
Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(ACU);
if (NAUO.IsNull())
continue;
TopoDS_Shape aSh;
// PTV 10.02.2003 to find component of assembly CORRECTLY
STEPConstruct_Tool aTool(theWS);
TDF_Label aShLab = STEPCAFControl_Reader::FindInstance(NAUO, theCTool->ShapeTool(), aTool, theMap);
aSh = theCTool->ShapeTool()->GetShape(aShLab);
if (!aSh.IsNull()) {
aS = aSh;
break;
}
}
break;
}
if (isSkipSHUOstyle)
continue; // skip styled item which refer to SHUO
if (aS.IsNull())
continue;
if (!aSurfCol.IsNull() || !aBoundCol.IsNull() || !aCurveCol.IsNull() || !aRenderCol.IsNull() || !anIsVisible)
{
TDF_Label aL;
Standard_Boolean isFound = theSTool->SearchUsingMap(aS, aL, Standard_False, Standard_True);
if (!aSurfCol.IsNull() || !aBoundCol.IsNull() || !aCurveCol.IsNull() || !aRenderCol.IsNull())
{
Quantity_Color aSCol, aBCol, aCCol, aRCol;
Quantity_ColorRGBA aFullSCol;
if (!aSurfCol.IsNull()) {
theStyles.DecodeColor(aSurfCol, aSCol);
aFullSCol = Quantity_ColorRGBA(aSCol);
}
if (!aBoundCol.IsNull())
theStyles.DecodeColor(aBoundCol, aBCol);
if (!aCurveCol.IsNull())
theStyles.DecodeColor(aCurveCol, aCCol);
if (!aRenderCol.IsNull()) {
theStyles.DecodeColor(aRenderCol, aRCol);
aFullSCol = Quantity_ColorRGBA(aRCol, static_cast<float>(1.0f - aRenderTransp));
}
if (isFound)
{
if (!aSurfCol.IsNull() || !aRenderCol.IsNull())
theCTool->SetColor(aL, aFullSCol, XCAFDoc_ColorSurf);
if (!aBoundCol.IsNull())
theCTool->SetColor(aL, aBCol, XCAFDoc_ColorCurv);
if (!aCurveCol.IsNull())
theCTool->SetColor(aL, aCCol, XCAFDoc_ColorCurv);
}
else
{
for (TopoDS_Iterator it(aS); it.More(); it.Next())
{
TDF_Label aL1;
if (theSTool->SearchUsingMap(it.Value(), aL1, Standard_False, Standard_True))
{
if (!aSurfCol.IsNull() || !aRenderCol.IsNull())
theCTool->SetColor(aL1, aFullSCol, XCAFDoc_ColorSurf);
if (!aBoundCol.IsNull())
theCTool->SetColor(aL1, aBCol, XCAFDoc_ColorCurv);
if (!aCurveCol.IsNull())
theCTool->SetColor(aL1, aCCol, XCAFDoc_ColorCurv);
}
}
}
}
if (!anIsVisible)
{
// sets the invisibility for shape.
if (isFound)
theCTool->SetVisibility(aL, Standard_False);
}
}
}
}
//=======================================================================
//function : IsOverriden
//purpose : auxiliary: check that style is overridden
//=======================================================================
static Standard_Boolean IsOverriden(const Interface_Graph& theGraph,
const Handle(StepVisual_StyledItem)& theStyle,
Standard_Boolean theIsRoot)
{
Interface_EntityIterator aSubs = theGraph.Sharings (theStyle);
aSubs.Start();
for(; aSubs.More(); aSubs.Next())
{
Handle(StepVisual_OverRidingStyledItem) anOverRidingStyle = Handle(StepVisual_OverRidingStyledItem)::DownCast (aSubs.Value ());
if(!anOverRidingStyle.IsNull())
{
if(!theIsRoot)
{
return Standard_True;
}
// for root style returns true only if it is overridden by other root style
auto anItem = anOverRidingStyle->ItemAP242 ().Value ();
if(!anItem.IsNull() && anItem->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation)))
{
return Standard_True;
}
}
}
return Standard_False;
}
//=======================================================================
//function : ReadColors
//purpose :
@@ -961,152 +1265,36 @@ Standard_Boolean STEPCAFControl_Reader::ReadColors(const Handle(XSControl_WorkSe
Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
if (STool.IsNull()) return Standard_False;
const Interface_Graph& aGraph = Styles.Graph ();
// parse and search for color attributes
Standard_Integer nb = Styles.NbStyles();
for (Standard_Integer i = 1; i <= nb; i++) {
Handle(StepVisual_StyledItem) style = Styles.Style(i);
if (style.IsNull()) continue;
Standard_Boolean IsVisible = Standard_True;
// check the visibility of styled item.
for (Standard_Integer si = 1; si <= aHSeqOfInvisStyle->Length(); si++) {
if (style != aHSeqOfInvisStyle->Value(si))
continue;
// found that current style is invisible.
IsVisible = Standard_False;
break;
}
Handle(StepVisual_Colour) SurfCol, BoundCol, CurveCol, RenderCol;
Standard_Real RenderTransp;
// check if it is component style
Standard_Boolean IsComponent = Standard_False;
if (!Styles.GetColors(style, SurfCol, BoundCol, CurveCol, RenderCol, RenderTransp, IsComponent) && IsVisible)
continue;
// collect styled items
NCollection_Vector<StepVisual_StyledItemTarget> anItems;
if (!style->ItemAP242().IsNull()) {
anItems.Append(style->ItemAP242());
}
const Handle(Transfer_TransientProcess) &TP = WS->TransferReader()->TransientProcess();
for (Standard_Integer itemIt = 0; itemIt < anItems.Length(); itemIt++) {
Standard_Integer index = TP->MapIndex(anItems.Value(itemIt).Value());
TopoDS_Shape S;
if (index > 0) {
Handle(Transfer_Binder) binder = TP->MapItem(index);
S = TransferBRep::ShapeResult(binder);
}
Standard_Boolean isSkipSHUOstyle = Standard_False;
// take shape with real location.
while (IsComponent) {
// take SR of NAUO
Handle(StepShape_ShapeRepresentation) aSR;
findStyledSR(style, aSR);
// search for SR along model
if (aSR.IsNull())
break;
Interface_EntityIterator subs = WS->HGraph()->Graph().Sharings(aSR);
Handle(StepShape_ShapeDefinitionRepresentation) aSDR;
for (subs.Start(); subs.More(); subs.Next()) {
aSDR = Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(subs.Value());
if (aSDR.IsNull())
continue;
StepRepr_RepresentedDefinition aPDSselect = aSDR->Definition();
Handle(StepRepr_ProductDefinitionShape) PDS =
Handle(StepRepr_ProductDefinitionShape)::DownCast(aPDSselect.PropertyDefinition());
if (PDS.IsNull())
continue;
StepRepr_CharacterizedDefinition aCharDef = PDS->Definition();
Handle(StepRepr_AssemblyComponentUsage) ACU =
Handle(StepRepr_AssemblyComponentUsage)::DownCast(aCharDef.ProductDefinitionRelationship());
if (ACU.IsNull())
continue;
// PTV 10.02.2003 skip styled item that refer to SHUO
if (ACU->IsKind(STANDARD_TYPE(StepRepr_SpecifiedHigherUsageOccurrence))) {
isSkipSHUOstyle = Standard_True;
break;
}
Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO =
Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(ACU);
if (NAUO.IsNull())
continue;
TopoDS_Shape aSh;
// PTV 10.02.2003 to find component of assembly CORRECTLY
STEPConstruct_Tool Tool(WS);
TDF_Label aShLab = FindInstance(NAUO, CTool->ShapeTool(), Tool, myMap);
aSh = CTool->ShapeTool()->GetShape(aShLab);
if (!aSh.IsNull()) {
S = aSh;
break;
}
}
break;
}
if (isSkipSHUOstyle)
continue; // skip styled item which refer to SHUO
if (S.IsNull())
continue;
if (!SurfCol.IsNull() || !BoundCol.IsNull() || !CurveCol.IsNull() || !RenderCol.IsNull() || !IsVisible)
{
TDF_Label aL;
Standard_Boolean isFound = STool->SearchUsingMap(S, aL, Standard_False, Standard_True);
if (!SurfCol.IsNull() || !BoundCol.IsNull() || !CurveCol.IsNull() || !RenderCol.IsNull())
{
Quantity_Color aSCol, aBCol, aCCol, aRCol;
Quantity_ColorRGBA aFullSCol;
if (!SurfCol.IsNull()) {
Styles.DecodeColor(SurfCol, aSCol);
aFullSCol = Quantity_ColorRGBA(aSCol);
}
if (!BoundCol.IsNull())
Styles.DecodeColor(BoundCol, aBCol);
if (!CurveCol.IsNull())
Styles.DecodeColor(CurveCol, aCCol);
if (!RenderCol.IsNull()) {
Styles.DecodeColor(RenderCol, aRCol);
aFullSCol = Quantity_ColorRGBA(aRCol, static_cast<float>(1.0f - RenderTransp));
}
if (isFound)
{
if (!SurfCol.IsNull() || !RenderCol.IsNull())
CTool->SetColor(aL, aFullSCol, XCAFDoc_ColorSurf);
if (!BoundCol.IsNull())
CTool->SetColor(aL, aBCol, XCAFDoc_ColorCurv);
if (!CurveCol.IsNull())
CTool->SetColor(aL, aCCol, XCAFDoc_ColorCurv);
}
else
{
for (TopoDS_Iterator it(S); it.More(); it.Next())
{
TDF_Label aL1;
if (STool->SearchUsingMap(it.Value(), aL1, Standard_False, Standard_True))
{
if (!SurfCol.IsNull() || !RenderCol.IsNull())
CTool->SetColor(aL1, aFullSCol, XCAFDoc_ColorSurf);
if (!BoundCol.IsNull())
CTool->SetColor(aL1, aBCol, XCAFDoc_ColorCurv);
if (!CurveCol.IsNull())
CTool->SetColor(aL1, aCCol, XCAFDoc_ColorCurv);
}
}
}
}
if (!IsVisible)
{
// sets the invisibility for shape.
if (isFound)
CTool->SetVisibility(aL, Standard_False);
}
}
Standard_Integer nb = Styles.NbRootStyles();
// apply root styles earlier, as they can be overridden
// function IsOverriden for root style returns true only if it is overridden by other root style
Standard_Boolean anIsRootStyle = Standard_True;
for(Standard_Integer i = 1; i <= nb; i++)
{
Handle(StepVisual_StyledItem) Style = Styles.RootStyle(i);
// check that style is overridden by other root style
if (!IsOverriden (aGraph, Style, anIsRootStyle))
{
SetStyle (WS, myMap, CTool, STool, Styles, aHSeqOfInvisStyle, Style);
}
}
nb = Styles.NbStyles();
// apply leaf styles, they can override root styles
anIsRootStyle = Standard_False;
for(Standard_Integer i = 1; i <= nb; i++)
{
Handle(StepVisual_StyledItem) Style = Styles.Style(i);
// check that style is overridden
if (!IsOverriden (aGraph, Style, anIsRootStyle))
{
SetStyle (WS, myMap, CTool, STool, Styles, aHSeqOfInvisStyle, Style);
}
}
CTool->ReverseChainsOfTreeNodes();
// some colors can be attached to assemblies, propagate them to components

View File

@@ -68,6 +68,8 @@
#include <XSControl_TransferReader.hxx>
#include <XSControl_TransferWriter.hxx>
#include <XSControl_WorkSession.hxx>
#include <StepVisual_ContextDependentOverRidingStyledItem.hxx>
#include <StepShape_ShapeRepresentation.hxx>
//=======================================================================
//function : STEPConstruct_Styles
@@ -124,6 +126,26 @@ Handle(StepVisual_StyledItem) STEPConstruct_Styles::Style (const Standard_Intege
return Handle(StepVisual_StyledItem)::DownCast ( myStyles.FindKey(i) );
}
//=======================================================================
//function : NbRootStyles
//purpose :
//=======================================================================
Standard_Integer STEPConstruct_Styles::NbRootStyles () const
{
return myRootStyles.Extent();
}
//=======================================================================
//function : RootStyle
//purpose :
//=======================================================================
Handle(StepVisual_StyledItem) STEPConstruct_Styles::RootStyle (const Standard_Integer i) const
{
return Handle(StepVisual_StyledItem)::DownCast ( myRootStyles.FindKey(i) );
}
//=======================================================================
//function : ClearStyles
@@ -134,6 +156,7 @@ void STEPConstruct_Styles::ClearStyles ()
{
myStyles.Clear();
myPSA.Clear();
myRootStyles.Clear();
}
@@ -344,13 +367,15 @@ Standard_Boolean STEPConstruct_Styles::LoadStyles ()
{
myStyles.Clear();
myPSA.Clear();
myRootStyles.Clear();
// find all MDGPRs and DMs and collect all defined styles in myStyles
Handle(Interface_InterfaceModel) model = Model();
Standard_Integer nb = model->NbEntities();
Handle(Standard_Type) tMDGPR = STANDARD_TYPE(StepVisual_MechanicalDesignGeometricPresentationRepresentation);
Handle(Standard_Type) tDM = STANDARD_TYPE(StepVisual_DraughtingModel);
Handle(Standard_Type) tSI = STANDARD_TYPE(StepVisual_StyledItem);
Handle(Standard_Type) tSR = STANDARD_TYPE(StepShape_ShapeRepresentation);
for (Standard_Integer i = 1; i <= nb; i ++)
{
Handle(Standard_Transient) enti = model->Value(i);
@@ -364,13 +389,26 @@ Standard_Boolean STEPConstruct_Styles::LoadStyles ()
Handle(StepVisual_StyledItem) style =
Handle(StepVisual_StyledItem)::DownCast ( container->ItemsValue(j) );
if ( style.IsNull() ) continue;
myStyles.Add ( style );
auto anItem = style->ItemAP242 ().Value ();
if (!anItem.IsNull() && anItem->IsKind(tSR))
{
myRootStyles.Add (style);
}
else
{
myStyles.Add (style);
}
}
}
else if (enti->DynamicType() == tSI)
else if (enti->IsKind (STANDARD_TYPE(StepVisual_StyledItem)))
{
Handle(StepVisual_StyledItem) aStyledItem = Handle(StepVisual_StyledItem)::DownCast (enti);
if (!myStyles.Contains (aStyledItem))
auto anItem = aStyledItem->ItemAP242 ().Value ();
if (!anItem.IsNull() && anItem->IsKind(tSR) && !myRootStyles.Contains (aStyledItem))
{
myRootStyles.Add (aStyledItem);
}
else if (!myStyles.Contains (aStyledItem))
{
myStyles.Add (aStyledItem);
}

View File

@@ -69,6 +69,12 @@ public:
//! Returns style with given index
Standard_EXPORT Handle(StepVisual_StyledItem) Style (const Standard_Integer i) const;
//! Returns number of override styles
Standard_EXPORT Standard_Integer NbRootStyles() const;
//! Returns override style with given index
Standard_EXPORT Handle(StepVisual_StyledItem) RootStyle (const Standard_Integer i) const;
//! Clears all defined styles and PSA sequence
Standard_EXPORT void ClearStyles();
@@ -159,6 +165,7 @@ private:
TColStd_IndexedDataMapOfTransientTransient myMapOfStyles;
TColStd_IndexedMapOfTransient myStyles;
TColStd_IndexedMapOfTransient myRootStyles;
TColStd_SequenceOfTransient myPSA;

View File

@@ -239,6 +239,7 @@ STEPControl_Controller::STEPControl_Controller ()
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixNonAdjacentIntersectingEdgesMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixVertexPositionMode", 't', "0");
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixVertexToleranceMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromSTEP.FixFaceSize.Tolerance", 't', "1.e-7");
// ika 28.07.16: Parameter to read all top level solids and shells,
// should be used only in case of invalid shape_representation without links to shapes.

View File

@@ -753,7 +753,25 @@ static void ReconstructMissedSeam(const TopTools_SequenceOfShape& theRemovedEdge
if ((theUperiod != 0. && aUdiff > theUperiod/2) ||
(theVperiod != 0. && aVdiff > theVperiod/2))
{
anEdge.Reverse();
if (aLastVertex.IsSame(theCurVertex) || (theUperiod != 0. && theVperiod != 0.))
{
anEdge.Reverse();
}
else
{
TopAbs_Orientation anOri = anEdge.Orientation();
anEdge.Orientation(TopAbs_FORWARD);
Handle(Geom2d_Curve) aPC1 = BRep_Tool::CurveOnSurface(anEdge, theFrefFace, Param1, Param2);
anEdge.Reverse();
Handle(Geom2d_Curve) aPC2 = BRep_Tool::CurveOnSurface(anEdge, theFrefFace, Param1, Param2);
anEdge.Reverse(); // again FORWARD
TopLoc_Location aLoc;
BRep_Builder aBB;
Standard_Real aTol = BRep_Tool::Tolerance(anEdge);
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(theFrefFace, aLoc);
aBB.UpdateEdge(anEdge, aPC2, aPC1, aSurf, aLoc, aTol);
anEdge.Orientation(anOri);
}
aPC = BRep_Tool::CurveOnSurface(anEdge, theFrefFace, Param1, Param2);
aParam = (anEdge.Orientation() == TopAbs_FORWARD)? Param1 : Param2;
aPoint = aPC->Value(aParam);
@@ -2745,6 +2763,26 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
for (Standard_Integer i = 1; i <= aFaceMap.Extent(); i++)
TopExp::MapShapesAndAncestors (aFaceMap(i), TopAbs_EDGE, TopAbs_FACE, aGMapEdgeFaces);
// creating map of face shells for the whole shape to avoid
// unification of faces belonging to the different shells
DataMapOfShapeMapOfShape aGMapFaceShells;
for (TopExp_Explorer anExp (myShape, TopAbs_SHELL); anExp.More(); anExp.Next())
{
const TopoDS_Shape& aShell = anExp.Current();
for (TopoDS_Iterator anItF (aShell); anItF.More(); anItF.Next())
{
const TopoDS_Shape& aF = anItF.Value();
if (TopTools_MapOfShape* pShells = aGMapFaceShells.ChangeSeek (aF))
{
pShells->Add (aShell);
}
else
{
(aGMapFaceShells.Bound (aF, TopTools_MapOfShape()))->Add (aShell);
}
}
}
// creating map of free boundaries
TopTools_MapOfShape aFreeBoundMap;
// look at only shells not belonging to solids
@@ -2766,7 +2804,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
// unify faces in each shell separately
TopExp_Explorer exps;
for (exps.Init(myShape, TopAbs_SHELL); exps.More(); exps.Next())
IntUnifyFaces(exps.Current(), aGMapEdgeFaces, aFreeBoundMap);
IntUnifyFaces(exps.Current(), aGMapEdgeFaces, aGMapFaceShells, aFreeBoundMap);
// gather all faces out of shells in one compound and unify them at once
BRep_Builder aBB;
@@ -2777,7 +2815,10 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
aBB.Add(aCmp, exps.Current());
if (nbf > 0)
IntUnifyFaces(aCmp, aGMapEdgeFaces, aFreeBoundMap);
{
// No connection to shells, thus no need to pass the face-shell map
IntUnifyFaces(aCmp, aGMapEdgeFaces, DataMapOfShapeMapOfShape(), aFreeBoundMap);
}
myShape = myContext->Apply(myShape);
}
@@ -2800,13 +2841,52 @@ static void SetFixWireModes(ShapeFix_Face& theSff)
aFixWire->FixSmallMode() = 0;
}
//=======================================================================
//function : isSameSets
//purpose : Compares two sets of shapes. Returns true if they are the same,
// false otherwise.
//=======================================================================
template<class Container>
static Standard_Boolean isSameSets(const Container* theFShells1,
const Container* theFShells2)
{
// If both are null - no problem
if (theFShells1 == nullptr && theFShells2 == nullptr)
{
return Standard_True;
}
// If only one is null - not the same
if (theFShells1 == nullptr || theFShells2 == nullptr)
{
return Standard_False;
}
// Both not null
if (theFShells1->Extent() != theFShells2->Extent())
{
return Standard_False;
}
// number of shells in each set should be very small in normal cases - max 2.
// thus just check if all objects of one are contained in the other and vice versa.
for (typename Container::Iterator it1(*theFShells1), it2(*theFShells2);
it1.More() && it2.More(); it1.Next(), it2.Next())
{
if (!theFShells1->Contains(it2.Value()) || !theFShells2->Contains(it1.Value()))
{
return Standard_False;
}
}
return Standard_True;
}
//=======================================================================
//function : IntUnifyFaces
//purpose :
//=======================================================================
void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape,
TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
const TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
const DataMapOfShapeMapOfShape& theGMapFaceShells,
const TopTools_MapOfShape& theFreeBoundMap)
{
// creating map of edge faces for the shape
@@ -2855,6 +2935,9 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
Standard_Real Uperiod = (aBaseSurface->IsUPeriodic())? aBaseSurface->UPeriod() : 0.;
Standard_Real Vperiod = (aBaseSurface->IsVPeriodic())? aBaseSurface->VPeriod() : 0.;
// Get shells connected to the face (in normal cases should not be more than 2)
const TopTools_MapOfShape* pFShells1 = theGMapFaceShells.Seek (aFace);
// find adjacent faces to union
Standard_Integer i;
for (i = 1; i <= edges.Length(); i++) {
@@ -2903,6 +2986,15 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
if (aProcessed.Contains(aCheckedFace))
continue;
// Get shells connected to the checked face
const TopTools_MapOfShape* pFShells2 = theGMapFaceShells.Seek (aCheckedFace);
// Faces can be unified only if the shells of faces connected to
// these faces are the same. Otherwise, topology would be broken.
if (!isSameSets (pFShells1, pFShells2))
{
continue;
}
if (bCheckNormals) {
// get normal of checked face using the same parameter on edge
gp_Dir aDN2;

View File

@@ -70,6 +70,7 @@ class ShapeUpgrade_UnifySameDomain : public Standard_Transient
public:
typedef NCollection_DataMap<TopoDS_Shape, Handle(Geom_Plane), TopTools_ShapeMapHasher> DataMapOfFacePlane;
typedef NCollection_DataMap<TopoDS_Shape, TopTools_MapOfShape, TopTools_ShapeMapHasher> DataMapOfShapeMapOfShape;
//! Empty constructor
Standard_EXPORT ShapeUpgrade_UnifySameDomain();
@@ -168,7 +169,8 @@ protected:
Standard_EXPORT void UnifyEdges();
void IntUnifyFaces(const TopoDS_Shape& theInpShape,
TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
const TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
const DataMapOfShapeMapOfShape& theGMapFaceShells,
const TopTools_MapOfShape& theFreeBoundMap);
//! Splits the sequence of edges into the sequence of chains

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -23,7 +23,6 @@
#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>
@@ -89,7 +88,6 @@ 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;
}
@@ -239,17 +237,6 @@ 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 :
@@ -307,15 +294,6 @@ 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 :
@@ -330,26 +308,12 @@ Standard_Boolean XCAFDoc_DocumentTool::CheckVisMaterialTool(const TDF_Label& the
return aLabel.IsAttribute(XCAFDoc_VisMaterialTool::GetID());
}
//=======================================================================
//function : CheckAnimationTool
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_DocumentTool::CheckAnimationTool(const TDF_Label& theAcces)
{
TDF_Label aLabel = DocLabel(theAcces).FindChild(18, Standard_False);
if (aLabel.IsNull())
{
return Standard_False;
}
return aLabel.IsAttribute(XCAFDoc_AnimationTool::GetID());
}
//=======================================================================
//function : LayerTool
//purpose :
//=======================================================================
Handle(XCAFDoc_LayerTool) XCAFDoc_DocumentTool::LayerTool (const TDF_Label& acces)
Handle(XCAFDoc_LayerTool) XCAFDoc_DocumentTool::LayerTool (const TDF_Label& acces)
{
return XCAFDoc_LayerTool::Set(LayersLabel(acces));
}

View File

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

View File

@@ -24,7 +24,6 @@
#include <TCollection_HAsciiString.hxx>
#include <TColStd_SequenceOfHAsciiString.hxx>
#include <TDataStd_Name.hxx>
#include <TDataStd_RealArray.hxx>
#include <TDataStd_TreeNode.hxx>
#include <TDataStd_UAttribute.hxx>
#include <TDF_Attribute.hxx>
@@ -49,24 +48,11 @@
#include <XCAFDoc_GraphNode.hxx>
#include <XCAFDoc_Location.hxx>
#include <XCAFDoc_ShapeMapTool.hxx>
#include <TopLoc_Datum3D.hxx>
IMPLEMENT_DERIVED_ATTRIBUTE_WITH_TYPE(XCAFDoc_ShapeTool,TDataStd_GenericEmpty,"xcaf","ShapeTool")
namespace
{
static Standard_Boolean THE_AUTO_NAMING_FLAG = Standard_True;
static Standard_Boolean THE_UNIFORM_SCALING_SUPPORT_FLAG = Standard_False;
//=======================================================================
//function : GetUniformScaleGUID
//purpose :
//=======================================================================
const Standard_GUID& GetUniformScaleGUID()
{
static Standard_GUID anUniformScaleID("D4DA66EA-EBAD-4775-ACEC-1A018C6A4501");
return anUniformScaleID;
}
}
static Standard_Boolean theAutoNaming = Standard_True;
// attribute methods //////////////////////////////////////////////////
@@ -427,7 +413,7 @@ void XCAFDoc_ShapeTool::MakeReference (const TDF_Label &L,
refNode->Remove(); // abv: fix against bug in TreeNode::Append()
mainNode->Append(refNode);
if (THE_AUTO_NAMING_FLAG)
if (theAutoNaming)
SetLabelNameByLink(L);
}
@@ -502,7 +488,7 @@ TDF_Label XCAFDoc_ShapeTool::addShape (const TopoDS_Shape& S, const Standard_Boo
// }
A->SetShape(S);
if (THE_AUTO_NAMING_FLAG)
if (theAutoNaming)
SetLabelNameByShape(ShapeLabel);
// if shape is Compound and flag is set, create assembly
@@ -510,7 +496,7 @@ TDF_Label XCAFDoc_ShapeTool::addShape (const TopoDS_Shape& S, const Standard_Boo
// mark assembly by assigning UAttribute
Handle(TDataStd_UAttribute) Uattr;
Uattr = TDataStd_UAttribute::Set ( ShapeLabel, XCAFDoc::AssemblyGUID() );
if (THE_AUTO_NAMING_FLAG)
if (theAutoNaming)
TDataStd_Name::Set(ShapeLabel, TCollection_ExtendedString("ASSEMBLY"));
// iterate on components
@@ -659,89 +645,31 @@ void XCAFDoc_ShapeTool::Init()
//=======================================================================
//function : SetAutoNaming
//purpose :
//purpose :
//=======================================================================
void XCAFDoc_ShapeTool::SetAutoNaming (const Standard_Boolean V)
{
THE_AUTO_NAMING_FLAG = V;
theAutoNaming = V;
}
//=======================================================================
//function : AutoNaming
//purpose :
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_ShapeTool::AutoNaming()
{
return THE_AUTO_NAMING_FLAG;
return theAutoNaming;
}
//=======================================================================
//function : SetUniformScalingSupport
//purpose :
//=======================================================================
void XCAFDoc_ShapeTool::SetUniformScalingSupport(const Standard_Boolean theSupportFlag)
{
THE_UNIFORM_SCALING_SUPPORT_FLAG = theSupportFlag;
}
//=======================================================================
//function : UniformScalingSupport
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_ShapeTool::UniformScalingSupport()
{
return THE_UNIFORM_SCALING_SUPPORT_FLAG;
}
//=======================================================================
//function : GetShapeUniformScale
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_ShapeTool::GetShapeUniformScale(const TDF_Label& theShLabel,
double& theDX,
double& theDY,
double& theDZ)
{
if (theShLabel.IsNull())
{
return Standard_False;
}
Handle(TDataStd_RealArray) anArrAttr;
if (!theShLabel.FindAttribute(GetUniformScaleGUID(), anArrAttr) ||
anArrAttr->Length() != 3)
{
return Standard_False;
}
theDX = anArrAttr->Value(1);
theDY = anArrAttr->Value(2);
theDZ = anArrAttr->Value(3);
return true;
}
//=======================================================================
//function : SetShapeUniformScale
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_ShapeTool::SetShapeUniformScale(const TDF_Label& theShLabel,
const double theDX,
const double theDY,
const double theDZ)
{
if (!IsShape(theShLabel))
{
return Standard_False;
}
Handle(TDataStd_RealArray) anArray = TDataStd_RealArray::Set(theShLabel, GetUniformScaleGUID(), 1, 3);
anArray->SetValue(1, theDX);
anArray->SetValue(2, theDY);
anArray->SetValue(3, theDZ);
return true;
}
//=======================================================================
//function : ComputeShapes
//purpose :
//purpose :
//=======================================================================
void XCAFDoc_ShapeTool::ComputeShapes(const TDF_Label& L)
{
TDF_ChildIterator it(L);
@@ -1595,7 +1523,7 @@ Standard_Boolean XCAFDoc_ShapeTool::SetSHUO (const TDF_LabelSequence& labels,
TDF_TagSource aTag;
TDF_Label UpperSubL = aTag.NewChild( labels( 1 ) );
if (THE_AUTO_NAMING_FLAG) {
if (theAutoNaming) {
TCollection_ExtendedString Entry("SHUO");
TDataStd_Name::Set(UpperSubL, TCollection_ExtendedString( Entry ));
}
@@ -1606,7 +1534,7 @@ Standard_Boolean XCAFDoc_ShapeTool::SetSHUO (const TDF_LabelSequence& labels,
// add other next_usage occurrences.
for (i = 2; i <= labels.Length(); i++) {
TDF_Label NextSubL = aTag.NewChild( labels( i ) );
if (THE_AUTO_NAMING_FLAG) {
if (theAutoNaming) {
TCollection_ExtendedString EntrySub("SHUO-");
EntrySub += i;
TDataStd_Name::Set(NextSubL, TCollection_ExtendedString( EntrySub ));
@@ -1675,6 +1603,33 @@ Standard_Boolean XCAFDoc_ShapeTool::RemoveSHUO (const TDF_Label& L) const
//purpose : auxiliary
//=======================================================================
static Standard_Boolean IsEqual (const TopLoc_Location& theLoc1, const TopLoc_Location& theLoc2)
{
if (theLoc1.IsEqual (theLoc2)) {return Standard_True; }
if (theLoc1.IsIdentity() || theLoc2.IsIdentity()) {return Standard_False; }
const Handle(TopLoc_Datum3D)& aDatum1 = theLoc1.FirstDatum();
const Handle(TopLoc_Datum3D)& aDatum2 = theLoc2.FirstDatum();
if (aDatum1 && aDatum2)
{
NCollection_Mat4<double> aMat41;
NCollection_Mat4<double> aMat42;
theLoc1.FirstDatum()->Transformation().GetMat4(aMat41);
theLoc2.FirstDatum()->Transformation().GetMat4(aMat42);
if ( !aMat41.IsEqual (aMat42)) {return Standard_False; }
}
else if (aDatum1 || aDatum2) {return Standard_False; }
if (theLoc1.FirstPower() != theLoc2.FirstPower() ) {return Standard_False; }
else { return IsEqual (theLoc1.NextLocation(), theLoc2.NextLocation());}
}
static Standard_Boolean IsSame (const TopoDS_Shape& theShape1, const TopoDS_Shape& theShape2)
{
return theShape1.TShape() == theShape2.TShape()
&& theShape1.Orientation() == theShape2.Orientation()
&& IsEqual (theShape1.Location(), theShape2.Location());
}
static Standard_Boolean checkForShape (const TopoDS_Shape& theShape,
const TopoDS_Shape& theCurSh,
const TDF_Label& theUserL,
@@ -1689,7 +1644,7 @@ static Standard_Boolean checkForShape (const TopoDS_Shape& theShape,
aCompLoc = aCompLoc.Multiplied( theCurSh.Location() );
aSupLoc = aSupLoc.Multiplied( aCompLoc );
aCopySh.Location( aSupLoc, Standard_False );
if ( aCopySh.IsSame( theShape ) ) {
if ( IsSame ( theShape, aCopySh ) ) {
theLabels.Prepend( theUserL );
return Standard_True;
}

View File

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

View File

@@ -3,6 +3,8 @@
#
#Create 3 torus
puts "TODO CR33225 Linux: Error : The area of result shape is 138625, expected 197700"
ptorus a0 100 20
tcopy a0 a1
tcopy a0 a2

View File

@@ -1,24 +0,0 @@
puts "==========="
puts "OCC114"
puts "==========="
# Max number of iterations for computing memory leackage
set i_max 10
puts "Amount of iterations is $i_max"
NewDocument D BinOcaf
UndoLimit D 10
restore [locate_data_file OCC294.brep] s
set listmem {}
for {set i 1} {${i} <= ${i_max}} {incr i} {
OpenCommand D
SetShape D 0:1 s
AbortCommand D
# check memory usage (with tolerance equal to half page size)
lappend listmem [meminfo h]
checktrend $listmem 50 50 "Memory leak detected"
}

View File

@@ -1,17 +0,0 @@
puts "==========="
puts "OCC26293"
puts "==========="
puts ""
#################################
# Error opening the document
#################################
Open [locate_data_file bug26293_all_geom.sgd] D
vinit
for {set i 1} {$i < 1065} {incr i} {
if { ![catch {GetShape D 0:1:$i:1:1:2 res$i}] } {
vdisplay res$i
}
}
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -1,3 +1,5 @@
puts "TODO ?CR33225 Windows: Failed class "
pload QAcommands
QANTestStlIterators

View File

@@ -1,3 +1,4 @@
puts "TODO ?СК33225 Linux: Checking trend failed "
puts "TODO ?OCC7287 Linux: Tcl Exception: Memory leak detected"
puts "TODO ?OCC7287 Linux: TEST INCOMPLETE"
puts "TODO ?OCC7287 MacOS: Tcl Exception: Memory leak detected"

View File

@@ -1,3 +1,4 @@
puts "TODO ?CR332257287 Linux: Checking trend failed: mean delta per step = 9432.0, sigma = 4220.013270121316, expected delta = 0"
puts "TODO ?OCC7287 Linux: Tcl Exception: Memory leak detected"
puts "TODO ?OCC7287 Linux: TEST INCOMPLETE"
puts "TODO ?OCC7287 MacOS: Tcl Exception: Memory leak detected"

View File

@@ -1,3 +1,4 @@
puts "TODO ?CR33225 Linux: Checking trend failed: mean delta per step = 7408.0, sigma = 2737.917456754312, expected delta = 0"
puts "TODO ?OCC7287 Linux: Tcl Exception: Memory leak detected"
puts "TODO ?OCC7287 Linux: TEST INCOMPLETE"
puts "TODO ?OCC7287 MacOS: Tcl Exception: Memory leak detected"

View File

@@ -0,0 +1,71 @@
puts "========================"
puts " 0033171: Modeling Algorithms - Invalid result of faces unification"
puts "========================"
puts ""
# make outer prism
polyline p 0 0 0 10 0 0 10 10 0 0 10 0 0 0 0
mkplane f p
prism s f 0 0 5
# make section shells
polyline p1 3 10 0 3 7 0 6 7 0 6 3 0 10 3 0
polyline p2 6 7 0 10 7 0
polyline p3 8 7 0 8 10 0
polyline p4 0 5 0 10 5 0
prism sh1 p1 0 0 5
prism sh2 p2 0 0 5
prism sh3 p3 0 0 5
prism sh4 p4 0 0 5
# split the prism
bclearobjects
bcleartools
baddobjects s
baddtools sh1 sh2 sh3 sh4
bfillds
bsplit r
checkshape r
if {![regexp "This shape seems to be OK" [bopcheck r]]} {
puts "Error: invalid shape after split"
}
# try to unify faces in the result compound
unifysamedom ru1 r
unifysamedom ru2 r +i
checkshape ru1
checkshape ru2
checknbshapes ru1 -ref [nbshapes r -t] -t
checknbshapes ru2 -ref [nbshapes r -t] -t
if {![regexp "This shape seems to be OK" [bopcheck ru1]]} {
puts "Error: invalid shape after faces unification"
}
if {![regexp "This shape seems to be OK" [bopcheck ru2]]} {
puts "Error: invalid shape after faces unification"
}
# make compound of shells
eval compound [explode r] shs
unifysamedom shsu1 r
unifysamedom shsu2 r +i
checkshape shsu1
checkshape shsu2
checknbshapes shsu1 -ref [nbshapes shs -t] -t
checknbshapes shsu2 -ref [nbshapes shs -t] -t
if {![regexp "This shape seems to be OK" [bopcheck shsu1]]} {
puts "Error: invalid shape after faces unification"
}
if {![regexp "This shape seems to be OK" [bopcheck shsu2]]} {
puts "Error: invalid shape after faces unification"
}
checkview -display ru2 -2d -path ${imagedir}/${test_image}.png

Some files were not shown because too many files have changed in this diff Show More