mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Compare commits
52 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fc5d3cab9f | ||
|
8596ce03fb | ||
|
ac867f3b74 | ||
|
10cf30ce94 | ||
|
bee2b3b445 | ||
|
4a9bbf5cd8 | ||
|
be75f04a7a | ||
|
5a6f0d9235 | ||
|
ef6b11472a | ||
|
b604f54327 | ||
|
673167be73 | ||
|
16a24b6781 | ||
|
08f15ad095 | ||
|
7dfac274a6 | ||
|
577c6f0d0f | ||
|
5163f46719 | ||
|
fd175e093d | ||
|
5adae760bf | ||
|
7e17e8f08d | ||
|
c3282ec170 | ||
|
a7cb665a6a | ||
|
3c1304bf71 | ||
|
db6c6404bc | ||
|
8c820969cc | ||
|
c14cd5a20e | ||
|
51aed73084 | ||
|
8948e7784a | ||
|
016dfb16ba | ||
|
7321e9fb9a | ||
|
debc95ee5a | ||
|
03383c97c3 | ||
|
c5d8782cfd | ||
|
787c4320b1 | ||
|
c7d774c557 | ||
|
55e738d2f3 | ||
|
031d5ab77c | ||
|
a447178e3f | ||
|
825aa485a3 | ||
|
317d68c924 | ||
|
8a755387b6 | ||
|
3907053280 | ||
|
50bc8f9624 | ||
|
637b758367 | ||
|
f42753ed03 | ||
|
72080ae11f | ||
|
5a19c30371 | ||
|
29a4908e18 | ||
|
631633a280 | ||
|
319da2e43f | ||
|
ce41efdeb3 | ||
|
a493b4a124 | ||
|
62e1beed96 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -57,3 +57,5 @@ Release
|
||||
/Makefile
|
||||
/libtool
|
||||
/stamp*
|
||||
/build
|
||||
/install
|
||||
|
15
adm/CMPLRS
15
adm/CMPLRS
@@ -10,21 +10,6 @@ wnt cmplrs_c f -DWNT -D_WINDOWS -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHA
|
||||
wnt cmplrs_c b -DWNT -D_WINDOWS -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
|
||||
wnt cmplrs_c NIS (wnt cmplrs_c b) -DSILGL -DSILGL_VRS=50
|
||||
|
||||
win csf CSF_TclLibs tcl86.lib
|
||||
win csf CSF_TclTkLibs tk86.lib
|
||||
win csf CSF_gdi32 gdi32.lib
|
||||
win csf CSF_advapi32 advapi32.lib
|
||||
win csf CSF_user32 user32.lib
|
||||
win csf CSF_advapi32 advapi32.lib
|
||||
win csf CSF_gdi32 gdi32.lib
|
||||
win csf CSF_user32 user32.lib
|
||||
win csf CSF_kernel32 kernel32.lib
|
||||
win csf CSF_OpenGlLibs opengl32.lib glu32.lib
|
||||
win csf CSF_wsock32 wsock32.lib
|
||||
win csf CSF_AviLibs ws2_32.lib vfw32.lib
|
||||
|
||||
|
||||
|
||||
lin cmplrs_cxx f -DLIN -DLININTEL -DOCC_CONVERT_SIGNALS -D_GNU_SOURCE=1 -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
|
||||
lin cmplrs_cxx b -DLIN -DLININTEL -DOCC_CONVERT_SIGNALS -D_GNU_SOURCE=1 -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
|
||||
|
||||
|
@@ -202,6 +202,7 @@ n Graphic3d
|
||||
n Image
|
||||
n MeshVS
|
||||
n OpenGl
|
||||
n D3DHost
|
||||
n Prs3d
|
||||
n PrsMgr
|
||||
n Select3D
|
||||
@@ -220,6 +221,7 @@ r Textures
|
||||
r Shaders
|
||||
t TKMeshVS
|
||||
t TKOpenGl
|
||||
t TKD3DHost
|
||||
t TKService
|
||||
t TKV3d
|
||||
t TKVoxel
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/tclsh
|
||||
|
||||
set ARCH "32"
|
||||
set ARCH "64"
|
||||
|
||||
if { "$tcl_platform(platform)" == "unix" } {
|
||||
set SYS_PATH_SPLITTER ":"
|
||||
@@ -39,6 +39,9 @@ set CSF_OPT_LIB64 [list]
|
||||
set CSF_OPT_BIN32 [list]
|
||||
set CSF_OPT_BIN64 [list]
|
||||
|
||||
if { "$tcl_platform(pointerSize)" == "4" } {
|
||||
set ARCH "32"
|
||||
}
|
||||
if { [info exists ::env(ARCH)] } {
|
||||
set ARCH "$::env(ARCH)"
|
||||
}
|
||||
@@ -139,7 +142,8 @@ proc wokdep:SearchLib {theLib theBitness {theSearchPath ""}} {
|
||||
}
|
||||
}
|
||||
|
||||
if { "$::tcl_platform(platform)" == "linux" } {
|
||||
|
||||
if { "$::tcl_platform(os)" == "Linux" } {
|
||||
if { "$theBitness" == "64" } {
|
||||
set aPath "/usr/lib/x86_64-linux-gnu/lib${theLib}.so"
|
||||
if { [file exists "$aPath"] } {
|
||||
@@ -312,15 +316,10 @@ proc wokdep:SearchFreeType {theErrInc theErrLib32 theErrLib64 theErrBin32 theErr
|
||||
set isFound "true"
|
||||
set aFtBuildPath [wokdep:SearchHeader "ft2build.h"]
|
||||
|
||||
# new layout of headers in Freetype 2.5.x
|
||||
if { "$aFtBuildPath" == "" } {
|
||||
set aFtBuildPath [wokdep:SearchHeader "freetype2/ft2build.h"]
|
||||
}
|
||||
|
||||
if { "$aFtBuildPath" == "" } {
|
||||
# TODO - use `freetype-config --cflags` instead
|
||||
set aSysFreeType "/usr/include/freetype2"
|
||||
if { [file exists "$aSysFreeType/ftbuild.h"] } {
|
||||
if { [file exists "$aSysFreeType/ft2build.h"] } {
|
||||
lappend ::CSF_OPT_INC "$aSysFreeType"
|
||||
} elseif { [file exists "$aSysFreeType/freetype2/ft2build.h"] } {
|
||||
lappend ::CSF_OPT_INC "$aSysFreeType/freetype2"
|
||||
@@ -955,8 +954,9 @@ proc wokdep:SaveCustom {} {
|
||||
puts $aFile "#!/bin/bash"
|
||||
puts $aFile "# This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
|
||||
|
||||
#puts $aFile ""
|
||||
#puts $aFile "export ARCH=$::ARCH"
|
||||
puts $aFile ""
|
||||
puts $aFile "export ARCH=$::ARCH"
|
||||
puts $aFile "export SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
|
||||
|
||||
puts $aFile ""
|
||||
puts $aFile "export PRODUCTS_PATH=\"$::PRODUCTS_PATH\""
|
||||
|
1096
adm/genproj.tcl
1096
adm/genproj.tcl
File diff suppressed because it is too large
Load Diff
0
adm/templates/codeblocks.sh
Normal file → Executable file
0
adm/templates/codeblocks.sh
Normal file → Executable file
0
adm/templates/draw.sh
Normal file → Executable file
0
adm/templates/draw.sh
Normal file → Executable file
@@ -14,6 +14,7 @@ fi
|
||||
|
||||
# Reset values
|
||||
export CASDEB=""
|
||||
export TARGET="";
|
||||
export HAVE_TBB="false";
|
||||
export HAVE_OPENCL="false";
|
||||
export HAVE_FREEIMAGE="false";
|
||||
@@ -31,14 +32,16 @@ if [ -e "${aScriptPath}/custom.sh" ]; then source "${aScriptPath}/custom.sh"; fi
|
||||
|
||||
# Read script arguments
|
||||
shopt -s nocasematch
|
||||
export TARGET="";
|
||||
if [[ "$2" == "cbp" ]]; then
|
||||
export TARGET="cbp";
|
||||
elif [[ "$2" == "xcd" ]]; then
|
||||
export TARGET="xcd";
|
||||
fi
|
||||
if [[ "$1" == "debug" ]]; then export CASDEB="d"; fi
|
||||
if [[ "$1" == "d" ]]; then export CASDEB="d"; fi
|
||||
for i in $*
|
||||
do
|
||||
if [ "$i" == "d" ] || [ "$i" == "debug" ]; then
|
||||
export CASDEB="d"
|
||||
elif [ "$i" == "cbp" ]; then
|
||||
export TARGET="cbp";
|
||||
elif [ "$i" == "xcd" ] || [ "$i" == "xcode" ]; then
|
||||
export TARGET="xcd";
|
||||
fi
|
||||
done
|
||||
shopt -u nocasematch
|
||||
|
||||
# ----- Setup Environment Variables -----
|
||||
|
7
adm/templates/xcode.sh
Executable file
7
adm/templates/xcode.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
export TARGET="xcd"
|
||||
|
||||
source ./env.sh "$1" "$TARGET"
|
||||
|
||||
open -a Xcode ./adm/mac/xcd/OCCT.xcworkspace
|
0
dox/license.md
Normal file → Executable file
0
dox/license.md
Normal file → Executable file
@@ -746,7 +746,7 @@ then, the *Value* function may be implemented as follows:
|
||||
Item TCollection_Array1::Value (const Standard_Integer&index) const
|
||||
{
|
||||
// where r1 and r2 are the lower and upper bounds of the array
|
||||
if(index r1 || index > r2) {
|
||||
if(index < r1 || index > r2) {
|
||||
OutOfRange::Raise(“Index out of range in Array1::Value”);
|
||||
}
|
||||
return contents[index];
|
||||
@@ -754,26 +754,26 @@ Item TCollection_Array1::Value (const Standard_Integer&index) const
|
||||
~~~~~
|
||||
|
||||
Here validity of the index is first verified using the Lower and Upper functions in order to protect the call.
|
||||
Normally the caller ensures the index being in the valid range before calling Value(). In this case the above implementation of Value is not optimal since the test done in Value is time-consuming and redundant.
|
||||
Normally the caller ensures the index being in the valid range before calling <i>Value()</i>. In this case the above implementation of *Value* is not optimal since the test done in *Value* is time-consuming and redundant.
|
||||
|
||||
It is a widely used practice to include that kind of protections in a debug build of the program and exclude in release (optimized) build. To support this practice, the macros Raise_if() are provided for every OCCT exception class:
|
||||
It is a widely used practice to include that kind of protections in a debug build of the program and exclude in release (optimized) build. To support this practice, the macros <i>Raise_if()</i> are provided for every OCCT exception class:
|
||||
~~~~~
|
||||
<ErrorTypeName>_Raise_if(condition, “Error message”);
|
||||
~~~~~
|
||||
where ErrorTypeName is the exception type, condition is the logical expression leading to the raise of the exception, and Error message is the associated message.
|
||||
where *ErrorTypeName* is the exception type, *condition* is the logical expression leading to the raise of the exception, and *Error message* is the associated message.
|
||||
|
||||
The entire call may be removed by defining one of the pre-processor symbols No_Exception or No_<ErrorTypeName> at compile-time:
|
||||
The entire call may be removed by defining one of the pre-processor symbols *No_Exception* or <i>No_<ErrorTypeName></i> at compile-time:
|
||||
|
||||
~~~~~
|
||||
#define No_Exception /* remove all raises */
|
||||
~~~~~
|
||||
|
||||
Using this syntax, the Value function becomes:
|
||||
Using this syntax, the *Value* function becomes:
|
||||
|
||||
~~~~~
|
||||
Item TCollection_Array1::Value (const Standard_Integer&index) const
|
||||
{
|
||||
OutOfRange_Raise_if(index r1 || index > r2,
|
||||
OutOfRange_Raise_if(index < r1 || index > r2,
|
||||
“index out of range in Array1::Value”);
|
||||
return contents[index];
|
||||
}
|
||||
@@ -789,7 +789,7 @@ A handler of T exception type is a match for a raise expression with an excepti
|
||||
* T and E are of the same type, or
|
||||
* T is a supertype of E.
|
||||
|
||||
In order to handle system signals as exceptions, make sure to insert macro OCC_CATCH_SIGNALS somewhere in the beginning of the relevant code. The recommended location for it is first statement after opening brace of try {} block.
|
||||
In order to handle system signals as exceptions, make sure to insert macro *OCC_CATCH_SIGNALS* somewhere in the beginning of the relevant code. The recommended location for it is first statement after opening brace of <i>try {}</i> block.
|
||||
|
||||
As an example, consider the exceptions of type *NumericError, Overflow, Underflow* and *ZeroDivide*, where *NumericError* is the parent type of the three others.
|
||||
|
||||
|
40
genproj.sh
Executable file
40
genproj.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Helper script to run generation of CBP/XCode projects on Linux / OS X.
|
||||
# Running it requires that Tcl should be in the PATH
|
||||
|
||||
anOldPath="$PATH"
|
||||
anOldLd="$LD_LIBRARY_PATH"
|
||||
anOldDyLd="$DYLD_LIBRARY_PATH"
|
||||
|
||||
# go to the script directory
|
||||
aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
|
||||
|
||||
aSystem=`uname -s`
|
||||
aTarget="$1"
|
||||
anOpt2=$2
|
||||
anOpt3=$3
|
||||
anOpt4=$4
|
||||
anOpt5=$5
|
||||
if [ "$aTarget" == "" ]; then
|
||||
aTarget="cbp"
|
||||
if [ "$aSystem" == "Darwin" ]; then aTarget="xcd"; fi;
|
||||
fi
|
||||
|
||||
if [ ! -e "${aScriptPath}/custom.sh" ]; then
|
||||
tclsh "${aScriptPath}/adm/genconf.tcl"
|
||||
fi
|
||||
|
||||
if [ ! -e "${aScriptPath}/custom.sh" ]; then
|
||||
echo custom.sh is not created. Run the script again and generate custom.sh
|
||||
exit 1
|
||||
fi
|
||||
source "${aScriptPath}/custom.sh"
|
||||
|
||||
if [ -e "${aScriptPath}/env.sh" ]; then source "${aScriptPath}/env.sh"; fi
|
||||
|
||||
tclsh "${aScriptPath}/adm/genproj.tcl" -path="${aScriptPath}" -target=${aTarget} $anOpt2 $anOpt3 $anOpt4 $anOpt5
|
||||
|
||||
export PATH="$anOldPath"
|
||||
export LD_LIBRARY_PATH="$anOldLd"
|
||||
export DYLD_LIBRARY_PATH="$anOldDyLd"
|
@@ -1,152 +0,0 @@
|
||||
#include "BridgeFBO.hxx"
|
||||
|
||||
#include <OpenGl_ArbFBO.hxx>
|
||||
|
||||
#include <Graphic3d_TextureParams.hxx>
|
||||
|
||||
#include <d3dx9.h>
|
||||
|
||||
// list of required libraries
|
||||
#pragma comment(lib, "TKOpenGl.lib")
|
||||
#pragma comment(lib, "opengl32.lib")
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean BridgeFBO::Init (const Handle(OpenGl_Context)& theGlContext,
|
||||
void* theD3DDevice)
|
||||
{
|
||||
const OpenGl_GlFunctions* aFuncs = (const OpenGl_GlFunctions* )theGlContext->core11;
|
||||
if (aFuncs->wglDXOpenDeviceNV == NULL)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myGlD3DHandle = aFuncs->wglDXOpenDeviceNV (theD3DDevice);
|
||||
if (myGlD3DHandle == NULL)
|
||||
{
|
||||
std::cerr << "Could not create the GL <-> DirectX Interop" << std::endl;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
theGlContext->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Release
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void BridgeFBO::Release (OpenGl_Context* theGlContext)
|
||||
{
|
||||
if (myGlD3DHandle != NULL)
|
||||
{
|
||||
const OpenGl_GlFunctions* aFuncs = (const OpenGl_GlFunctions* )theGlContext->core11;
|
||||
if (myGlD3DSharedColorHandle != NULL)
|
||||
{
|
||||
aFuncs->wglDXUnregisterObjectNV (myGlD3DHandle, myGlD3DSharedColorHandle);
|
||||
myGlD3DSharedColorHandle = NULL;
|
||||
}
|
||||
|
||||
aFuncs->wglDXCloseDeviceNV (myGlD3DHandle);
|
||||
myGlD3DHandle = NULL;
|
||||
}
|
||||
|
||||
OpenGl_FrameBuffer::Release (theGlContext);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : RegisterD3DColorBuffer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean BridgeFBO::RegisterD3DColorBuffer (const Handle(OpenGl_Context)& theGlContext,
|
||||
void* theD3DBuffer,
|
||||
void* theBufferShare)
|
||||
{
|
||||
const OpenGl_GlFunctions* aFuncs = (const OpenGl_GlFunctions* )theGlContext->core11;
|
||||
if (myGlD3DSharedColorHandle != NULL)
|
||||
{
|
||||
if (!aFuncs->wglDXUnregisterObjectNV (myGlD3DHandle, myGlD3DSharedColorHandle))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
myGlD3DSharedColorHandle = NULL;
|
||||
}
|
||||
|
||||
if (!aFuncs->wglDXSetResourceShareHandleNV (theD3DBuffer, theBufferShare))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myColorTexture->Release (theGlContext.operator->());
|
||||
myColorTexture->Create (theGlContext);
|
||||
|
||||
myGlD3DSharedColorHandle = aFuncs->wglDXRegisterObjectNV (myGlD3DHandle,
|
||||
theD3DBuffer, myColorTexture->TextureId(), GL_TEXTURE_2D, WGL_ACCESS_WRITE_DISCARD_NV);
|
||||
|
||||
if (myGlD3DSharedColorHandle == NULL)
|
||||
{
|
||||
std::cerr << "Could not register color buffer" << std::endl;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Resize
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void BridgeFBO::Resize (const Handle(OpenGl_Context)& theGlContext,
|
||||
int theSizeX,
|
||||
int theSizeY)
|
||||
{
|
||||
myVPSizeX = theSizeX;
|
||||
myVPSizeY = theSizeY;
|
||||
|
||||
myDepthStencilTexture->Init (theGlContext, GL_DEPTH24_STENCIL8,
|
||||
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8,
|
||||
myVPSizeX, myVPSizeY, Graphic3d_TOT_2D);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : BindBuffer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void BridgeFBO::BindBuffer (const Handle(OpenGl_Context)& theGlContext)
|
||||
{
|
||||
if (myGlD3DSharedColorHandle != NULL)
|
||||
{
|
||||
// Lock for OpenGL
|
||||
const OpenGl_GlFunctions* aFuncs = (const OpenGl_GlFunctions* )theGlContext->core11;
|
||||
aFuncs->wglDXLockObjectsNV (myGlD3DHandle, 1, &myGlD3DSharedColorHandle);
|
||||
}
|
||||
|
||||
OpenGl_FrameBuffer::BindBuffer (theGlContext);
|
||||
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_TEXTURE_2D, myColorTexture->TextureId(), 0);
|
||||
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
|
||||
GL_TEXTURE_2D, myDepthStencilTexture->TextureId(), 0);
|
||||
if (theGlContext->arbFBO->glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
std::cerr << "Invalid FBO can not be bound!\n";
|
||||
Release (theGlContext.operator->());
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : UnbindBuffer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void BridgeFBO::UnbindBuffer (const Handle(OpenGl_Context)& theGlContext)
|
||||
{
|
||||
// Unbind the frame buffer
|
||||
OpenGl_FrameBuffer::UnbindBuffer (theGlContext);
|
||||
if (myGlD3DSharedColorHandle != NULL)
|
||||
{
|
||||
// Unlock for Direct3D
|
||||
const OpenGl_GlFunctions* aFuncs = (const OpenGl_GlFunctions* )theGlContext->core11;
|
||||
aFuncs->wglDXUnlockObjectsNV (myGlD3DHandle, 1, &myGlD3DSharedColorHandle);
|
||||
}
|
||||
}
|
@@ -1,53 +0,0 @@
|
||||
#ifndef BRIDGE_FBO_HEADER
|
||||
#define BRIDGE_FBO_HEADER
|
||||
|
||||
#include <OpenGl_GlCore20.hxx>
|
||||
#include <OpenGl_FrameBuffer.hxx>
|
||||
|
||||
//! Implements bridge FBO for direct rendering to Direct3D surfaces.
|
||||
class BridgeFBO : public OpenGl_FrameBuffer
|
||||
{
|
||||
public:
|
||||
|
||||
//! Creates new bridge FBO.
|
||||
BridgeFBO() : OpenGl_FrameBuffer()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//! Releases resources of bridge FBO.
|
||||
~BridgeFBO()
|
||||
{
|
||||
Release (NULL);
|
||||
}
|
||||
|
||||
//! Releases resources of bridge FBO.
|
||||
virtual void Release (OpenGl_Context* theGlContext);
|
||||
|
||||
//! Initializes OpenGL FBO for Direct3D interoperability.
|
||||
Standard_Boolean Init (const Handle(OpenGl_Context)& theGlContext,
|
||||
void* theD3DDevice);
|
||||
|
||||
//! Binds Direcr3D color buffer to OpenGL texture.
|
||||
Standard_Boolean RegisterD3DColorBuffer (const Handle(OpenGl_Context)& theGlContext,
|
||||
void* theD3DBuffer,
|
||||
void* theBufferShare);
|
||||
|
||||
//! Locks Direct3D objects for OpenGL drawing.
|
||||
virtual void BindBuffer (const Handle(OpenGl_Context)& theGlContext);
|
||||
|
||||
//! Unlocks Direct3D objects after OpenGL drawing.
|
||||
virtual void UnbindBuffer (const Handle(OpenGl_Context)& theGlContext);
|
||||
|
||||
//! Resizes buffer according to Direct3D surfaces.
|
||||
void Resize (const Handle(OpenGl_Context)& theGlContext,
|
||||
int theSizeX,
|
||||
int theSizeY);
|
||||
|
||||
private:
|
||||
|
||||
HANDLE myGlD3DHandle;
|
||||
HANDLE myGlD3DSharedColorHandle;
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,278 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <windows.h>
|
||||
#include <d3dx9.h>
|
||||
|
||||
using namespace System::Runtime::InteropServices;
|
||||
|
||||
typedef HRESULT (WINAPI *DIRECT3DCREATE9EX)(UINT SDKVersion, IDirect3D9Ex**);
|
||||
|
||||
LRESULT WINAPI MsgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return DefWindowProcW (hWnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
WNDCLASSEXW THE_WNDCLASS_D3D =
|
||||
{
|
||||
sizeof (WNDCLASSEXW),
|
||||
CS_CLASSDC, MsgProc, NULL, NULL,
|
||||
GetModuleHandle (NULL),
|
||||
NULL, NULL, NULL, NULL, L"D3D", NULL
|
||||
};
|
||||
|
||||
// =======================================================================
|
||||
// function : GetVertexProcessingCaps
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
DWORD GetVertexProcessingCaps (LPDIRECT3D9 theD3D)
|
||||
{
|
||||
D3DCAPS9 aCaps;
|
||||
return !SUCCEEDED (theD3D->GetDeviceCaps (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &aCaps))
|
||||
|| !(aCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT)
|
||||
? D3DCREATE_SOFTWARE_VERTEXPROCESSING
|
||||
: D3DCREATE_HARDWARE_VERTEXPROCESSING;
|
||||
}
|
||||
|
||||
//! Encapsulates state of Direct3D renderer.
|
||||
class D3DRender
|
||||
{
|
||||
public:
|
||||
|
||||
D3DRender (int theSizeX = 512,
|
||||
int theSizeY = 512)
|
||||
: D3D (NULL),
|
||||
D3DEx (NULL),
|
||||
D3DDevice (NULL),
|
||||
D3DDeviceEx (NULL),
|
||||
D3DColorSurf (NULL),
|
||||
D3DColorSurfShare (NULL),
|
||||
FuncCreate9Ex (NULL),
|
||||
WinSizeX (theSizeX),
|
||||
WinSizeY (theSizeY)
|
||||
{
|
||||
CheckRegisterClass();
|
||||
WinHandle = CreateWindowW (L"D3D", L"D3D",
|
||||
WS_OVERLAPPEDWINDOW, 0, 0, 1, 1,
|
||||
NULL, NULL, THE_WNDCLASS_D3D.hInstance, NULL);
|
||||
Init();
|
||||
}
|
||||
|
||||
~D3DRender()
|
||||
{
|
||||
// do not release class instance shared between all renderers
|
||||
//UnregisterClass (NULL, THE_WNDCLASS_D3D.hInstance);
|
||||
if (D3DDevice != NULL)
|
||||
{
|
||||
D3DDevice->Release();
|
||||
}
|
||||
if (D3DDeviceEx != NULL)
|
||||
{
|
||||
D3DDeviceEx->Release();
|
||||
}
|
||||
if (D3D != NULL)
|
||||
{
|
||||
D3D->Release();
|
||||
}
|
||||
if (D3DEx != NULL)
|
||||
{
|
||||
D3DEx->Release();
|
||||
}
|
||||
if (D3DColorSurf != NULL)
|
||||
{
|
||||
D3DColorSurf->Release();
|
||||
D3DColorSurfShare = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//! Creates Direct3D render target.
|
||||
bool CreateRenderTarget()
|
||||
{
|
||||
if (!SetWindowPos (WinHandle, 0, 0, 0, WinSizeX, WinSizeY, 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (D3DColorSurf != NULL)
|
||||
{
|
||||
D3DColorSurf->Release();
|
||||
D3DColorSurfShare = NULL;
|
||||
}
|
||||
|
||||
// Note: Render target surface should be lockable on
|
||||
// Windows XP and non-lockable on Windows Vista or higher
|
||||
if (FAILED (D3DDevice->CreateRenderTarget (WinSizeX, WinSizeY,
|
||||
D3DFMT_X8R8G8B8, D3DMULTISAMPLE_NONE, 0, FuncCreate9Ex != NULL,
|
||||
&D3DColorSurf, FuncCreate9Ex == NULL ? NULL : &D3DColorSurfShare)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
D3DDevice->SetRenderTarget (0, D3DColorSurf);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void Init()
|
||||
{
|
||||
// Vista requires the D3D "Ex" functions for optimal performance.
|
||||
// The Ex functions are only supported with WDDM drivers, so they will not be available on XP.
|
||||
HMODULE aD3D9 = GetModuleHandleW (L"d3d9");
|
||||
FuncCreate9Ex = (DIRECT3DCREATE9EX )GetProcAddress (aD3D9, "Direct3DCreate9Ex");
|
||||
|
||||
// Set up the structure used to create the D3DDevice
|
||||
D3DPRESENT_PARAMETERS aParams;
|
||||
ZeroMemory (&aParams, sizeof(aParams));
|
||||
aParams.Windowed = TRUE;
|
||||
aParams.BackBufferHeight = 1;
|
||||
aParams.BackBufferWidth = 1;
|
||||
aParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
aParams.BackBufferFormat = D3DFMT_X8R8G8B8;
|
||||
(FuncCreate9Ex != NULL) ? InitializeD3DEx (aParams) : InitializeD3D (aParams);
|
||||
}
|
||||
|
||||
bool InitializeD3D (D3DPRESENT_PARAMETERS theParams)
|
||||
{
|
||||
D3D = Direct3DCreate9 (D3D_SDK_VERSION);
|
||||
if (D3D == NULL)
|
||||
return false;
|
||||
|
||||
DWORD aVertProcessCaps = GetVertexProcessingCaps (D3D);
|
||||
HRESULT aResult = D3D->CreateDevice (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, WinHandle,
|
||||
aVertProcessCaps | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE,
|
||||
&theParams, &D3DDevice);
|
||||
return SUCCEEDED (aResult);
|
||||
}
|
||||
|
||||
bool InitializeD3DEx (D3DPRESENT_PARAMETERS theParams)
|
||||
{
|
||||
if (FAILED (FuncCreate9Ex (D3D_SDK_VERSION, &D3DEx))
|
||||
|| FAILED (D3DEx->QueryInterface (__uuidof (IDirect3D9), reinterpret_cast<void**> (&D3D))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD aVertProcessCaps = GetVertexProcessingCaps (D3D);
|
||||
if (FAILED (D3DEx->CreateDeviceEx (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, WinHandle,
|
||||
aVertProcessCaps | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE,
|
||||
&theParams, NULL, &D3DDeviceEx)))
|
||||
return false;
|
||||
|
||||
return SUCCEEDED (D3DDeviceEx->QueryInterface (__uuidof (IDirect3DDevice9), reinterpret_cast<void**> (&D3DDevice)));
|
||||
}
|
||||
|
||||
static void CheckRegisterClass()
|
||||
{
|
||||
static bool isRegistered = false;
|
||||
if (!isRegistered)
|
||||
{
|
||||
RegisterClassExW (&THE_WNDCLASS_D3D);
|
||||
isRegistered = true;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
LPDIRECT3D9 D3D;
|
||||
LPDIRECT3D9EX D3DEx;
|
||||
LPDIRECT3DDEVICE9 D3DDevice;
|
||||
LPDIRECT3DDEVICE9EX D3DDeviceEx;
|
||||
|
||||
LPDIRECT3DSURFACE9 D3DColorSurf;
|
||||
HANDLE D3DColorSurfShare;
|
||||
|
||||
DIRECT3DCREATE9EX FuncCreate9Ex;
|
||||
|
||||
HWND WinHandle;
|
||||
INT WinSizeX;
|
||||
INT WinSizeY;
|
||||
|
||||
};
|
||||
|
||||
public ref struct WndSize
|
||||
{
|
||||
public:
|
||||
|
||||
WndSize(int theSizeX, int theSizeY)
|
||||
{
|
||||
mySize = new SIZE();
|
||||
mySize->cx = theSizeX;
|
||||
mySize->cy = theSizeY;
|
||||
}
|
||||
|
||||
~WndSize()
|
||||
{
|
||||
delete mySize;
|
||||
}
|
||||
|
||||
property int cx
|
||||
{
|
||||
int get() { return mySize->cx; }
|
||||
}
|
||||
|
||||
property int cy
|
||||
{
|
||||
int get() { return mySize->cy; }
|
||||
}
|
||||
|
||||
LPSIZE GetPointer()
|
||||
{
|
||||
return mySize;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
LPSIZE mySize;
|
||||
};
|
||||
|
||||
public ref class Direct3DProxy
|
||||
{
|
||||
public :
|
||||
|
||||
Direct3DProxy()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : InitializeScene
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
static System::IntPtr InitRender ([Out] System::IntPtr% theWinHandle,
|
||||
[Out] System::IntPtr% theD3DDevice)
|
||||
{
|
||||
D3DRender* aRender = new D3DRender();
|
||||
theWinHandle = System::IntPtr(aRender->WinHandle);
|
||||
theD3DDevice = System::IntPtr(aRender->D3DDevice);
|
||||
|
||||
return System::IntPtr(aRender);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ResizeWindow
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
static void ResizeWindow ([In] System::IntPtr% theRender,
|
||||
[In] WndSize^% theWndSize,
|
||||
[Out] System::IntPtr% theColorSurf,
|
||||
[Out] System::IntPtr% theColorSurfShare)
|
||||
{
|
||||
D3DRender* aRender = reinterpret_cast<D3DRender*> (theRender.ToPointer());
|
||||
LPSIZE aSize = theWndSize->GetPointer();
|
||||
aRender->WinSizeX = aSize->cx;
|
||||
aRender->WinSizeY = aSize->cy;
|
||||
aRender->CreateRenderTarget();
|
||||
|
||||
theColorSurf = System::IntPtr(aRender->D3DColorSurf);
|
||||
theColorSurfShare = System::IntPtr(aRender->D3DColorSurfShare);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ReleaseRender
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
static void ReleaseRender ([In] System::IntPtr% theRender)
|
||||
{
|
||||
D3DRender* aRender = reinterpret_cast<D3DRender*> (theRender.ToPointer());
|
||||
delete aRender;
|
||||
}
|
||||
};
|
@@ -1,16 +1,15 @@
|
||||
#include "BridgeFBO.hxx"
|
||||
#include <windows.h>
|
||||
|
||||
// include required OCCT headers
|
||||
#include <Standard_Version.hxx>
|
||||
#include <Message_ProgressIndicator.hxx>
|
||||
//for OCC graphic
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
#include <WNT_WClass.hxx>
|
||||
#include <Graphic3d_CView.hxx>
|
||||
#include <Graphic3d_Camera.hxx>
|
||||
#include <Graphic3d_TextureParams.hxx>
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
#include <OpenGl_CView.hxx>
|
||||
#include <D3DHost_GraphicDriver.hxx>
|
||||
//for object display
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
@@ -47,11 +46,14 @@
|
||||
#pragma comment(lib, "TKService.lib")
|
||||
#pragma comment(lib, "TKV3d.lib")
|
||||
#pragma comment(lib, "TKOpenGl.lib")
|
||||
#pragma comment(lib, "TKD3dHost.lib")
|
||||
#pragma comment(lib, "TKIGES.lib")
|
||||
#pragma comment(lib, "TKSTEP.lib")
|
||||
#pragma comment(lib, "TKStl.lib")
|
||||
#pragma comment(lib, "TKVrml.lib")
|
||||
|
||||
#pragma comment(lib, "D3D9.lib")
|
||||
|
||||
/// <summary>
|
||||
/// Proxy class encapsulating calls to OCCT C++ classes within
|
||||
/// C++/CLI class visible from .Net (CSharp)
|
||||
@@ -60,10 +62,7 @@ public ref class OCCTProxyD3D
|
||||
{
|
||||
public:
|
||||
|
||||
OCCTProxyD3D() : myBridgeFBO (NULL)
|
||||
{
|
||||
//
|
||||
}
|
||||
OCCTProxyD3D() {}
|
||||
|
||||
// ============================================
|
||||
// Viewer functionality
|
||||
@@ -73,9 +72,10 @@ public:
|
||||
///Initialize a viewer
|
||||
/// </summary>
|
||||
/// <param name="theWnd">System.IntPtr that contains the window handle (HWND) of the control</param>
|
||||
bool InitViewer (System::IntPtr theWnd)
|
||||
bool InitViewer()
|
||||
{
|
||||
myGraphicDriver() = new OpenGl_GraphicDriver (Handle(Aspect_DisplayConnection)());
|
||||
myGraphicDriver() = new D3DHost_GraphicDriver();
|
||||
myGraphicDriver()->ChangeOptions().buffersNoSwap = true;
|
||||
//myGraphicDriver()->ChangeOptions().contextDebug = true;
|
||||
|
||||
TCollection_ExtendedString a3DName ("Visu3D");
|
||||
@@ -87,76 +87,26 @@ public:
|
||||
myViewer()->SetDefaultLights();
|
||||
myViewer()->SetLightOn();
|
||||
myView() = myViewer()->CreateView();
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window (reinterpret_cast<HWND> (theWnd.ToPointer()));
|
||||
|
||||
static Handle(WNT_WClass) aWClass = new WNT_WClass ("OCC_Viewer", NULL, CS_OWNDC);
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window ("OCC_Viewer", aWClass, WS_POPUP, 64, 64, 64, 64);
|
||||
aWNTWindow->SetVirtual (Standard_True);
|
||||
myView()->SetWindow(aWNTWindow);
|
||||
if (!aWNTWindow->IsMapped())
|
||||
{
|
||||
aWNTWindow->Map();
|
||||
}
|
||||
myAISContext() = new AIS_InteractiveContext (myViewer());
|
||||
myAISContext()->UpdateCurrentViewer();
|
||||
myView()->MustBeResized();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary> Initializes OCCT viewer for OpenGL-Direct3D interoperability. </summary>
|
||||
bool InitViewer (System::IntPtr theHWND,
|
||||
System::IntPtr theD3DDevice)
|
||||
{
|
||||
if (!InitViewer (theHWND))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Graphic3d_CView* aCView = reinterpret_cast<Graphic3d_CView*> (myView()->View()->CView());
|
||||
OpenGl_CView* aCViewGl = reinterpret_cast<OpenGl_CView*> (aCView->ptrView);
|
||||
Handle(OpenGl_Context) aGlContext = aCViewGl->WS->GetGlContext();
|
||||
if (aGlContext.IsNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!aGlContext->IsCurrent())
|
||||
{
|
||||
aGlContext->MakeCurrent();
|
||||
}
|
||||
|
||||
myBridgeFBO = new BridgeFBO();
|
||||
if (!myBridgeFBO->Init (aGlContext, theD3DDevice.ToPointer()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
aCView->ptrFBO = myBridgeFBO;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary> Resizes custom FBO for Direct3D output. </summary>
|
||||
bool ResizeBridgeFBO (int theWinSizeX,
|
||||
int theWinSizeY,
|
||||
System::IntPtr theColorSurf,
|
||||
System::IntPtr theColorSurfShare)
|
||||
System::IntPtr ResizeBridgeFBO (int theWinSizeX,
|
||||
int theWinSizeY)
|
||||
{
|
||||
if (myBridgeFBO == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OpenGl_CView* aCView = reinterpret_cast<OpenGl_CView*> (reinterpret_cast<Graphic3d_CView*> (myView()->View()->CView())->ptrView);
|
||||
Handle(OpenGl_Context) aGlContext = aCView->WS->GetGlContext();
|
||||
if (aGlContext.IsNull()
|
||||
|| !aGlContext->MakeCurrent())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
myBridgeFBO->Resize (aGlContext, theWinSizeX, theWinSizeY);
|
||||
if (!myBridgeFBO->RegisterD3DColorBuffer (aGlContext, theColorSurf.ToPointer(), theColorSurfShare.ToPointer()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
myView()->Camera()->SetAspect (Standard_Real (theWinSizeX) / Standard_Real (theWinSizeY));
|
||||
return true;
|
||||
Handle(WNT_Window) aWNTWindow = Handle(WNT_Window)::DownCast (myView()->Window());
|
||||
aWNTWindow->SetPos (0, 0, theWinSizeX, theWinSizeY);
|
||||
myView()->MustBeResized();
|
||||
myView()->Invalidate();
|
||||
return System::IntPtr(myGraphicDriver()->D3dColorSurface (myView()->View()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -729,33 +679,6 @@ public:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///Create new view
|
||||
/// </summary>
|
||||
/// <param name="theWnd">System.IntPtr that contains the window handle (HWND) of the control</param>
|
||||
void CreateNewView (System::IntPtr theWnd)
|
||||
{
|
||||
if (myAISContext().IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myView() = myAISContext()->CurrentViewer()->CreateView();
|
||||
if (myGraphicDriver().IsNull())
|
||||
{
|
||||
myGraphicDriver() = new OpenGl_GraphicDriver (Handle(Aspect_DisplayConnection)());
|
||||
//myGraphicDriver()->ChangeOptions().contextDebug = true;
|
||||
}
|
||||
Handle(WNT_Window) aWNTWindow = new WNT_Window (reinterpret_cast<HWND> (theWnd.ToPointer()));
|
||||
myView()->SetWindow (aWNTWindow);
|
||||
Standard_Integer aWidth = 100, aHeight = 100;
|
||||
aWNTWindow->Size (aWidth, aHeight);
|
||||
if (!aWNTWindow->IsMapped())
|
||||
{
|
||||
aWNTWindow->Map();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///Set AISContext
|
||||
/// </summary>
|
||||
@@ -1047,7 +970,6 @@ private:
|
||||
NCollection_Haft<Handle_V3d_Viewer> myViewer;
|
||||
NCollection_Haft<Handle_V3d_View> myView;
|
||||
NCollection_Haft<Handle_AIS_InteractiveContext> myAISContext;
|
||||
NCollection_Haft<Handle_OpenGl_GraphicDriver> myGraphicDriver;
|
||||
BridgeFBO* myBridgeFBO; //!< Provides output to Direct3D buffers
|
||||
NCollection_Haft<Handle_D3DHost_GraphicDriver> myGraphicDriver;
|
||||
|
||||
};
|
||||
|
@@ -348,10 +348,6 @@
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\BridgeFBO.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OCCTProxyD3D.cpp"
|
||||
>
|
||||
@@ -362,10 +358,6 @@
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\BridgeFBO.hxx"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
|
@@ -190,13 +190,8 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="BridgeFBO.cxx" />
|
||||
<ClCompile Include="Direct3DProxy.cpp" />
|
||||
<ClCompile Include="OCCTProxyD3D.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="BridgeFBO.hxx" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
@@ -11,9 +11,6 @@ namespace IE_WPF_D3D
|
||||
/// </summary>
|
||||
class D3DViewer
|
||||
{
|
||||
/// <summary> Direct3D renderer. </summary>
|
||||
private IntPtr myD3DRender;
|
||||
|
||||
/// <summary> Direct3D output image. </summary>
|
||||
private D3DImage myD3DImage = new D3DImage ();
|
||||
|
||||
@@ -60,24 +57,14 @@ namespace IE_WPF_D3D
|
||||
|
||||
if (myD3DImage.IsFrontBufferAvailable)
|
||||
{
|
||||
IntPtr aWinHandle;
|
||||
IntPtr aD3DDevice;
|
||||
|
||||
// Initialize Direct3D device and render target
|
||||
myD3DRender = Direct3DProxy.InitRender(out aWinHandle, out aD3DDevice);
|
||||
|
||||
Viewer = new OCCViewer();
|
||||
|
||||
if (!Viewer.InitInterop (aWinHandle, aD3DDevice))
|
||||
if (!Viewer.InitViewer())
|
||||
{
|
||||
MessageBox.Show ("Failed to initialize OpenGL-Direct3D interoperability!",
|
||||
"Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
|
||||
myIsFailed = true;
|
||||
|
||||
if (myD3DRender != IntPtr.Zero)
|
||||
Direct3DProxy.ReleaseRender(ref myD3DRender);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -87,32 +74,28 @@ namespace IE_WPF_D3D
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Initializes Direct3D-OCCT rendering. </summary>
|
||||
/// <summary> Releases Direct3D-OCCT rendering. </summary>
|
||||
public void StopRenderingScene ()
|
||||
{
|
||||
// This method is called when WPF loses its Direct3D device,
|
||||
// so we should just release our custom Direct3D scene
|
||||
CompositionTarget.Rendering -= OnRendering;
|
||||
|
||||
if (myD3DRender != IntPtr.Zero)
|
||||
Direct3DProxy.ReleaseRender(ref myD3DRender);
|
||||
|
||||
myColorSurf = IntPtr.Zero;
|
||||
}
|
||||
|
||||
/// <summary> Initializes Direct3D-OCCT rendering. </summary>
|
||||
/// <summary> Performs Direct3D-OCCT rendering. </summary>
|
||||
private void OnRendering (object sender, EventArgs e)
|
||||
{
|
||||
UpdateScene ();
|
||||
}
|
||||
|
||||
/// <summary> Current size of rendering window. </summary>
|
||||
private WndSize mySize = new WndSize(1, 1);
|
||||
|
||||
/// <summary> Initializes Direct3D-OCCT rendering. </summary>
|
||||
/// <summary> Performs Direct3D-OCCT rendering. </summary>
|
||||
private void UpdateScene ()
|
||||
{
|
||||
if (!myIsFailed && myD3DImage.IsFrontBufferAvailable && myColorSurf != IntPtr.Zero)
|
||||
if (!myIsFailed
|
||||
&& myD3DImage.IsFrontBufferAvailable
|
||||
&& myColorSurf != IntPtr.Zero
|
||||
&& (myD3DImage.PixelWidth != 0 && myD3DImage.PixelHeight != 0))
|
||||
{
|
||||
myD3DImage.Lock ();
|
||||
{
|
||||
@@ -120,7 +103,7 @@ namespace IE_WPF_D3D
|
||||
Viewer.View.RedrawView ();
|
||||
|
||||
// Invalidate the updated region of the D3DImage
|
||||
myD3DImage.AddDirtyRect(new Int32Rect(0, 0, mySize.cx, mySize.cy));
|
||||
myD3DImage.AddDirtyRect(new Int32Rect(0, 0, myD3DImage.PixelWidth, myD3DImage.PixelHeight));
|
||||
}
|
||||
myD3DImage.Unlock ();
|
||||
}
|
||||
@@ -129,23 +112,16 @@ namespace IE_WPF_D3D
|
||||
/// <summary> Resizes Direct3D surfaces and OpenGL FBO. </summary>
|
||||
public void Resize (int theSizeX, int theSizeY)
|
||||
{
|
||||
mySize = new WndSize(theSizeX, theSizeY);
|
||||
|
||||
if (!myIsFailed && myD3DImage.IsFrontBufferAvailable)
|
||||
{
|
||||
IntPtr aColorSurfShare;
|
||||
|
||||
// Initialize Direct3D device and render target
|
||||
Direct3DProxy.ResizeWindow(ref myD3DRender, ref mySize, out myColorSurf, out aColorSurfShare);
|
||||
|
||||
// Set the back buffer for Direct3D WPF image
|
||||
myD3DImage.Lock ();
|
||||
{
|
||||
myD3DImage.SetBackBuffer (D3DResourceType.IDirect3DSurface9, IntPtr.Zero);
|
||||
myColorSurf = Viewer.View.ResizeBridgeFBO (theSizeX, theSizeY);
|
||||
myD3DImage.SetBackBuffer (D3DResourceType.IDirect3DSurface9, myColorSurf);
|
||||
}
|
||||
myD3DImage.Unlock ();
|
||||
|
||||
Viewer.View.ResizeBridgeFBO(mySize.cx, mySize.cy, myColorSurf, aColorSurfShare);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -161,7 +161,7 @@ namespace IE_WPF_D3D
|
||||
|
||||
ImageBrush anImage = new ImageBrush (aViwer.Image);
|
||||
|
||||
anImage.RelativeTransform = new ScaleTransform (1.0, -1.0, 0.5, 0.5);
|
||||
//anImage.RelativeTransform = new ScaleTransform (1.0, -1.0, 0.5, 0.5);
|
||||
|
||||
g.Background = anImage;
|
||||
g.MouseMove += new MouseEventHandler (g_MouseMove);
|
||||
|
@@ -87,9 +87,9 @@ namespace IE_WPF_D3D
|
||||
DegenerateMode = true;
|
||||
}
|
||||
|
||||
public bool InitInterop (IntPtr theHWND, IntPtr theD3DDevice)
|
||||
public bool InitViewer()
|
||||
{
|
||||
return View.InitViewer (theHWND, theD3DDevice);
|
||||
return View.InitViewer();
|
||||
}
|
||||
|
||||
public void ImportModel (ModelFormat theFormat)
|
||||
|
@@ -1,12 +1,18 @@
|
||||
@echo off
|
||||
|
||||
if NOT DEFINED DXSDK_DIR (
|
||||
echo ERROR: DirectX SDK is required in order to build the sample but it is not found in your system. Please install DirectX SDK and retry.
|
||||
exit /B
|
||||
)
|
||||
|
||||
call "%~dp0..\..\env.bat" %1 %2 %3
|
||||
|
||||
if NOT DEFINED DXSDK_DIR (
|
||||
if "%VCVER%" == "vc9" (
|
||||
echo ERROR: DirectX SDK is required in order to build the sample but it is not found in your system. Please install DirectX SDK and retry.
|
||||
exit /B
|
||||
)
|
||||
if "%VCVER%" == "vc10" (
|
||||
echo ERROR: DirectX SDK is required in order to build the sample but it is not found in your system. Please install DirectX SDK and retry.
|
||||
exit /B
|
||||
)
|
||||
)
|
||||
|
||||
if ["%CASDEB%"] == [""] (
|
||||
call "%~dp0..\..\msvc.bat" %VCVER% win%ARCH% Release %~dp0\CSharp_D3D.sln
|
||||
) else (
|
||||
|
@@ -293,7 +293,7 @@ void CViewer2dDoc::OnBUTTONTestRect()
|
||||
Handle_AIS_Shape aRect2 = new AIS_Shape(W2);
|
||||
myAISContext->Display(aRect2);
|
||||
myAISContext->SetColor(aRect2,Quantity_NOC_YELLOW);
|
||||
myAISContext->SetSelectionMode(aRect2,2);
|
||||
myAISContext->Activate(aRect2,2);
|
||||
|
||||
FitAll2DViews(Standard_True); // Update Viewer
|
||||
}
|
||||
|
@@ -34,7 +34,6 @@ AIS_InteractiveObject(PrsMgr_TOP_ProjectorDependant)
|
||||
BRepPrimAPI_MakeCylinder S(R,H);
|
||||
myShape = S.Shape();
|
||||
SetHilightMode(0);
|
||||
SetSelectionMode(0);
|
||||
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
|
||||
myPlanarFaceColor = Quantity_NOC_FIREBRICK3;
|
||||
myCylindricalFaceColor = Quantity_NOC_GRAY;
|
||||
@@ -48,7 +47,6 @@ AIS_InteractiveObject(PrsMgr_TOP_ProjectorDependant)
|
||||
BRepBuilderAPI_NurbsConvert aNurbsConvert(S.Shape());
|
||||
myShape = aNurbsConvert.Shape();
|
||||
SetHilightMode(0);
|
||||
SetSelectionMode(0);
|
||||
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
|
||||
myPlanarFaceColor = Quantity_NOC_FIREBRICK3;
|
||||
myCylindricalFaceColor = Quantity_NOC_KHAKI4;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include "Voxel_VisData.h"
|
||||
#include <Graphic3d_BndBox4f.hxx>
|
||||
|
||||
class Handle(OpenGl_GraphicDriver);
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
|
||||
class VoxelClient_VisDrawer
|
||||
{
|
||||
|
@@ -322,6 +322,8 @@ Application::Application()
|
||||
VoxelClient_VisDrawer::Init(myViewer->getGraphicDriver());
|
||||
|
||||
resize( 450, 600 );
|
||||
|
||||
myViewer->getIC()->SetAutoActivateSelection (Standard_False);
|
||||
}
|
||||
|
||||
Application::~Application()
|
||||
@@ -1932,7 +1934,6 @@ void Application::load(const TopoDS_Shape& S)
|
||||
{
|
||||
myShape = new AIS_Shape(S);
|
||||
myShape->SetDisplayMode(1);
|
||||
myShape->UnsetSelectionMode();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2163,34 +2164,6 @@ void Application::displayCollisions()
|
||||
aisS25->SetDisplayMode(1);
|
||||
aisS26->SetDisplayMode(1);
|
||||
aisS27->SetDisplayMode(1);
|
||||
aisB-> UnsetSelectionMode();
|
||||
aisS1-> UnsetSelectionMode();
|
||||
aisS2-> UnsetSelectionMode();
|
||||
aisS3-> UnsetSelectionMode();
|
||||
aisS4-> UnsetSelectionMode();
|
||||
aisS5-> UnsetSelectionMode();
|
||||
aisS6-> UnsetSelectionMode();
|
||||
aisS7-> UnsetSelectionMode();
|
||||
aisS8-> UnsetSelectionMode();
|
||||
aisS9-> UnsetSelectionMode();
|
||||
aisS10->UnsetSelectionMode();
|
||||
aisS11->UnsetSelectionMode();
|
||||
aisS12->UnsetSelectionMode();
|
||||
aisS13->UnsetSelectionMode();
|
||||
aisS14->UnsetSelectionMode();
|
||||
aisS15->UnsetSelectionMode();
|
||||
aisS16->UnsetSelectionMode();
|
||||
aisS17->UnsetSelectionMode();
|
||||
aisS18->UnsetSelectionMode();
|
||||
aisS19->UnsetSelectionMode();
|
||||
aisS20->UnsetSelectionMode();
|
||||
aisS21->UnsetSelectionMode();
|
||||
aisS22->UnsetSelectionMode();
|
||||
aisS23->UnsetSelectionMode();
|
||||
aisS24->UnsetSelectionMode();
|
||||
aisS25->UnsetSelectionMode();
|
||||
aisS26->UnsetSelectionMode();
|
||||
aisS27->UnsetSelectionMode();
|
||||
aisS1-> SetTransparency(2.0 * transparency / 3.0);
|
||||
aisS2-> SetTransparency(transparency);
|
||||
aisS3-> SetTransparency(transparency);
|
||||
|
78
samples/tcl/pathtrace.tcl
Normal file
78
samples/tcl/pathtrace.tcl
Normal file
@@ -0,0 +1,78 @@
|
||||
#########################################################################
|
||||
# 26437: Visualization - Improve path tracing rendering engine
|
||||
#########################################################################
|
||||
|
||||
pload ALL
|
||||
|
||||
# setup 3D viewer content
|
||||
vinit name=View1 w=512 h=512
|
||||
vglinfo
|
||||
|
||||
vvbo 0
|
||||
vsetdispmode 1
|
||||
vcamera -persp
|
||||
|
||||
box b 1 1 1
|
||||
explode b FACE
|
||||
vdisplay b_1 b_2 b_3 b_5 b_6
|
||||
|
||||
vright
|
||||
vfit
|
||||
|
||||
vsetmaterial b_1 plastic
|
||||
vsetmaterial b_2 plastic
|
||||
vsetmaterial b_3 plastic
|
||||
vsetmaterial b_5 plastic
|
||||
vsetmaterial b_6 plastic
|
||||
|
||||
vbsdf b_1 -kd 1 -ks 0
|
||||
vbsdf b_2 -kd 1 -ks 0
|
||||
vbsdf b_3 -kd 1 -ks 0
|
||||
vbsdf b_5 -kd 1 -ks 0
|
||||
vbsdf b_6 -kd 1 -ks 0
|
||||
|
||||
vbsdf b_2 -kd 0.3 0.5 1
|
||||
vbsdf b_1 -kd 1 0.3 0.3
|
||||
|
||||
vsetlocation b_1 1 0 0
|
||||
vsetlocation b_2 -1 0 0
|
||||
vsetlocation b_5 0 0 1
|
||||
vsetlocation b_6 0 0 -1
|
||||
vsetlocation b_3 0 1 0
|
||||
|
||||
vlight del 0
|
||||
vlight del 1
|
||||
vlight add positional head 0 pos 0.5 0.5 0.85
|
||||
vlight change 0 sm 0.06
|
||||
vlight change 0 int 60.0
|
||||
|
||||
psphere s 0.2
|
||||
vdisplay s
|
||||
vsetlocation s 0.21 0.3 0.2
|
||||
vsetmaterial s glass
|
||||
vbsdf s -absorpcolor 0.8 0.8 1.0
|
||||
vbsdf s -absorpcoeff 6
|
||||
|
||||
box c 0.3 0.3 0.2
|
||||
vdisplay c
|
||||
vsetlocation c 0.55 0.3 0.0
|
||||
vlocrotate c 0 0 0 0 0 1 -30
|
||||
vsetmaterial c plastic
|
||||
vbsdf c -kd 1.0 0.8 0.2 -ks 0.3 -n
|
||||
|
||||
box g 0.15 0.15 0.3
|
||||
vdisplay g
|
||||
vsetlocation g 0.7 0.25 0.2
|
||||
vlocrotate g 0 0 0 0 0 1 10
|
||||
vsetmaterial g glass
|
||||
vbsdf g -absorpcolor 0.8 1.0 0.8
|
||||
vbsdf g -absorpcoeff 6
|
||||
|
||||
psphere r 0.1
|
||||
vdisplay r
|
||||
vsetmaterial r plastic
|
||||
vbsdf r -kd 0.5 0.9 0.3 -ks 0.0 -kr 0.3 -n
|
||||
vbsdf r -fresnel Constant 1.0
|
||||
vsetlocation r 0.5 0.65 0.1
|
||||
|
||||
vrenderparams -ray -gi -rayDepth 8
|
@@ -143,6 +143,10 @@ void AIS_InteractiveContext::Delete() const
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anObj = anObjIter.Key();
|
||||
anObj->SetContext (aNullContext);
|
||||
for (anObj->Init(); anObj->More(); anObj->Next())
|
||||
{
|
||||
anObj->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Renew);
|
||||
}
|
||||
}
|
||||
MMgt_TShared::Delete();
|
||||
}
|
||||
@@ -1069,7 +1073,44 @@ Standard_Boolean AIS_InteractiveContext::IsHilighted(const Handle(AIS_Interactiv
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsHilighted
|
||||
//purpose : Returns true if the objects global status is set to highlighted.
|
||||
// theIsCustomColor flag defines if highlight color is not equal to OCCT's
|
||||
// default Quantity_NOC_WHITE color. If theIsCustomColor is true,
|
||||
// custom highlight color name will be stored to theCustomColorName
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_InteractiveContext::IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
Standard_Boolean& theIsCustomColor,
|
||||
Quantity_NameOfColor& theCustomColorName) const
|
||||
{
|
||||
if (theOwner.IsNull() || !theOwner->HasSelectable())
|
||||
return Standard_False;
|
||||
|
||||
const Handle(AIS_InteractiveObject) anObj =
|
||||
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||
|
||||
if (!myObjects.IsBound (anObj))
|
||||
return Standard_False;
|
||||
|
||||
const Handle(AIS_GlobalStatus)& anObjStatus = myObjects (anObj);
|
||||
if (anObjStatus->IsHilighted())
|
||||
{
|
||||
if (anObjStatus->HilightColor() != Quantity_NOC_WHITE)
|
||||
{
|
||||
theIsCustomColor = Standard_True;
|
||||
theCustomColorName = anObjStatus->HilightColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
theIsCustomColor = Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDisplayed
|
||||
@@ -1541,6 +1582,12 @@ void AIS_InteractiveContext::SetDisplayMode (const AIS_DisplayMode theMode,
|
||||
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
|
||||
{
|
||||
myMainPM->Display (anObj, theMode);
|
||||
if (!myLastPicked.IsNull() && myLastPicked->Selectable() == anObj)
|
||||
{
|
||||
myMainPM->BeginImmediateDraw();
|
||||
myMainPM->Unhighlight (anObj, myDisplayMode);
|
||||
myMainPM->EndImmediateDraw (myMainVwr);
|
||||
}
|
||||
if (aStatus->IsSubIntensityOn())
|
||||
{
|
||||
myMainPM->Color (anObj, mySubIntensity, theMode);
|
||||
@@ -2074,6 +2121,19 @@ void AIS_InteractiveContext::SetWidth (const Handle(AIS_InteractiveObject)& theI
|
||||
|
||||
theIObj->SetWidth (theWidth);
|
||||
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
||||
if (!myLastinMain.IsNull() && myLastinMain->Selectable() == theIObj)
|
||||
{
|
||||
if (myLastinMain->IsAutoHilight())
|
||||
{
|
||||
const Standard_Integer aHiMode =
|
||||
theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
|
||||
myLastinMain->HilightWithColor (myMainPM, myLastinMain->IsSelected() ? mySelectionColor : myHilightColor, aHiMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
theIObj->HilightOwnerWithColor (myMainPM, myLastinMain->IsSelected() ? mySelectionColor : myHilightColor, myLastinMain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -2290,7 +2350,6 @@ void AIS_InteractiveContext::Status (const Handle(AIS_InteractiveObject)& theIOb
|
||||
theStatus += TCollection_AsciiString (aDispModeIter.Value());
|
||||
theStatus += "\n";
|
||||
}
|
||||
if (IsCurrent (theIObj)) theStatus +="\t| Current\n";
|
||||
if (IsSelected(theIObj)) theStatus +="\t| Selected\n";
|
||||
|
||||
theStatus += "\t| Active Selection Modes in the MainViewer :\n";
|
||||
@@ -2323,7 +2382,7 @@ void AIS_InteractiveContext::GetDefModes (const Handle(AIS_InteractiveObject)& t
|
||||
? myDisplayMode
|
||||
: 0);
|
||||
theHiMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
|
||||
theSelMode = theIObj->HasSelectionMode() ? theIObj->SelectionMode() : -1;
|
||||
theSelMode = theIObj->GlobalSelectionMode();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -2365,7 +2424,7 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
|
||||
}
|
||||
|
||||
if (IsCurrent (theIObj)
|
||||
if (IsSelected (theIObj)
|
||||
&& !aStatus->IsDModeIn (aDispMode))
|
||||
{
|
||||
myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
|
||||
@@ -2375,6 +2434,7 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
{
|
||||
mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
|
||||
}
|
||||
aStatus->ClearSelectionModes();
|
||||
aStatus->SetGraphicStatus (AIS_DS_Erased);
|
||||
|
||||
if (theToUpdateviewer)
|
||||
@@ -2383,6 +2443,31 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : unhighlightOwners
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject)
|
||||
{
|
||||
Handle(AIS_Selection) aSel = AIS_Selection::Selection (myCurrentName.ToCString());
|
||||
aSel->Init();
|
||||
while (aSel->More())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anOwner =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Value());
|
||||
if (anOwner->Selectable() == theObject)
|
||||
{
|
||||
if (anOwner->IsSelected())
|
||||
{
|
||||
AddOrRemoveSelected (anOwner, Standard_False);
|
||||
aSel->Init();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
aSel->Next();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ClearGlobal
|
||||
//purpose :
|
||||
@@ -2401,27 +2486,11 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
}
|
||||
|
||||
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
|
||||
unhighlightOwners (theIObj);
|
||||
for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
|
||||
{
|
||||
if (aStatus->IsHilighted())
|
||||
{
|
||||
if (IsCurrent (theIObj))
|
||||
{
|
||||
AddOrRemoveCurrentObject (theIObj, theToUpdateviewer);
|
||||
}
|
||||
else if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
|
||||
{
|
||||
myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
|
||||
}
|
||||
}
|
||||
myMainPM->Erase (theIObj, aDispModeIter.Value());
|
||||
myMainPM->Clear (theIObj, aDispModeIter.Value());
|
||||
if (theIObj->HasHilightMode())
|
||||
{
|
||||
Standard_Integer im = theIObj->HilightMode();
|
||||
myMainPM->Unhighlight (theIObj, im);
|
||||
myMainPM->Erase (theIObj, im);
|
||||
}
|
||||
}
|
||||
|
||||
// Object removes from Detected sequence
|
||||
@@ -2435,15 +2504,6 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
}
|
||||
}
|
||||
|
||||
if (myLastinMain == theIObj)
|
||||
{
|
||||
myLastinMain.Nullify();
|
||||
}
|
||||
if (myLastPicked == theIObj)
|
||||
{
|
||||
myLastPicked.Nullify();
|
||||
}
|
||||
|
||||
// remove IO from the selection manager to avoid memory leaks
|
||||
const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity
|
||||
mgrSelector->Remove (anObj);
|
||||
@@ -2455,8 +2515,13 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
myMainVwr->DefinedView()->View()->ChangeHiddenObjects()->Remove (theIObj.get());
|
||||
}
|
||||
|
||||
if (theToUpdateviewer
|
||||
&& aStatus->GraphicStatus() == AIS_DS_Displayed)
|
||||
if (!myLastinMain.IsNull() && myLastinMain->Selectable() == theIObj)
|
||||
myLastinMain.Nullify();
|
||||
if (!myLastPicked.IsNull() && myLastPicked->Selectable() == theIObj)
|
||||
myLastPicked.Nullify();
|
||||
myMainPM->ClearImmediateDraw();
|
||||
|
||||
if (theToUpdateviewer && aStatus->GraphicStatus() == AIS_DS_Displayed)
|
||||
{
|
||||
myMainVwr->Update();
|
||||
}
|
||||
@@ -2599,25 +2664,6 @@ Standard_Boolean AIS_InteractiveContext::IsoOnPlane() const
|
||||
return myDefaultDrawer->IsoOnPlane();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetSelectionMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::SetSelectionMode (const Handle(AIS_InteractiveObject)& ,
|
||||
const Standard_Integer )
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UnsetSelectionMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::UnsetSelectionMode (const Handle(AIS_InteractiveObject)& )
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPixelTolerance
|
||||
//purpose : Disables the mechanism of adaptive tolerance calculation in
|
||||
|
@@ -94,7 +94,7 @@ DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, MMgt_TShared)
|
||||
//! - working on only a few objects,
|
||||
//! - working on a single object.
|
||||
//! 1. When you want ot work on one type of entity, you
|
||||
//! should open a local context with the option
|
||||
//! may open a local context with the option
|
||||
//! UseDisplayedObjects set to false. DisplayedObjects
|
||||
//! allows you to recover the visualized Interactive
|
||||
//! Objects which have a given Type and
|
||||
@@ -124,6 +124,14 @@ DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, MMgt_TShared)
|
||||
//! of setting up the different contexts of
|
||||
//! selection/presentation according to the operation
|
||||
//! which you want to perform.
|
||||
|
||||
//! Selection of parts of the objects can also be done without opening a local context.
|
||||
//! Interactive context itself supports decomposed object selection with selection filters
|
||||
//! support. Note that each selectable object must specify the selection mode that is
|
||||
//! responsible for selection of object as a whole (global selection mode). By default, global
|
||||
//! selection mode is equal to 0, but it might be redefined if needed. Sub-part selection
|
||||
//! of the objects without using local context provides a possibility to activate part
|
||||
//! selection modes along with global selection mode.
|
||||
class AIS_InteractiveContext : public MMgt_TShared
|
||||
{
|
||||
|
||||
@@ -353,17 +361,7 @@ public:
|
||||
//! Object returns to the default selection mode; the
|
||||
//! object is displayed but no viewer will be updated.
|
||||
Standard_EXPORT void UnsetDisplayMode (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
|
||||
//! Sets the selection mode of Interactive Objects.
|
||||
//! aMode provides the selection mode index of the entity aniobj.
|
||||
Standard_EXPORT void SetSelectionMode (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode);
|
||||
|
||||
|
||||
//! Removes selection mode from Interactive Objects.
|
||||
//! aMode provides the selection mode index of the entity aniobj.
|
||||
Standard_EXPORT void UnsetSelectionMode (const Handle(AIS_InteractiveObject)& aniobj);
|
||||
|
||||
//! Disables the mechanism of adaptive tolerance calculation in SelectMgr_ViewerSelector and
|
||||
//! sets the given tolerance for ALL sensitive entities activated. For more information, see
|
||||
//! SelectMgr_ViewerSelector documentation
|
||||
@@ -564,7 +562,12 @@ public:
|
||||
//! <WithColor> will be returned TRUE
|
||||
//! <theHiCol> gives the name of the hilightcolor
|
||||
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& anIobj, Standard_Boolean& WithColor, Quantity_NameOfColor& theHiCol) const;
|
||||
|
||||
|
||||
//! if <theOwner> is hilighted with a specific color, than <theIsCustomColor> will be set
|
||||
//! to true and <theCustomColorName> will have the name of the color stored
|
||||
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
Standard_Boolean& theIsCustomColor,
|
||||
Quantity_NameOfColor& theCustomColorName) const;
|
||||
|
||||
//! Returns the display priority of the entity anIobj. This
|
||||
//! will be display mode of anIobj if it is in the main
|
||||
@@ -894,7 +897,9 @@ public:
|
||||
//! Return value specified whether selected object must be hilighted
|
||||
//! when mouse cursor is moved above it
|
||||
Standard_Boolean ToHilightSelected() const;
|
||||
|
||||
|
||||
|
||||
//! @name OBSOLETE METHODS THAT ARE VALID FOR LOCAL CONTEXT ONLY
|
||||
|
||||
//! Updates the view of the current object in open context.
|
||||
//! Objects selected when there is no open local context
|
||||
@@ -907,16 +912,12 @@ public:
|
||||
Standard_EXPORT void SetCurrentObject (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
|
||||
//! Allows you to add a current object to the list of current
|
||||
//! objects or remove it from that list.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
//! If a local context is open and if updateviewer equals
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
|
||||
//! Allows to add or remove the object given to the list of current and highlight/unhighlight it
|
||||
//! correspondingly. Is valid for global context only; for local context use method AddOrRemoveSelected.
|
||||
//! Since this method makes sence only for neutral point selection of a whole object, if 0 selection
|
||||
//! of the object is empty this method simply does nothing.
|
||||
Standard_EXPORT void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& theObj,
|
||||
const Standard_Boolean theIsToUpdateViewer = Standard_True);
|
||||
|
||||
//! Updates the list of current objects, i.e. hilights new
|
||||
//! current objects, removes hilighting from former current objects.
|
||||
@@ -936,10 +937,9 @@ public:
|
||||
|
||||
|
||||
//! Returns true if there is a non-null interactive object in Neutral Point.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
Standard_EXPORT Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& aniobj) const;
|
||||
//! Objects selected when there is no open local context are called current objects;
|
||||
//! those selected in open local context, selected objects.
|
||||
Standard_EXPORT Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& theObject) const;
|
||||
|
||||
|
||||
//! Initializes a scan of the current selected objects in
|
||||
@@ -973,14 +973,6 @@ public:
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) Current() const;
|
||||
|
||||
Standard_EXPORT Standard_Integer NbCurrents();
|
||||
|
||||
|
||||
//! Returns the first current object in the list of current objects.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) FirstCurrentObject();
|
||||
|
||||
|
||||
//! Highlights current objects.
|
||||
//! Objects selected when there is no open local context
|
||||
@@ -990,8 +982,7 @@ public:
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void HilightCurrents (const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
Standard_EXPORT void HilightCurrents (const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Removes highlighting from current objects.
|
||||
//! Objects selected when there is no open local context
|
||||
@@ -1002,7 +993,6 @@ public:
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void UnhilightCurrents (const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
|
||||
//! Empties previous current objects in order to get the
|
||||
//! current objects detected by the selector using
|
||||
@@ -1014,118 +1004,97 @@ public:
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void ClearCurrents (const Standard_Boolean updateviewer = Standard_True);
|
||||
Standard_EXPORT void ClearCurrents (const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! @return current mouse-detected shape or empty (null) shape, if current interactive object
|
||||
//! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
|
||||
Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
|
||||
|
||||
//! @return current mouse-detected interactive object or null object, if there is no
|
||||
//! currently detected interactives
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
|
||||
|
||||
//! @name COMMON SELECTION METHODS VALID FOR BOTH GLOBAL AND LOCAL CONTEXT
|
||||
|
||||
//! Unhighlights previously selected owners and marks them as not selected.
|
||||
//! Marks owner given as selected and highlights it.
|
||||
Standard_EXPORT void SetSelected (const Handle(SelectMgr_EntityOwner)& theOwners,
|
||||
const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Puts the interactive object aniObj in the list of
|
||||
//! selected objects.
|
||||
//! If a local context is open and if updateviewer equals
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& aniObj, const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
//! puts the selected list in the current objects List.
|
||||
Standard_EXPORT void SetSelectedCurrent();
|
||||
|
||||
//! updates the list of selected objects
|
||||
//! i.e. hilights the new selected
|
||||
//! unhilights old selected objects
|
||||
Standard_EXPORT void UpdateSelected (const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
//! Allows you to add a selected object to the list of
|
||||
//! selected objects or remove it from that list. This entity
|
||||
//! can be an Interactive Object aniobj or its owner
|
||||
//! aShape as can be seen in the two syntaxes above.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
//! If a local context is open and if updateviewer equals
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
|
||||
Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& theObject,
|
||||
const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Updates the list of selected objects:
|
||||
//! i.e. highlights the newely selected ones and unhighlights previously selected objects.
|
||||
Standard_EXPORT void UpdateSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Allows to highlight or unhighlight the owner given depending on its selection status
|
||||
Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& theObject,
|
||||
const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Highlights selected objects.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
//! If a local context is open and if updateviewer equals
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void HilightSelected (const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
Standard_EXPORT void HilightSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Removes highlighting from selected objects.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
//! If a local context is open and if updateviewer equals
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void UnhilightSelected (const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
Standard_EXPORT void UnhilightSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Empties previous selected objects in order to get the
|
||||
//! selected objects detected by the selector using
|
||||
//! UpdateSelected.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
//! If a local context is open and if updateviewer equals
|
||||
//! Standard_False, the presentation of the Interactive
|
||||
//! Object activates the selection mode; the object is
|
||||
//! displayed but no viewer will be updated.
|
||||
Standard_EXPORT void ClearSelected (const Standard_Boolean updateviewer = Standard_True);
|
||||
Standard_EXPORT void ClearSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! No right to Add a selected Shape (Internal Management
|
||||
//! of shape Selection).
|
||||
//! A Previous selected shape may only be removed.
|
||||
Standard_EXPORT void AddOrRemoveSelected (const TopoDS_Shape& aShape, const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
//! allows to add/remove in the selected list the entities
|
||||
//! represented by <anOwner> in the selection process.
|
||||
Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& anOwner, const Standard_Boolean updateviewer = Standard_True);
|
||||
|
||||
|
||||
//! Finds the selected object aniobj in local context and
|
||||
//! returns its name.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
Standard_EXPORT Standard_Boolean IsSelected (const Handle(AIS_InteractiveObject)& aniobj) const;
|
||||
|
||||
//! Allows to highlight or unhighlight the owner given depending on its selection status
|
||||
Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Initializes a scan of the selected objects in local context.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
//! Returns true is the owner given is selected
|
||||
Standard_EXPORT Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const;
|
||||
|
||||
//! Returns true is the object given is selected
|
||||
Standard_EXPORT Standard_Boolean IsSelected (const Handle(AIS_InteractiveObject)& theObj) const;
|
||||
|
||||
//! Returns the first selected object in the list of current selected.
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) FirstSelectedObject();
|
||||
|
||||
//! Initializes a scan of the selected objects.
|
||||
Standard_EXPORT void InitSelected();
|
||||
|
||||
|
||||
//! Returns true if there is another object found by the
|
||||
//! scan of the list of selected objects.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
Standard_EXPORT Standard_Boolean MoreSelected() const;
|
||||
|
||||
|
||||
//! Continues the scan to the next object in the list of
|
||||
//! selected objects.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
Standard_EXPORT void NextSelected();
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Integer NbSelected();
|
||||
|
||||
|
||||
//! Returns true if the interactive context has a shape
|
||||
//! selected in it which results from the decomposition of
|
||||
//! another entity in local context.
|
||||
//! another entity.
|
||||
//! If HasSelectedShape returns true, SelectedShape
|
||||
//! returns the shape which has been shown to be
|
||||
//! selected. Interactive returns the Interactive Object
|
||||
@@ -1133,30 +1102,23 @@ public:
|
||||
//! If HasSelectedShape returns false, Interactive
|
||||
//! returns the interactive entity selected by the click of the mouse.
|
||||
Standard_EXPORT Standard_Boolean HasSelectedShape() const;
|
||||
|
||||
|
||||
//! Returns the selected shape in the open local context.
|
||||
//! Objects selected when there is no open local context
|
||||
//! are called current objects; those selected in open
|
||||
//! local context, selected objects.
|
||||
//! Returns the selected shape.
|
||||
Standard_EXPORT TopoDS_Shape SelectedShape() const;
|
||||
|
||||
|
||||
//! Returns the owner of the selected entity resulting
|
||||
//! from the decomposition of another entity in local context.
|
||||
//! from the decomposition of another entity.
|
||||
Standard_EXPORT Handle(SelectMgr_EntityOwner) SelectedOwner() const;
|
||||
|
||||
|
||||
//! Returns a collection containing all entity owners
|
||||
//! created for the interactive object <theIObj> in
|
||||
//! the selection mode theMode (in all active modes
|
||||
//! if the Mode == -1)
|
||||
Standard_EXPORT void EntityOwners (Handle(SelectMgr_IndexedMapOfOwner)& theOwners, const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer theMode = -1) const;
|
||||
|
||||
//! Returns the location of the selected Interactive Object.
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) Interactive() const;
|
||||
|
||||
Standard_EXPORT void EntityOwners (Handle(SelectMgr_IndexedMapOfOwner)& theOwners,
|
||||
const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const Standard_Integer theMode = -1) const;
|
||||
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) SelectedInteractive() const;
|
||||
|
||||
|
||||
//! Returns true if the applicative object has an owner
|
||||
//! from Interactive attributed to it.
|
||||
@@ -1222,14 +1184,6 @@ public:
|
||||
//! Gets next current object during iteration through mouse-detected
|
||||
//! interactive objects.
|
||||
Standard_EXPORT void NextDetected();
|
||||
|
||||
|
||||
//! @return current mouse-detected shape or empty (null) shape, if current interactive object
|
||||
//! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
|
||||
Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
|
||||
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
|
||||
|
||||
|
||||
//! Opens local contexts and specifies how this is to be
|
||||
//! done. The options listed above function in the following manner:
|
||||
@@ -1303,7 +1257,7 @@ public:
|
||||
Standard_EXPORT void NotUseDisplayedObjects();
|
||||
|
||||
//! initializes the list of presentations to be displayed
|
||||
//! returns False if No Local COnte
|
||||
//! returns False if no local context is opened.
|
||||
Standard_EXPORT Standard_Boolean BeginImmediateDraw();
|
||||
|
||||
//! returns True if <anIObj> has been stored in the list.
|
||||
@@ -1582,6 +1536,9 @@ public:
|
||||
//! Query objects visible or hidden in specified view due to affinity mask.
|
||||
Standard_EXPORT void ObjectsForView (AIS_ListOfInteractive& theListOfIO, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisibleInView, const AIS_DisplayStatus theStatus = AIS_DS_None) const;
|
||||
|
||||
//! Redraws immediate structures in all views of the viewer given taking into account its visibility.
|
||||
Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
|
||||
|
||||
|
||||
friend class AIS_LocalContext;
|
||||
|
||||
@@ -1614,6 +1571,24 @@ private:
|
||||
//! UNKNOWN
|
||||
Standard_EXPORT void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True);
|
||||
|
||||
//! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
|
||||
void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
|
||||
|
||||
//! Helper function that highlights the owner given with <theColor> without
|
||||
//! performing AutoHighlight checks, e.g. is used for dynamic highlight.
|
||||
//! If the parameter <theViewer> is set and <theIsImmediate> is true, highlight will be synchronized
|
||||
//! automatically in all views of the viewer.
|
||||
void highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Quantity_NameOfColor theColor,
|
||||
const Handle(V3d_Viewer)& theViewer = NULL);
|
||||
|
||||
//! Helper function that highlights the owner given with <theColor> with check
|
||||
//! for AutoHighlight, e.g. is used for selection.
|
||||
//! If the parameter <theViewer> is set and <theIsImmediate> is true, selection color will be synchronized
|
||||
//! automatically in all views of the viewer.
|
||||
void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Quantity_NameOfColor theSelColor);
|
||||
|
||||
AIS_DataMapOfIOStatus myObjects;
|
||||
Handle(SelectMgr_SelectionManager) mgrSelector;
|
||||
Handle(PrsMgr_PresentationManager3d) myMainPM;
|
||||
@@ -1621,8 +1596,8 @@ private:
|
||||
Handle(StdSelect_ViewerSelector3d) myMainSel;
|
||||
TCollection_AsciiString mySelectionName;
|
||||
TCollection_AsciiString myCurrentName;
|
||||
Handle(AIS_InteractiveObject) myLastPicked;
|
||||
Handle(AIS_InteractiveObject) myLastinMain;
|
||||
Handle(SelectMgr_EntityOwner) myLastPicked;
|
||||
Handle(SelectMgr_EntityOwner) myLastinMain;
|
||||
Standard_Boolean myWasLastMain;
|
||||
Standard_Boolean myCurrentTouched;
|
||||
Standard_Boolean mySelectedTouched;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -55,10 +55,12 @@ OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
|
||||
{
|
||||
|
||||
// the entities eventually detected just before the context was opened are unhighlighted...
|
||||
if(!IsCurrent(myLastPicked)){
|
||||
if(!IsSelected(myLastPicked)){
|
||||
if(!myLastPicked.IsNull()){
|
||||
Standard_Integer HiMod = myLastPicked->HasHilightMode()?myLastPicked->HilightMode():0;
|
||||
myMainPM->Unhighlight(myLastPicked,HiMod);
|
||||
const Handle(AIS_InteractiveObject) aLastPickedAIS =
|
||||
Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable());
|
||||
Standard_Integer HiMod = aLastPickedAIS->HasHilightMode()?aLastPickedAIS->HilightMode():0;
|
||||
myMainPM->Unhighlight (aLastPickedAIS, HiMod);
|
||||
}}
|
||||
|
||||
if(!mylastmoveview.IsNull()){
|
||||
@@ -750,7 +752,7 @@ Standard_Boolean AIS_InteractiveContext::ImmediateAdd (const Handle(AIS_Interact
|
||||
Standard_Boolean AIS_InteractiveContext::EndImmediateDraw (const Handle(V3d_View)& theView)
|
||||
{
|
||||
return HasOpenedContext()
|
||||
&& myLocalContexts (myCurLocalIndex)->EndImmediateDraw (theView);
|
||||
&& myLocalContexts (myCurLocalIndex)->EndImmediateDraw (theView->Viewer());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -772,7 +774,7 @@ Standard_Boolean AIS_InteractiveContext::EndImmediateDraw()
|
||||
}
|
||||
|
||||
Handle(V3d_View) aView = myMainVwr->ActiveView();
|
||||
return myLocalContexts (myCurLocalIndex)->EndImmediateDraw (aView);
|
||||
return myLocalContexts (myCurLocalIndex)->EndImmediateDraw (aView->Viewer());
|
||||
}
|
||||
|
||||
|
||||
|
@@ -64,7 +64,6 @@ myRecomputeEveryPrs(Standard_True),
|
||||
myCTXPtr(NULL),
|
||||
mySelPriority(-1),
|
||||
myDisplayMode (-1),
|
||||
mySelectionMode(0),
|
||||
mystate(0)
|
||||
{
|
||||
Handle (AIS_InteractiveContext) Bid;
|
||||
@@ -197,18 +196,6 @@ void AIS_InteractiveObject::SetDisplayMode(const Standard_Integer aMode)
|
||||
if( AcceptDisplayMode(aMode) )
|
||||
myDisplayMode = aMode;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetSelectionMode(const Standard_Integer aMode)
|
||||
{
|
||||
mySelectionMode = aMode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
|
@@ -263,41 +263,7 @@ public:
|
||||
//! This range can, however, be extended through the
|
||||
//! creation of new display modes.
|
||||
Standard_Integer DisplayMode() const;
|
||||
|
||||
//! Allows you to change the selection mode of an
|
||||
//! Interactive Object.
|
||||
//! The default selection mode setting is 0.
|
||||
//! For shapes, for example, the selection modes are as follows:
|
||||
//! - mode 0 - selection of the shape itself
|
||||
//! - mode 1 - selection of vertices
|
||||
//! - mode 2 - selection of edges
|
||||
//! - mode 3 - selection of wires
|
||||
//! - mode 4 - selection of faces
|
||||
//! - mode 5 - selection of shells
|
||||
//! - mode 6 - selection of solids
|
||||
//! - mode 7 - selection of compounds
|
||||
//! For trihedra, on the other hand, the selection modes are the following four:
|
||||
//! - mode 0 - selection of a trihedron
|
||||
//! - mode 1 - selection of its origin
|
||||
//! - mode 2 - selection of its axes
|
||||
//! - mode 3 - selection of its planes
|
||||
Standard_EXPORT Standard_Boolean HasSelectionMode() const;
|
||||
|
||||
//! Returns the selection mode of the interactive object.
|
||||
Standard_EXPORT Standard_Integer SelectionMode() const;
|
||||
|
||||
//! You can change the default selection mode index
|
||||
//! aMode of an Interactive Object.
|
||||
//! This is only of interest if you decide that mode 0
|
||||
//! adopted by convention will not do.
|
||||
Standard_EXPORT void SetSelectionMode (const Standard_Integer aMode);
|
||||
|
||||
//! You can change the default selection mode index of
|
||||
//! an Interactive Object.
|
||||
//! This is only of interest if you decide that the 0 mode
|
||||
//! adopted by convention will not do.
|
||||
void UnsetSelectionMode();
|
||||
|
||||
|
||||
//! Returns the selection priority setting. -1 indicates that there is none.
|
||||
//! You can modify the selection priority of an owner to
|
||||
//! make one entity more selectionable than another one.
|
||||
@@ -498,7 +464,7 @@ protected:
|
||||
|
||||
|
||||
//! The TypeOfPresention3d means that the interactive object
|
||||
//! may have a presentation dependant of the view of Display
|
||||
//! may have a presentation dependant of the view of Display.
|
||||
Standard_EXPORT AIS_InteractiveObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
|
||||
|
||||
Standard_Real myTransparency;
|
||||
@@ -530,7 +496,6 @@ private:
|
||||
TColStd_ListOfTransient myUsers;
|
||||
Standard_Integer mySelPriority;
|
||||
Standard_Integer myDisplayMode;
|
||||
Standard_Integer mySelectionMode;
|
||||
Standard_Integer mystate;
|
||||
|
||||
|
||||
|
@@ -44,17 +44,6 @@ inline void AIS_InteractiveObject::UnsetDisplayMode()
|
||||
inline Standard_Integer AIS_InteractiveObject::DisplayMode() const
|
||||
{return myDisplayMode;}
|
||||
|
||||
inline Standard_Boolean AIS_InteractiveObject::HasSelectionMode() const
|
||||
{return mySelectionMode!=-1;}
|
||||
|
||||
inline void AIS_InteractiveObject::UnsetSelectionMode()
|
||||
{mySelectionMode =-1;}
|
||||
|
||||
inline Standard_Integer AIS_InteractiveObject::SelectionMode() const
|
||||
{return mySelectionMode;}
|
||||
|
||||
|
||||
|
||||
inline Quantity_NameOfColor AIS_InteractiveObject::Color() const
|
||||
{
|
||||
return myOwnColor.Name();
|
||||
|
@@ -319,10 +319,10 @@ Erase(const Handle(AIS_InteractiveObject)& anInteractive)
|
||||
const Handle(SelectMgr_SelectableObject)& anObj = anInteractive; // to avoid ambiguity
|
||||
if (mySM->Contains (anObj))
|
||||
{
|
||||
TColStd_ListIteratorOfListOfInteger aModeIter (STAT->SelectionModes());
|
||||
for (; aModeIter.More(); aModeIter.Next())
|
||||
while (!STAT->SelectionModes().IsEmpty())
|
||||
{
|
||||
mySM->Deactivate (anInteractive, aModeIter.Value(), myMainVS);
|
||||
mySM->Deactivate (anInteractive, STAT->SelectionModes().Last(), myMainVS);
|
||||
STAT->RemoveSelectionMode (STAT->SelectionModes().Last());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -637,13 +637,6 @@ void AIS_LocalContext::Terminate (const Standard_Boolean theToUpdate)
|
||||
AIS_Selection::Select();
|
||||
AIS_Selection::Remove(mySelName.ToCString());
|
||||
|
||||
Handle(V3d_Viewer) aViewer = myCTX->CurrentViewer();
|
||||
for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
|
||||
{
|
||||
Handle(V3d_View) aView = aViewer->ActiveView();
|
||||
aView->View()->ClearImmediate();
|
||||
}
|
||||
|
||||
Handle(V3d_View) aDummyView;
|
||||
myMainVS->ClearSensitive (aDummyView);
|
||||
|
||||
@@ -1122,14 +1115,14 @@ Standard_Boolean AIS_LocalContext::ImmediateAdd (const Handle(AIS_InteractiveObj
|
||||
//function : EndImmediateDraw
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_LocalContext::EndImmediateDraw (const Handle(V3d_View)& theView)
|
||||
Standard_Boolean AIS_LocalContext::EndImmediateDraw (const Handle(V3d_Viewer)& theViewer)
|
||||
{
|
||||
if (!myMainPM->IsImmediateModeOn())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myMainPM->EndImmediateDraw (theView);
|
||||
myMainPM->EndImmediateDraw (theViewer);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
@@ -47,6 +47,7 @@ class SelectMgr_Filter;
|
||||
class TCollection_AsciiString;
|
||||
class AIS_InteractiveObject;
|
||||
class V3d_View;
|
||||
class V3d_Viewer;
|
||||
class TopoDS_Shape;
|
||||
class SelectMgr_EntityOwner;
|
||||
class Standard_Transient;
|
||||
@@ -329,7 +330,7 @@ public:
|
||||
Standard_EXPORT Standard_Boolean ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode = 0);
|
||||
|
||||
//! Allows rapid drawing of the view theView by avoiding an update of the whole background.
|
||||
Standard_EXPORT Standard_Boolean EndImmediateDraw (const Handle(V3d_View)& theView);
|
||||
Standard_EXPORT Standard_Boolean EndImmediateDraw (const Handle(V3d_Viewer)& theViewer);
|
||||
|
||||
//! Returns true if Presentation Manager is accumulating transient list of presentations to be displayed in immediate mode.
|
||||
Standard_EXPORT Standard_Boolean IsImmediateModeOn() const;
|
||||
|
@@ -482,7 +482,7 @@ void AIS_LocalContext::Hilight (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Standard_Integer aHilightMode = GetHiMod (Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()));
|
||||
myMainPM->BeginImmediateDraw();
|
||||
theOwner->HilightWithColor (myMainPM, myCTX->HilightColor(), aHilightMode);
|
||||
myMainPM->EndImmediateDraw (theView);
|
||||
myMainPM->EndImmediateDraw (theView->Viewer());
|
||||
}
|
||||
|
||||
//==================================================
|
||||
@@ -1397,7 +1397,7 @@ Standard_Boolean AIS_LocalContext::UnhilightLastDetected (const Handle(V3d_View)
|
||||
: 0;
|
||||
|
||||
myMapOfOwner->FindKey (mylastindex)->Unhilight (myMainPM, aHilightMode);
|
||||
myMainPM->EndImmediateDraw (theView);
|
||||
myMainPM->EndImmediateDraw (theView->Viewer());
|
||||
mylastindex = 0;
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -391,3 +391,12 @@ void AIS_MultipleConnectedInteractive::ComputeSelection (const Handle(SelectMgr_
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GlobalSelOwner
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(SelectMgr_EntityOwner) AIS_MultipleConnectedInteractive::GlobalSelOwner() const
|
||||
{
|
||||
return myAssemblyOwner;
|
||||
}
|
||||
|
@@ -96,7 +96,8 @@ public:
|
||||
//! may be decomposed into sub-shapes for dynamic selection.
|
||||
Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Returns the owner of mode for selection of object as a whole
|
||||
Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTI(AIS_MultipleConnectedInteractive,AIS_InteractiveObject)
|
||||
|
@@ -12,13 +12,13 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BOPAlgo_ArgumentAnalyzer.hxx>
|
||||
#include <BOPAlgo_BuilderFace.hxx>
|
||||
#include <BOPAlgo_CheckerSI.hxx>
|
||||
#include <BOPAlgo_Operation.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPCol_MapOfShape.hxx>
|
||||
#include <BOPCol_IndexedMapOfShape.hxx>
|
||||
#include <BOPCol_SequenceOfShape.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_MapOfPassKey.hxx>
|
||||
@@ -50,8 +50,6 @@
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
|
||||
//
|
||||
// ================================================================================
|
||||
// function: Constructor
|
||||
// purpose:
|
||||
@@ -814,10 +812,9 @@ void BOPAlgo_ArgumentAnalyzer::TestMergeEdge()
|
||||
// ================================================================================
|
||||
void BOPAlgo_ArgumentAnalyzer::TestContinuity()
|
||||
{
|
||||
Standard_Integer i;
|
||||
Standard_Integer i, j, aNbS;
|
||||
Standard_Real f, l;
|
||||
TopExp_Explorer aExp;
|
||||
BOPCol_MapIteratorOfMapOfShape aIt;
|
||||
//
|
||||
for (i = 0; i < 2; ++i) {
|
||||
const TopoDS_Shape& aS = !i ? myShape1 : myShape2;
|
||||
@@ -825,7 +822,7 @@ void BOPAlgo_ArgumentAnalyzer::TestContinuity()
|
||||
continue;
|
||||
}
|
||||
//
|
||||
BOPCol_MapOfShape aMS;
|
||||
BOPCol_IndexedMapOfShape aMS;
|
||||
//Edges
|
||||
aExp.Init(aS, TopAbs_EDGE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
@@ -849,9 +846,9 @@ void BOPAlgo_ArgumentAnalyzer::TestContinuity()
|
||||
}
|
||||
//
|
||||
//add shapes with continuity C0 to result
|
||||
aIt.Initialize(aMS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aFS = aIt.Value();
|
||||
aNbS = aMS.Extent();
|
||||
for (j = 1; j <= aNbS; ++j) {
|
||||
const TopoDS_Shape& aFS = aMS(j);
|
||||
BOPAlgo_CheckResult aResult;
|
||||
if(i == 0) {
|
||||
aResult.SetShape1(myShape1);
|
||||
|
@@ -39,15 +39,11 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
|
||||
typedef NCollection_IndexedDataMap
|
||||
<BOPTools_Set,
|
||||
TopoDS_Shape,
|
||||
BOPTools_SetMapHasher> BOPTools_IndexedDataMapOfSetShape;
|
||||
//
|
||||
typedef NCollection_DataMap
|
||||
<BOPTools_Set,
|
||||
TopoDS_Shape,
|
||||
BOPTools_SetMapHasher> BOPTools_DataMapOfSetShape;
|
||||
//
|
||||
typedef BOPTools_DataMapOfSetShape::Iterator
|
||||
BOPTools_DataMapIteratorOfDataMapOfSetShape;
|
||||
|
||||
static
|
||||
TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim);
|
||||
|
||||
@@ -515,7 +511,7 @@ void BOPAlgo_BOP::BuildRC()
|
||||
BOPCol_ListIteratorOfListOfShape aItLS, aItIm;
|
||||
Standard_Boolean bHasInterf;
|
||||
Standard_Integer iX;
|
||||
BOPTools_DataMapOfSetShape aDMSTS;
|
||||
BOPTools_IndexedDataMapOfSetShape aDMSTS;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
@@ -575,7 +571,7 @@ void BOPAlgo_BOP::BuildRC()
|
||||
//
|
||||
aST.Add(aSIm, TopAbs_FACE);
|
||||
//
|
||||
aDMSTS.Bind(aST, aSIm);
|
||||
aDMSTS.Add(aST, aSIm);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -640,8 +636,8 @@ void BOPAlgo_BOP::BuildRC()
|
||||
//
|
||||
aST.Add(aSIm, TopAbs_FACE);
|
||||
//
|
||||
if (aDMSTS.IsBound(aST)) {
|
||||
const TopoDS_Shape& aSImA=aDMSTS.Find(aST);
|
||||
if (aDMSTS.Contains(aST)) {
|
||||
const TopoDS_Shape& aSImA=aDMSTS.FindFromKey(aST);
|
||||
aBB.Add(aC, aSImA);
|
||||
}
|
||||
}
|
||||
@@ -654,7 +650,7 @@ void BOPAlgo_BOP::BuildRC()
|
||||
//
|
||||
aST.Add(aSIm, TopAbs_FACE);
|
||||
//
|
||||
bIsBound=aDMSTS.IsBound(aST);
|
||||
bIsBound=aDMSTS.Contains(aST);
|
||||
}
|
||||
//
|
||||
if (!bIsBound) {
|
||||
@@ -821,8 +817,7 @@ void BOPAlgo_BOP::BuildSolid()
|
||||
BOPCol_ListOfShape aSFS;
|
||||
BOPAlgo_BuilderSolid aSB;
|
||||
BOPCol_MapOfShape aMSA, aMZ;
|
||||
BOPTools_DataMapOfSetShape aDMSTS;
|
||||
BOPTools_DataMapIteratorOfDataMapOfSetShape aItDMSTS;
|
||||
BOPTools_IndexedDataMapOfSetShape aDMSTS;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
@@ -878,8 +873,8 @@ void BOPAlgo_BOP::BuildSolid()
|
||||
//
|
||||
aST.Add(aSx, TopAbs_FACE);
|
||||
//
|
||||
if (!aDMSTS.IsBound(aST)) {
|
||||
aDMSTS.Bind(aST, aSx);
|
||||
if (!aDMSTS.Contains(aST)) {
|
||||
aDMSTS.Add(aST, aSx);
|
||||
}
|
||||
|
||||
continue;
|
||||
@@ -976,9 +971,9 @@ void BOPAlgo_BOP::BuildSolid()
|
||||
aBB.Add(aRC, aSR);
|
||||
}
|
||||
//
|
||||
aItDMSTS.Initialize(aDMSTS);
|
||||
for (; aItDMSTS.More(); aItDMSTS.Next()) {
|
||||
const TopoDS_Shape& aSx=aItDMSTS.Value();
|
||||
aNbSx = aDMSTS.Extent();
|
||||
for (i = 1; i <= aNbSx; ++i) {
|
||||
const TopoDS_Shape& aSx = aDMSTS(i);
|
||||
aBB.Add(aRC, aSx);
|
||||
}
|
||||
//
|
||||
|
@@ -23,7 +23,7 @@
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPCol_MapOfOrientedShape.hxx>
|
||||
#include <BOPCol_IndexedMapOfOrientedShape.hxx>
|
||||
#include <BOPAlgo_Algo.hxx>
|
||||
#include <BOPCol_BaseAllocator.hxx>
|
||||
class IntTools_Context;
|
||||
@@ -72,7 +72,7 @@ Standard_EXPORT virtual ~BOPAlgo_BuilderArea();
|
||||
BOPCol_ListOfShape myLoops;
|
||||
BOPCol_ListOfShape myLoopsInternal;
|
||||
BOPCol_ListOfShape myAreas;
|
||||
BOPCol_MapOfOrientedShape myShapesToAvoid;
|
||||
BOPCol_IndexedMapOfOrientedShape myShapesToAvoid;
|
||||
|
||||
|
||||
private:
|
||||
|
@@ -16,7 +16,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BOPAlgo_BuilderFace.hxx>
|
||||
#include <BOPAlgo_WireEdgeSet.hxx>
|
||||
@@ -27,6 +26,7 @@
|
||||
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPCol_MapOfShape.hxx>
|
||||
#include <BOPCol_MapOfOrientedShape.hxx>
|
||||
#include <BOPTools.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools2D.hxx>
|
||||
@@ -56,14 +56,6 @@
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -79,7 +71,7 @@ static
|
||||
const TopoDS_Shape& ,
|
||||
Handle(IntTools_Context)& );
|
||||
static
|
||||
void MakeInternalWires(const BOPCol_MapOfShape& ,
|
||||
void MakeInternalWires(const BOPCol_IndexedMapOfShape& ,
|
||||
BOPCol_ListOfShape& );
|
||||
static
|
||||
void GetWire(const TopoDS_Shape& ,
|
||||
@@ -333,9 +325,8 @@ void BOPAlgo_BuilderFace::PerformLoops()
|
||||
myErrorStatus=0;
|
||||
//
|
||||
Standard_Boolean bFlag;
|
||||
Standard_Integer iErr, aNbEA;
|
||||
Standard_Integer i, iErr, aNbEA;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
BOPCol_MapIteratorOfMapOfOrientedShape aItM;
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aVEMap;
|
||||
BOPCol_MapOfOrientedShape aMAdded;
|
||||
TopoDS_Iterator aItW;
|
||||
@@ -384,9 +375,9 @@ void BOPAlgo_BuilderFace::PerformLoops()
|
||||
}
|
||||
//
|
||||
// b. collect all edges that are to avoid
|
||||
aItM.Initialize(myShapesToAvoid);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aE=aItM.Key();
|
||||
aNbEA = myShapesToAvoid.Extent();
|
||||
for (i = 1; i <= aNbEA; ++i) {
|
||||
const TopoDS_Shape& aE = myShapesToAvoid(i);
|
||||
aMEP.Add(aE);
|
||||
}
|
||||
//
|
||||
@@ -402,10 +393,9 @@ void BOPAlgo_BuilderFace::PerformLoops()
|
||||
// 2. Internal Wires
|
||||
myLoopsInternal.Clear();
|
||||
//
|
||||
aNbEA=myShapesToAvoid.Extent();
|
||||
aItM.Initialize(myShapesToAvoid);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aEE=aItM.Key();
|
||||
aNbEA = myShapesToAvoid.Extent();
|
||||
for (i = 1; i <= aNbEA; ++i) {
|
||||
const TopoDS_Shape& aEE = myShapesToAvoid(i);
|
||||
BOPTools::MapShapesAndAncestors(aEE,
|
||||
TopAbs_VERTEX,
|
||||
TopAbs_EDGE,
|
||||
@@ -413,9 +403,8 @@ void BOPAlgo_BuilderFace::PerformLoops()
|
||||
}
|
||||
//
|
||||
bFlag=Standard_True;
|
||||
aItM.Initialize(myShapesToAvoid);
|
||||
for (; aItM.More()&&bFlag; aItM.Next()) {
|
||||
const TopoDS_Shape& aEE=aItM.Key();
|
||||
for (i = 1; (i <= aNbEA) && bFlag; ++i) {
|
||||
const TopoDS_Shape& aEE = myShapesToAvoid(i);
|
||||
if (!aMAdded.Add(aEE)) {
|
||||
continue;
|
||||
}
|
||||
@@ -445,8 +434,9 @@ void BOPAlgo_BuilderFace::PerformLoops()
|
||||
}//for (; aIt.More(); aIt.Next()) {
|
||||
}//for (; aItE.More(); aItE.Next()) {
|
||||
}//for (; aItW.More(); aItW.Next()) {
|
||||
aW.Closed(BRep_Tool::IsClosed(aW));
|
||||
myLoopsInternal.Append(aW);
|
||||
}//for (; aItM.More(); aItM.Next()) {
|
||||
}//for (i = 1; (i <= aNbEA) && bFlag; ++i) {
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformAreas
|
||||
@@ -705,11 +695,11 @@ void BOPAlgo_BuilderFace::PerformInternalShapes()
|
||||
}
|
||||
//
|
||||
//Standard_Real aTol;
|
||||
Standard_Integer i;
|
||||
BRep_Builder aBB;
|
||||
BOPCol_ListIteratorOfListOfShape aIt1, aIt2;
|
||||
TopoDS_Iterator aIt;
|
||||
BOPCol_MapOfShape aME, aMEP;
|
||||
BOPCol_MapIteratorOfMapOfShape aItME;
|
||||
BOPCol_IndexedMapOfShape aME1, aME2, aMEP;
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aMVE;
|
||||
BOPCol_ListOfShape aLSI;
|
||||
//
|
||||
@@ -720,10 +710,9 @@ void BOPAlgo_BuilderFace::PerformInternalShapes()
|
||||
aIt.Initialize(aWire);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aE=aIt.Value();
|
||||
aME.Add(aE);
|
||||
aME1.Add(aE);
|
||||
}
|
||||
}
|
||||
aNbWI=aME.Extent();
|
||||
//
|
||||
// 2 Process faces
|
||||
aIt2.Initialize(myAreas);
|
||||
@@ -734,13 +723,17 @@ void BOPAlgo_BuilderFace::PerformInternalShapes()
|
||||
BOPTools::MapShapesAndAncestors(aF, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
|
||||
//
|
||||
// 2.1 Separate faces to process aMEP
|
||||
aME2.Clear();
|
||||
aMEP.Clear();
|
||||
aItME.Initialize(aME);
|
||||
for (; aItME.More(); aItME.Next()) {
|
||||
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aItME.Key()));
|
||||
aNbWI = aME1.Extent();
|
||||
for (i = 1; i <= aNbWI; ++i) {
|
||||
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aME1(i)));
|
||||
if (IsInside(aE, aF, myContext)) {
|
||||
aMEP.Add(aE);
|
||||
}
|
||||
else {
|
||||
aME2.Add(aE);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 2.2 Make Internal Wires
|
||||
@@ -755,13 +748,9 @@ void BOPAlgo_BuilderFace::PerformInternalShapes()
|
||||
}
|
||||
//
|
||||
// 2.4 Remove faces aMFP from aMF
|
||||
aItME.Initialize(aMEP);
|
||||
for (; aItME.More(); aItME.Next()) {
|
||||
const TopoDS_Shape& aE=aItME.Key();
|
||||
aME.Remove(aE);
|
||||
}
|
||||
aME1 = aME2;
|
||||
//
|
||||
aNbWI=aME.Extent();
|
||||
aNbWI = aME1.Extent();
|
||||
if (!aNbWI) {
|
||||
break;
|
||||
}
|
||||
@@ -771,24 +760,23 @@ void BOPAlgo_BuilderFace::PerformInternalShapes()
|
||||
//function : MakeInternalWires
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void MakeInternalWires(const BOPCol_MapOfShape& theME,
|
||||
void MakeInternalWires(const BOPCol_IndexedMapOfShape& theME,
|
||||
BOPCol_ListOfShape& theWires)
|
||||
{
|
||||
BOPCol_MapIteratorOfMapOfShape aItM;
|
||||
Standard_Integer i, aNbE;
|
||||
BOPCol_MapOfShape aAddedMap;
|
||||
BOPCol_ListIteratorOfListOfShape aItE;
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aMVE;
|
||||
BRep_Builder aBB;
|
||||
//
|
||||
aItM.Initialize(theME);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aE=aItM.Key();
|
||||
aNbE = theME.Extent();
|
||||
for (i = 1; i <= aNbE; ++i) {
|
||||
const TopoDS_Shape& aE = theME(i);
|
||||
BOPTools::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
|
||||
}
|
||||
//
|
||||
aItM.Initialize(theME);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
TopoDS_Shape aEE=aItM.Key();
|
||||
for (i = 1; i <= aNbE; ++i) {
|
||||
TopoDS_Shape aEE = theME(i);
|
||||
if (!aAddedMap.Add(aEE)) {
|
||||
continue;
|
||||
}
|
||||
@@ -817,6 +805,7 @@ void MakeInternalWires(const BOPCol_MapOfShape& theME,
|
||||
}
|
||||
}
|
||||
}
|
||||
aW.Closed(BRep_Tool::IsClosed(aW));
|
||||
theWires.Append(aW);
|
||||
}
|
||||
}
|
||||
|
@@ -15,14 +15,13 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
//
|
||||
|
||||
|
||||
#include <BOPAlgo_BuilderSolid.hxx>
|
||||
#include <BOPAlgo_ShellSplitter.hxx>
|
||||
#include <BOPCol_BoxBndTree.hxx>
|
||||
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
|
||||
#include <BOPCol_DataMapOfShapeShape.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeShape.hxx>
|
||||
#include <BOPCol_ListOfInteger.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPCol_MapOfOrientedShape.hxx>
|
||||
@@ -63,17 +62,6 @@
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
static
|
||||
Standard_Boolean IsGrowthShell(const TopoDS_Shape& ,
|
||||
@@ -86,7 +74,7 @@ static
|
||||
const TopoDS_Shape& ,
|
||||
Handle(IntTools_Context)& );
|
||||
static
|
||||
void MakeInternalShells(const BOPCol_MapOfShape& ,
|
||||
void MakeInternalShells(const BOPCol_IndexedMapOfShape& ,
|
||||
BOPCol_ListOfShape& );
|
||||
|
||||
//=======================================================================
|
||||
@@ -261,14 +249,7 @@ typedef BOPCol_ContextCnt
|
||||
Handle(IntTools_Context)> BOPAlgo_FaceSolidCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
typedef NCollection_DataMap
|
||||
<TopoDS_Shape,
|
||||
gp_Pnt,
|
||||
TopTools_ShapeMapHasher> BOPAlgo_DataMapOfShapePnt;
|
||||
|
||||
typedef BOPAlgo_DataMapOfShapePnt::Iterator
|
||||
BOPAlgo_DataMapIteratorOfDataMapOfShapePnt;
|
||||
//
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
@@ -448,10 +429,9 @@ void BOPAlgo_BuilderSolid::PerformShapesToAvoid()
|
||||
//=======================================================================
|
||||
void BOPAlgo_BuilderSolid::PerformLoops()
|
||||
{
|
||||
Standard_Integer iErr;
|
||||
Standard_Integer iErr, i, aNbSh;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
TopoDS_Iterator aItS;
|
||||
BOPCol_MapIteratorOfMapOfOrientedShape aItM;
|
||||
Handle(NCollection_BaseAllocator) aAlr;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
@@ -512,9 +492,9 @@ void BOPAlgo_BuilderSolid::PerformLoops()
|
||||
}
|
||||
//
|
||||
// b. collect all edges that are to avoid
|
||||
aItM.Initialize(myShapesToAvoid);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aF=aItM.Key();
|
||||
aNbSh = myShapesToAvoid.Extent();
|
||||
for (i = 1; i <= aNbSh; ++i) {
|
||||
const TopoDS_Shape& aF = myShapesToAvoid(i);
|
||||
aMP.Add(aF);
|
||||
}
|
||||
//
|
||||
@@ -536,17 +516,16 @@ void BOPAlgo_BuilderSolid::PerformLoops()
|
||||
aEFMap.Clear();
|
||||
AddedFacesMap.Clear();
|
||||
//
|
||||
aItM.Initialize(myShapesToAvoid);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aFF=aItM.Key();
|
||||
aNbSh = myShapesToAvoid.Extent();
|
||||
for (i = 1; i <= aNbSh; ++i) {
|
||||
const TopoDS_Shape& aFF = myShapesToAvoid(i);
|
||||
BOPTools::MapShapesAndAncestors(aFF,
|
||||
TopAbs_EDGE, TopAbs_FACE,
|
||||
aEFMap);
|
||||
}
|
||||
//
|
||||
aItM.Initialize(myShapesToAvoid);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aFF=aItM.Key();
|
||||
for (i = 1; i <= aNbSh; ++i) {
|
||||
const TopoDS_Shape& aFF = myShapesToAvoid(i);
|
||||
if (!AddedFacesMap.Add(aFF)) {
|
||||
continue;
|
||||
}
|
||||
@@ -585,11 +564,11 @@ void BOPAlgo_BuilderSolid::PerformLoops()
|
||||
void BOPAlgo_BuilderSolid::PerformAreas()
|
||||
{
|
||||
Standard_Boolean bIsGrowth, bIsHole;
|
||||
Standard_Integer k;
|
||||
Standard_Integer i, k, aNbInOut, aNbMSH;
|
||||
BRep_Builder aBB;
|
||||
BOPCol_ListIteratorOfListOfShape aItLS;
|
||||
BOPCol_ListOfShape aNewSolids, aHoleShells;
|
||||
BOPCol_DataMapOfShapeShape aInOutMap;
|
||||
BOPCol_IndexedDataMapOfShapeShape aInOutMap;
|
||||
BOPCol_IndexedMapOfShape aMHF;
|
||||
BOPCol_ListIteratorOfListOfInteger aItLI;
|
||||
BOPCol_BoxBndTreeSelector aSelector;
|
||||
@@ -597,10 +576,8 @@ void BOPAlgo_BuilderSolid::PerformAreas()
|
||||
NCollection_UBTreeFiller
|
||||
<Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
BOPAlgo_DataMapOfIntegerBSSB aDMISB(100);
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aMSH;
|
||||
BOPAlgo_DataMapIteratorOfDataMapOfIntegerBSSB aItDMISB;
|
||||
BOPCol_DataMapOfShapeListOfShape aMSH;
|
||||
BOPCol_DataMapIteratorOfDataMapOfShapeShape aItDMSS;
|
||||
BOPCol_DataMapIteratorOfDataMapOfShapeListOfShape aItMSH;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
@@ -698,42 +675,41 @@ void BOPAlgo_BuilderSolid::PerformAreas()
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (aInOutMap.IsBound (aHole)){
|
||||
const TopoDS_Shape& aSolidWas=aInOutMap(aHole);
|
||||
if (aInOutMap.Contains (aHole)){
|
||||
const TopoDS_Shape& aSolidWas = aInOutMap.FindFromKey(aHole);
|
||||
if (IsInside(aSolid, aSolidWas, myContext)) {
|
||||
aInOutMap.UnBind(aHole);
|
||||
aInOutMap.Bind (aHole, aSolid);
|
||||
aInOutMap.ChangeFromKey(aHole) = aSolid;
|
||||
}
|
||||
}
|
||||
else{
|
||||
aInOutMap.Bind(aHole, aSolid);
|
||||
aInOutMap.Add(aHole, aSolid);
|
||||
}
|
||||
}
|
||||
}//for (; aItDMISB.More(); aItDMISB.Next()) {
|
||||
}//for (i = 1; i <= aNbDMISB; ++i) {
|
||||
//
|
||||
// 5. Map [Solid/Holes] -> aMSH
|
||||
aItDMSS.Initialize(aInOutMap);
|
||||
for (; aItDMSS.More(); aItDMSS.Next()) {
|
||||
const TopoDS_Shape& aHole=aItDMSS.Key();
|
||||
const TopoDS_Shape& aSolid=aItDMSS.Value();
|
||||
aNbInOut = aInOutMap.Extent();
|
||||
for (i = 1; i <= aNbInOut; ++i) {
|
||||
const TopoDS_Shape& aHole = aInOutMap.FindKey(i);
|
||||
const TopoDS_Shape& aSolid = aInOutMap(i);
|
||||
//
|
||||
if (aMSH.IsBound(aSolid)) {
|
||||
BOPCol_ListOfShape& aLH=aMSH.ChangeFind(aSolid);
|
||||
if (aMSH.Contains(aSolid)) {
|
||||
BOPCol_ListOfShape& aLH = aMSH.ChangeFromKey(aSolid);
|
||||
aLH.Append(aHole);
|
||||
}
|
||||
else {
|
||||
BOPCol_ListOfShape aLH;
|
||||
aLH.Append(aHole);
|
||||
aMSH.Bind(aSolid, aLH);
|
||||
aMSH.Add(aSolid, aLH);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 6. Add aHoles to Solids
|
||||
aItMSH.Initialize(aMSH);
|
||||
for (; aItMSH.More(); aItMSH.Next()) {
|
||||
TopoDS_Solid aSolid=(*(TopoDS_Solid*)(&aItMSH.Key()));
|
||||
aNbMSH = aMSH.Extent();
|
||||
for (i = 1; i <= aNbMSH; ++i) {
|
||||
TopoDS_Solid aSolid=(*(TopoDS_Solid*)(&(aMSH.FindKey(i))));
|
||||
const BOPCol_ListOfShape& aLH = aMSH(i);
|
||||
//
|
||||
const BOPCol_ListOfShape& aLH=aItMSH.Value();
|
||||
aItLS.Initialize(aLH);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aHole = aItLS.Value();
|
||||
@@ -758,7 +734,7 @@ void BOPAlgo_BuilderSolid::PerformAreas()
|
||||
aItLS.Initialize(aHoleShells);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aHole = aItLS.Value();
|
||||
if (!aInOutMap.IsBound(aHole)){
|
||||
if (!aInOutMap.Contains(aHole)){
|
||||
TopoDS_Solid aSolid;
|
||||
//
|
||||
aBB.MakeSolid(aSolid);
|
||||
@@ -787,7 +763,7 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes()
|
||||
TopoDS_Iterator aIt;
|
||||
TopExp_Explorer aExp;
|
||||
BOPCol_ListIteratorOfListOfShape aItLS;
|
||||
BOPCol_MapOfShape aMFs;
|
||||
BOPCol_IndexedMapOfShape aMFs;
|
||||
BOPCol_ListOfShape aLSI;
|
||||
BOPAlgo_VectorOfFaceSolid aVFS;
|
||||
BOPAlgo_VectorOfFacePnt aVFP;
|
||||
@@ -807,7 +783,9 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes()
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Face& aF=*((TopoDS_Face*)&aIt.Value());
|
||||
//
|
||||
if (aMFs.Add(aF)) {
|
||||
if (!aMFs.Contains(aF)) {
|
||||
aMFs.Add(aF);
|
||||
//
|
||||
gp_Pnt aP;
|
||||
gp_Pnt2d aP2D;
|
||||
//
|
||||
@@ -985,27 +963,25 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes()
|
||||
//function : MakeInternalShells
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void MakeInternalShells(const BOPCol_MapOfShape& theMF,
|
||||
void MakeInternalShells(const BOPCol_IndexedMapOfShape& theMF,
|
||||
BOPCol_ListOfShape& theShells)
|
||||
{
|
||||
BOPCol_ListIteratorOfListOfShape aItF;
|
||||
Standard_Integer i, aNbF;
|
||||
BRep_Builder aBB;
|
||||
//
|
||||
BOPCol_ListIteratorOfListOfShape aItF;
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aMEF;
|
||||
BOPCol_MapIteratorOfMapOfShape aItM;
|
||||
BOPCol_MapOfShape aAddedFacesMap;
|
||||
//
|
||||
aItM.Initialize(theMF);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aF=aItM.Key();
|
||||
aNbF = theMF.Extent();
|
||||
for (i = 1; i <= aNbF; ++i) {
|
||||
TopoDS_Shape aF = theMF(i);
|
||||
BOPTools::MapShapesAndAncestors(aF,
|
||||
TopAbs_EDGE, TopAbs_FACE,
|
||||
aMEF);
|
||||
}
|
||||
//
|
||||
aItM.Initialize(theMF);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
TopoDS_Shape aFF=aItM.Key();
|
||||
for (i = 1; i <= aNbF; ++i) {
|
||||
TopoDS_Shape aFF = theMF(i);
|
||||
if (!aAddedFacesMap.Add(aFF)) {
|
||||
continue;
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <BOPDS_VectorOfListOfPaveBlock.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
@@ -141,19 +142,19 @@
|
||||
aType=aS.ShapeType();
|
||||
if (aType==theType) {
|
||||
if (myImages.IsBound(aS)){
|
||||
const BOPCol_ListOfShape& aLSIm=myImages.Find(aS);
|
||||
aItIm.Initialize(aLSIm);
|
||||
for (; aItIm.More(); aItIm.Next()) {
|
||||
const TopoDS_Shape& aSIm=aItIm.Value();
|
||||
if (aM.Add(aSIm)) {
|
||||
aBB.Add(myShape, aSIm);
|
||||
}
|
||||
}
|
||||
const BOPCol_ListOfShape& aLSIm=myImages.Find(aS);
|
||||
aItIm.Initialize(aLSIm);
|
||||
for (; aItIm.More(); aItIm.Next()) {
|
||||
const TopoDS_Shape& aSIm=aItIm.Value();
|
||||
if (aM.Add(aSIm)) {
|
||||
aBB.Add(myShape, aSIm);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aM.Add(aS)) {
|
||||
aBB.Add(myShape, aS);
|
||||
}
|
||||
if (aM.Add(aS)) {
|
||||
aBB.Add(myShape, aS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -239,6 +240,8 @@
|
||||
}
|
||||
}
|
||||
//
|
||||
aCIm.Closed(BRep_Tool::IsClosed(aCIm));
|
||||
//
|
||||
BOPCol_ListOfShape aLSIm(myAllocator);
|
||||
aLSIm.Append(aCIm);
|
||||
myImages.Bind(theS, aLSIm);
|
||||
@@ -286,9 +289,9 @@
|
||||
const BOPCol_ListOfShape& aLFIm=myImages.Find(aSX);
|
||||
aItIm.Initialize(aLFIm);
|
||||
for (; aItIm.More(); aItIm.Next()) {
|
||||
TopoDS_Shape aSXIm=aItIm.Value();
|
||||
aSXIm.Orientation(aOrX);
|
||||
aBB.Add(aCIm, aSXIm);
|
||||
TopoDS_Shape aSXIm=aItIm.Value();
|
||||
aSXIm.Orientation(aOrX);
|
||||
aBB.Add(aCIm, aSXIm);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@@ -265,7 +265,6 @@ void BOPAlgo_Builder::BuildSplitFaces()
|
||||
BOPCol_MapOfShape aMFence;
|
||||
Handle(NCollection_BaseAllocator) aAllocator;
|
||||
BOPCol_ListOfShape aLFIm(myAllocator);
|
||||
BOPCol_MapIteratorOfMapOfShape aItMS;
|
||||
BOPAlgo_VectorOfBuilderFace aVBF;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
@@ -867,27 +866,27 @@ Standard_Boolean HasPaveBlocksOnIn(const BOPDS_FaceInfo& aFI1,
|
||||
const BOPDS_FaceInfo& aFI2)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
BOPDS_MapIteratorOfMapOfPaveBlock aItMPB;
|
||||
Standard_Integer i, aNbPB;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBOn1=aFI1.PaveBlocksOn();
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBIn1=aFI1.PaveBlocksIn();
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBOn1 = aFI1.PaveBlocksOn();
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBIn1 = aFI1.PaveBlocksIn();
|
||||
//
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBOn2=aFI2.PaveBlocksOn();
|
||||
aItMPB.Initialize(aMPBOn2);
|
||||
for (; aItMPB.More(); aItMPB.Next()) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
|
||||
bRet=aMPBOn1.Contains(aPB) || aMPBIn1.Contains(aPB);
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBOn2 = aFI2.PaveBlocksOn();
|
||||
aNbPB = aMPBOn2.Extent();
|
||||
for (i = 1; i <= aNbPB; ++i) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aMPBOn2(i);
|
||||
bRet = aMPBOn1.Contains(aPB) || aMPBIn1.Contains(aPB);
|
||||
if (bRet) {
|
||||
return bRet;
|
||||
}
|
||||
}
|
||||
//
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBIn2=aFI2.PaveBlocksIn();
|
||||
aItMPB.Initialize(aMPBIn2);
|
||||
for (; aItMPB.More(); aItMPB.Next()) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
|
||||
bRet=aMPBOn1.Contains(aPB) || aMPBIn1.Contains(aPB);
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBIn2 = aFI2.PaveBlocksIn();
|
||||
aNbPB = aMPBIn2.Extent();
|
||||
for (i = 1; i <= aNbPB; ++i) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aMPBIn2(i);
|
||||
bRet = aMPBOn1.Contains(aPB) || aMPBIn1.Contains(aPB);
|
||||
if (bRet) {
|
||||
return bRet;
|
||||
}
|
||||
|
@@ -801,7 +801,6 @@ void BOPAlgo_Builder::BuildSplitSolids
|
||||
Standard_Integer i, aNbS;
|
||||
TopExp_Explorer aExp;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
BOPCol_DataMapIteratorOfDataMapOfShapeShape aIt1;
|
||||
//
|
||||
Handle(NCollection_IncAllocator) aAlr0;
|
||||
aAlr0=new NCollection_IncAllocator();
|
||||
@@ -933,7 +932,6 @@ void BOPAlgo_Builder::FillInternalShapes()
|
||||
TopAbs_State aState;
|
||||
TopoDS_Iterator aItS;
|
||||
BRep_Builder aBB;
|
||||
BOPCol_MapIteratorOfMapOfShape aItM;
|
||||
BOPCol_ListIteratorOfListOfShape aIt, aIt1;
|
||||
//
|
||||
Handle(NCollection_IncAllocator) aAllocator;
|
||||
@@ -942,12 +940,13 @@ void BOPAlgo_Builder::FillInternalShapes()
|
||||
//
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aMSx(100, aAllocator);
|
||||
BOPCol_IndexedMapOfShape aMx(100, aAllocator);
|
||||
BOPCol_MapOfShape aMSI(100, aAllocator);
|
||||
BOPCol_IndexedMapOfShape aMSI(100, aAllocator);
|
||||
BOPCol_MapOfShape aMFence(100, aAllocator);
|
||||
BOPCol_MapOfShape aMSOr(100, aAllocator);
|
||||
BOPCol_ListOfShape aLSd(aAllocator);
|
||||
BOPCol_ListOfShape aLArgs(aAllocator);
|
||||
BOPCol_ListOfShape aLSC(aAllocator);
|
||||
BOPCol_ListOfShape aLSI(aAllocator);
|
||||
//
|
||||
// 1. Shapes to process
|
||||
//
|
||||
@@ -1066,20 +1065,23 @@ void BOPAlgo_Builder::FillInternalShapes()
|
||||
//
|
||||
// 3. Some shapes of aMSI can be already tied with faces of
|
||||
// split solids
|
||||
aItM.Initialize(aMSI);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aSI=aItM.Key();
|
||||
aNbSI = aMSI.Extent();
|
||||
for (i = 1; i <= aNbSI; ++i) {
|
||||
const TopoDS_Shape& aSI = aMSI(i);
|
||||
if (aMSx.Contains(aSI)) {
|
||||
const BOPCol_ListOfShape &aLSx=aMSx.FindFromKey(aSI);
|
||||
aNbSx=aLSx.Extent();
|
||||
if (aNbSx) {
|
||||
aMSI.Remove(aSI);
|
||||
aNbSx = aLSx.Extent();
|
||||
if (!aNbSx) {
|
||||
aLSI.Append(aSI);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aLSI.Append(aSI);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 4. Just check it
|
||||
aNbSI=aMSI.Extent();
|
||||
aNbSI = aLSI.Extent();
|
||||
if (!aNbSI) {
|
||||
return;
|
||||
}
|
||||
@@ -1090,49 +1092,52 @@ void BOPAlgo_Builder::FillInternalShapes()
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Solid aSd=TopoDS::Solid(aIt.Value());
|
||||
//
|
||||
aItM.Initialize(aMSI);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
TopoDS_Shape aSI=aItM.Key();
|
||||
aIt1.Initialize(aLSI);
|
||||
for (; aIt1.More();) {
|
||||
TopoDS_Shape aSI = aIt1.Value();
|
||||
aSI.Orientation(TopAbs_INTERNAL);
|
||||
//
|
||||
aState=BOPTools_AlgoTools::ComputeStateByOnePoint
|
||||
(aSI, aSd, 1.e-11, myContext);
|
||||
if (aState==TopAbs_IN) {
|
||||
//
|
||||
if (aState != TopAbs_IN) {
|
||||
aIt1.Next();
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if(aMSOr.Contains(aSd)) {
|
||||
//
|
||||
if(aMSOr.Contains(aSd)) {
|
||||
//
|
||||
TopoDS_Solid aSdx;
|
||||
//
|
||||
aBB.MakeSolid(aSdx);
|
||||
aItS.Initialize(aSd);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aSh=aItS.Value();
|
||||
aBB.Add(aSdx, aSh);
|
||||
}
|
||||
//
|
||||
aBB.Add(aSdx, aSI);
|
||||
//
|
||||
if (myImages.IsBound(aSdx)) {
|
||||
BOPCol_ListOfShape& aLS=myImages.ChangeFind(aSdx);
|
||||
aLS.Append(aSdx);
|
||||
}
|
||||
else {
|
||||
BOPCol_ListOfShape aLS;
|
||||
aLS.Append(aSdx);
|
||||
myImages.Bind(aSd, aLS);
|
||||
}
|
||||
//
|
||||
aMSOr.Remove(aSd);
|
||||
aSd=aSdx;
|
||||
TopoDS_Solid aSdx;
|
||||
//
|
||||
aBB.MakeSolid(aSdx);
|
||||
aItS.Initialize(aSd);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aSh=aItS.Value();
|
||||
aBB.Add(aSdx, aSh);
|
||||
}
|
||||
//
|
||||
aBB.Add(aSdx, aSI);
|
||||
//
|
||||
if (myImages.IsBound(aSdx)) {
|
||||
BOPCol_ListOfShape& aLS=myImages.ChangeFind(aSdx);
|
||||
aLS.Append(aSdx);
|
||||
}
|
||||
else {
|
||||
aBB.Add(aSd, aSI);
|
||||
BOPCol_ListOfShape aLS;
|
||||
aLS.Append(aSdx);
|
||||
myImages.Bind(aSd, aLS);
|
||||
}
|
||||
//
|
||||
aMSI.Remove(aSI);
|
||||
} //if (aState==TopAbs_IN) {
|
||||
}// for (; aItM.More(); aItM.Next()) {
|
||||
}//for (; aIt1.More(); aIt1.Next()) {
|
||||
aMSOr.Remove(aSd);
|
||||
aSd=aSdx;
|
||||
}
|
||||
else {
|
||||
aBB.Add(aSd, aSI);
|
||||
}
|
||||
//
|
||||
aLSI.Remove(aIt1);
|
||||
}//for (; aIt1.More();) {
|
||||
}//for (; aIt.More(); aIt.Next()) {
|
||||
//
|
||||
//-----------------------------------------------------scope t
|
||||
aLArgs.Clear();
|
||||
|
@@ -47,7 +47,6 @@
|
||||
Standard_Boolean bWithSubShape;
|
||||
Standard_Integer n1, n2, iFlag, nX, n, aSize, i, j, k, aNbBlocks;
|
||||
Handle(NCollection_IncAllocator) aAllocator;
|
||||
BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItMILI;
|
||||
BOPCol_ListIteratorOfListOfInteger aItLI, aItLI2;
|
||||
TopoDS_Vertex aVn;
|
||||
BOPDS_ShapeInfo aSIn;
|
||||
|
@@ -740,8 +740,7 @@ void BOPAlgo_PaveFiller::TreatNewVertices
|
||||
BOPCol_IndexedMapOfShape aMVProcessed;
|
||||
BOPCol_MapOfInteger aMFence;
|
||||
BOPCol_ListIteratorOfListOfInteger aIt;
|
||||
BOPCol_DataMapOfShapeListOfShape aDMVLV;
|
||||
BOPCol_DataMapIteratorOfDataMapOfShapeListOfShape aItDMVLV;
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aDMVLV;
|
||||
//
|
||||
BOPCol_BoxBndTreeSelector aSelector;
|
||||
BOPCol_BoxBndTree aBBTree;
|
||||
@@ -781,7 +780,6 @@ void BOPAlgo_PaveFiller::TreatNewVertices
|
||||
//
|
||||
Standard_Integer aIP, aNbIP1, aIP1;
|
||||
BOPCol_ListOfShape aLVSD;
|
||||
BOPCol_MapIteratorOfMapOfInteger aItMI;
|
||||
BOPCol_ListOfInteger aLIP, aLIP1, aLIPC;
|
||||
BOPCol_ListIteratorOfListOfInteger aItLIP;
|
||||
//
|
||||
@@ -826,14 +824,14 @@ void BOPAlgo_PaveFiller::TreatNewVertices
|
||||
aLVSD.Append(aVP);
|
||||
}
|
||||
aVF=aLVSD.First();
|
||||
aDMVLV.Bind(aVF, aLVSD);
|
||||
aDMVLV.Add(aVF, aLVSD);
|
||||
}// for (i=1; i<=aNbV; ++i) {
|
||||
|
||||
// Make new vertices
|
||||
aItDMVLV.Initialize(aDMVLV);
|
||||
for(; aItDMVLV.More(); aItDMVLV.Next()) {
|
||||
const TopoDS_Shape& aV=aItDMVLV.Key();
|
||||
const BOPCol_ListOfShape& aLVSD=aItDMVLV.Value();
|
||||
aNbV = aDMVLV.Extent();
|
||||
for (i = 1; i <= aNbV; ++i) {
|
||||
const TopoDS_Shape& aV = aDMVLV.FindKey(i);
|
||||
const BOPCol_ListOfShape& aLVSD = aDMVLV(i);
|
||||
if (aLVSD.IsEmpty()) {
|
||||
myImages.Add(aV, aLVSD);
|
||||
}
|
||||
|
@@ -15,14 +15,12 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_SectionAttribute.hxx>
|
||||
#include <BOPAlgo_Tools.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerReal.hxx>
|
||||
#include <BOPCol_DataMapOfShapeInteger.hxx>
|
||||
#include <BOPCol_IndexedMapOfInteger.hxx>
|
||||
#include <BOPCol_ListOfInteger.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPCol_MapOfInteger.hxx>
|
||||
@@ -1727,41 +1725,70 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
const Standard_Integer iCheckExtend)
|
||||
{
|
||||
Standard_Boolean bIsVertexOnLine;
|
||||
Standard_Real aT, aTol, aTolNew;
|
||||
BOPDS_Pave aPave;
|
||||
Standard_Real aT, aTolV;
|
||||
//
|
||||
const TopoDS_Vertex aV = (*(TopoDS_Vertex *)(&myDS->Shape(nV)));
|
||||
const TopoDS_Vertex& aV = (*(TopoDS_Vertex *)(&myDS->Shape(nV)));
|
||||
Handle(BOPDS_PaveBlock)& aPB=aNC.ChangePaveBlock1();
|
||||
const IntTools_Curve& aIC = aNC.Curve();
|
||||
//
|
||||
bIsVertexOnLine=myContext->IsVertexOnLine(aV, aIC, aTolR3D, aT);
|
||||
if (!bIsVertexOnLine && iCheckExtend) {
|
||||
aTol = BRep_Tool::Tolerance(aV);
|
||||
aTolV = BRep_Tool::Tolerance(aV);
|
||||
//
|
||||
ExtendedTolerance(nV, aMI, aTol, iCheckExtend);
|
||||
bIsVertexOnLine=myContext->IsVertexOnLine(aV, aTol, aIC, aTolR3D, aT);
|
||||
ExtendedTolerance(nV, aMI, aTolV, iCheckExtend);
|
||||
bIsVertexOnLine=myContext->IsVertexOnLine(aV, aTolV, aIC, aTolR3D, aT);
|
||||
}
|
||||
//
|
||||
if (bIsVertexOnLine) {
|
||||
aPave.SetIndex(nV);
|
||||
aPave.SetParameter(aT);
|
||||
// check if aPB contains the parameter aT
|
||||
Standard_Boolean bExist;
|
||||
Standard_Integer nVToUpdate;
|
||||
Standard_Real aPTol, aDist, aTolVNew, aTolV2, aDTol;
|
||||
TopoDS_Vertex aVToUpdate;
|
||||
gp_Pnt aP1, aP2;
|
||||
//
|
||||
aPB->AppendExtPave(aPave);
|
||||
aTolV2 = 0.;
|
||||
aDTol = 1.e-12;
|
||||
//
|
||||
aTol = BRep_Tool::Tolerance(aV);
|
||||
GeomAdaptor_Curve aGAC(aIC.Curve());
|
||||
aPTol = aGAC.Resolution(aTolR3D);
|
||||
//
|
||||
BOPTools_AlgoTools::UpdateVertex (aIC, aT, aV);
|
||||
//
|
||||
if (!aMVTol.IsBound(nV)) {
|
||||
aTolNew = BRep_Tool::Tolerance(aV);
|
||||
if (aTolNew > aTol) {
|
||||
aMVTol.Bind(nV, aTol);
|
||||
}
|
||||
bExist = aPB->ContainsParameter(aT, aPTol, nVToUpdate);
|
||||
if (bExist) {
|
||||
// use existing pave
|
||||
aP1 = BRep_Tool::Pnt(aV);
|
||||
aTolV2 = BRep_Tool::Tolerance(aV);
|
||||
aVToUpdate = (*(TopoDS_Vertex *)(&myDS->Shape(nVToUpdate)));
|
||||
}
|
||||
else {
|
||||
// add new pave
|
||||
BOPDS_Pave aPave;
|
||||
aPave.SetIndex(nV);
|
||||
aPave.SetParameter(aT);
|
||||
aPB->AppendExtPave(aPave);
|
||||
//
|
||||
aP1 = aGAC.Value(aT);
|
||||
nVToUpdate = nV;
|
||||
aVToUpdate = aV;
|
||||
}
|
||||
//
|
||||
aTolV = BRep_Tool::Tolerance(aVToUpdate);
|
||||
aP2 = BRep_Tool::Pnt(aVToUpdate);
|
||||
aDist = aP1.Distance(aP2);
|
||||
aTolVNew = aDist - aTolV2;
|
||||
//
|
||||
if (aTolVNew > aTolV) {
|
||||
BRep_Builder aBB;
|
||||
aBB.UpdateVertex(aVToUpdate, aTolVNew+aDTol);
|
||||
//
|
||||
if (!aMVTol.IsBound(nVToUpdate)) {
|
||||
aMVTol.Bind(nVToUpdate, aTolV);
|
||||
}
|
||||
//
|
||||
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVToUpdate);
|
||||
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
|
||||
BRepBndLib::Add(aVToUpdate, aBoxDS);
|
||||
}
|
||||
//
|
||||
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
|
||||
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
|
||||
BRepBndLib::Add(aV, aBoxDS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2181,7 +2208,7 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
|
||||
}
|
||||
//
|
||||
if (bRebuild) {
|
||||
nSp = SplitEdge(aPB->Edge(), nV[0], aT[0], nV[1], aT[1]);
|
||||
nSp = SplitEdge(aPB->OriginalEdge(), nV[0], aT[0], nV[1], aT[1]);
|
||||
if (bCB) {
|
||||
aCB->SetEdge(nSp);
|
||||
}
|
||||
|
@@ -15,10 +15,9 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_SectionAttribute.hxx>
|
||||
#include <BOPCol_MapOfShape.hxx>
|
||||
#include <BOPCol_IndexedMapOfShape.hxx>
|
||||
#include <BOPCol_NCVector.hxx>
|
||||
#include <BOPCol_Parallel.hxx>
|
||||
#include <BOPDS_CommonBlock.hxx>
|
||||
@@ -55,6 +54,7 @@
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
|
||||
static
|
||||
Standard_Boolean IsBasedOnPlane(const TopoDS_Face& aF);
|
||||
|
||||
@@ -464,8 +464,8 @@ void BOPAlgo_PaveFiller::MakePCurves()
|
||||
{
|
||||
Standard_Boolean bHasPC;
|
||||
Standard_Integer i, nF1, nF2, aNbC, k, nE, aNbFF, aNbFI, nEx;
|
||||
Standard_Integer j, aNbPBIn, aNbPBOn;
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
|
||||
BOPDS_MapIteratorOfMapOfPaveBlock aItMPB;
|
||||
TopoDS_Face aF1F, aF2F;
|
||||
BOPAlgo_VectorOfMPC aVMPC;
|
||||
//
|
||||
@@ -483,9 +483,9 @@ void BOPAlgo_PaveFiller::MakePCurves()
|
||||
aF1F.Orientation(TopAbs_FORWARD);
|
||||
// In
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBIn=aFI.PaveBlocksIn();
|
||||
aItMPB.Initialize(aMPBIn);
|
||||
for(; aItMPB.More(); aItMPB.Next()) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
|
||||
aNbPBIn = aMPBIn.Extent();
|
||||
for (j = 1; j <= aNbPBIn; ++j) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aMPBIn(j);
|
||||
nE=aPB->Edge();
|
||||
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
|
||||
//
|
||||
@@ -497,9 +497,9 @@ void BOPAlgo_PaveFiller::MakePCurves()
|
||||
//
|
||||
// On
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBOn=aFI.PaveBlocksOn();
|
||||
aItMPB.Initialize(aMPBOn);
|
||||
for(; aItMPB.More(); aItMPB.Next()) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
|
||||
aNbPBOn = aMPBOn.Extent();
|
||||
for (j = 1; j <= aNbPBOn; ++j) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aMPBOn(j);
|
||||
nE=aPB->Edge();
|
||||
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
|
||||
bHasPC=BOPTools_AlgoTools2D::HasCurveOnSurface (aE, aF1F);
|
||||
@@ -707,10 +707,9 @@ void BOPAlgo_PaveFiller::Prepare()
|
||||
TopAbs_FACE
|
||||
};
|
||||
Standard_Boolean bJustAdd, bIsBasedOnPlane;
|
||||
Standard_Integer i, aNb, n1, nF;
|
||||
Standard_Integer i, aNb, n1, nF, aNbF;
|
||||
TopExp_Explorer aExp;
|
||||
BOPCol_MapOfShape aMF;
|
||||
BOPCol_MapIteratorOfMapOfShape aItMF;
|
||||
BOPCol_IndexedMapOfShape aMF;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
@@ -728,15 +727,15 @@ void BOPAlgo_PaveFiller::Prepare()
|
||||
}
|
||||
}
|
||||
//
|
||||
if (aMF.IsEmpty()) {
|
||||
aNbF = aMF.Extent();
|
||||
if (!aNbF) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BOPAlgo_VectorOfBPC aVBPC;
|
||||
//
|
||||
aItMF.Initialize(aMF);
|
||||
for (; aItMF.More(); aItMF.Next()) {
|
||||
const TopoDS_Face& aF=*((TopoDS_Face *)&aItMF.Key());
|
||||
for (i = 1; i <= aNbF; ++i) {
|
||||
const TopoDS_Face& aF = *(TopoDS_Face*)&aMF(i);
|
||||
aExp.Init(aF, aType[1]);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Edge& aE=*((TopoDS_Edge *)&aExp.Current());
|
||||
|
@@ -138,15 +138,14 @@ static
|
||||
const Standard_Integer nF,
|
||||
BOPDS_ListOfPaveBlock& aLPBOut)
|
||||
{
|
||||
Standard_Integer nV1, nV2;
|
||||
BOPDS_MapIteratorOfMapOfPaveBlock aItMPB;
|
||||
Standard_Integer i, aNbPBOn, aNbPBIn, aNbPBSc, nV1, nV2;
|
||||
//
|
||||
const BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
|
||||
// In
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBIn=aFI.PaveBlocksIn();
|
||||
aItMPB.Initialize(aMPBIn);
|
||||
for(; aItMPB.More(); aItMPB.Next()) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
|
||||
aNbPBIn = aMPBIn.Extent();
|
||||
for (i = 1; i <= aNbPBIn; ++i) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aMPBIn(i);
|
||||
aPB->Indices(nV1, nV2);
|
||||
if (nV==nV1 || nV==nV2) {
|
||||
aLPBOut.Append(aPB);
|
||||
@@ -154,9 +153,9 @@ static
|
||||
}
|
||||
// On
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBOn=aFI.PaveBlocksOn();
|
||||
aItMPB.Initialize(aMPBOn);
|
||||
for(; aItMPB.More(); aItMPB.Next()) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
|
||||
aNbPBOn = aMPBOn.Extent();
|
||||
for (i = 1; i <= aNbPBOn; ++i) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aMPBOn(i);
|
||||
aPB->Indices(nV1, nV2);
|
||||
if (nV==nV1 || nV==nV2) {
|
||||
aLPBOut.Append(aPB);
|
||||
@@ -164,9 +163,9 @@ static
|
||||
}
|
||||
// Sections
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBSc=aFI.PaveBlocksSc();
|
||||
aItMPB.Initialize(aMPBSc);
|
||||
for(; aItMPB.More(); aItMPB.Next()) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
|
||||
aNbPBSc = aMPBSc.Extent();
|
||||
for (i = 1; i <= aNbPBSc; ++i) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aMPBSc(i);
|
||||
aPB->Indices(nV1, nV2);
|
||||
if (nV==nV1 || nV==nV2) {
|
||||
aLPBOut.Append(aPB);
|
||||
@@ -240,7 +239,7 @@ static
|
||||
const Handle(BOPDS_PaveBlock)& aPBD)
|
||||
{
|
||||
Standard_Boolean bXDir, bIsDone;
|
||||
Standard_Integer nE, aNbPoints, j;
|
||||
Standard_Integer nE, aNbPoints, j, anInd;
|
||||
Standard_Real aTD1, aTD2, aT1, aT2, aTolInter, aX, aDT;
|
||||
Standard_Real aTolCmp;
|
||||
gp_Pnt2d aP2d1, aP2d2, aP2D;
|
||||
@@ -325,7 +324,7 @@ static
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (aPBD->ContainsParameter(aX, aDT)) {
|
||||
if (aPBD->ContainsParameter(aX, aDT, anInd)) {
|
||||
continue;
|
||||
}
|
||||
aPave.SetParameter(aX);
|
||||
|
@@ -118,7 +118,6 @@ void BOPAlgo_WireSplitter::MakeConnexityBlocks()
|
||||
TopoDS_Iterator aItE;
|
||||
TopoDS_Shape aER;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
BOPCol_MapIteratorOfMapOfShape aItM;
|
||||
//
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aMVE(100, myAllocator);
|
||||
BOPCol_IndexedMapOfShape aMVP(100, myAllocator);
|
||||
@@ -182,7 +181,7 @@ void BOPAlgo_WireSplitter::MakeConnexityBlocks()
|
||||
}
|
||||
}
|
||||
}
|
||||
}//for (; aItM.More(); aItM.Next()) {
|
||||
}//for (k=1; k<=aNbVP; ++k) {
|
||||
//
|
||||
aNbVP=aMVAdd.Extent();
|
||||
if (!aNbVP) {
|
||||
|
@@ -13,6 +13,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include <TopoDS_Edge.hxx>
|
||||
|
||||
@@ -85,7 +86,7 @@ typedef NCollection_IndexedDataMap<TopoDS_Shape, \
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void BOPAlgo_WireSplitter::MakeWire(BOPCol_ListOfShape& aLE,
|
||||
TopoDS_Wire& aWire)
|
||||
TopoDS_Wire& aWire)
|
||||
{
|
||||
BRep_Builder aBB;
|
||||
aBB.MakeWire(aWire);
|
||||
@@ -94,4 +95,5 @@ typedef NCollection_IndexedDataMap<TopoDS_Shape, \
|
||||
for (; aIt.More(); aIt.Next()){
|
||||
aBB.Add(aWire, aIt.Value());
|
||||
}
|
||||
aWire.Closed(BRep_Tool::IsClosed(aWire));
|
||||
}
|
||||
|
@@ -12,10 +12,9 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BOPAlgo_WireEdgeSet.hxx>
|
||||
#include <BOPAlgo_WireSplitter.hxx>
|
||||
#include <BOPCol_DataMapOfShapeInteger.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeInteger.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPCol_MapOfShape.hxx>
|
||||
@@ -49,7 +48,6 @@
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
|
||||
typedef NCollection_DataMap \
|
||||
<TopoDS_Shape, Standard_Boolean, TopTools_ShapeMapHasher> \
|
||||
BOPCol_DataMapOfShapeBoolean;
|
||||
@@ -841,8 +839,7 @@ void RefineAngles(const TopoDS_Face& myFace,
|
||||
BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo& mySmartMap)
|
||||
{
|
||||
Standard_Integer aNb, i;
|
||||
BOPCol_DataMapOfShapeInteger aMSI;
|
||||
BOPCol_DataMapIteratorOfDataMapOfShapeInteger aItMSI;
|
||||
BOPCol_IndexedDataMapOfShapeInteger aMSI;
|
||||
BOPCol_MapOfShape aMBE;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
@@ -850,32 +847,29 @@ void RefineAngles(const TopoDS_Face& myFace,
|
||||
aIt.Initialize(myEdges);
|
||||
for(; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aE=aIt.Value();
|
||||
if(aMSI.IsBound(aE)) {
|
||||
Standard_Integer& iCnt=aMSI.ChangeFind(aE);
|
||||
if(aMSI.Contains(aE)) {
|
||||
Standard_Integer& iCnt = aMSI.ChangeFromKey(aE);
|
||||
++iCnt;
|
||||
}
|
||||
else {
|
||||
Standard_Integer iCnt=1;
|
||||
aMSI.Bind(aE, iCnt);
|
||||
Standard_Integer iCnt = 1;
|
||||
aMSI.Add(aE, iCnt);
|
||||
}
|
||||
}
|
||||
//
|
||||
aItMSI.Initialize(aMSI);
|
||||
for(; aItMSI.More(); aItMSI.Next()) {
|
||||
Standard_Integer iCnt;
|
||||
//
|
||||
const TopoDS_Shape& aE=aItMSI.Key();
|
||||
iCnt=aItMSI.Value();
|
||||
if (iCnt==1) {
|
||||
aNb = aMSI.Extent();
|
||||
for (i = 1; i <= aNb; ++i) {
|
||||
Standard_Integer iCnt = aMSI(i);
|
||||
if (iCnt == 1) {
|
||||
const TopoDS_Shape& aE = aMSI.FindKey(i);
|
||||
aMBE.Add(aE);
|
||||
}
|
||||
|
||||
}
|
||||
//
|
||||
aMSI.Clear();
|
||||
//
|
||||
aNb=mySmartMap.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
aNb = mySmartMap.Extent();
|
||||
for (i = 1; i <= aNb; ++i) {
|
||||
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&mySmartMap.FindKey(i));
|
||||
BOPAlgo_ListOfEdgeInfo& aLEI=mySmartMap(i);
|
||||
//
|
||||
|
25
src/BOPCol/BOPCol_IndexedDataMapOfShapeShape.hxx
Normal file
25
src/BOPCol/BOPCol_IndexedDataMapOfShapeShape.hxx
Normal file
@@ -0,0 +1,25 @@
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2015 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 BOPCol_IndexedDataMapOfShapeShape_HeaderFile
|
||||
#define BOPCol_IndexedDataMapOfShapeShape_HeaderFile
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
|
||||
#include <NCollection_IndexedDataMap.hxx>
|
||||
|
||||
typedef NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> BOPCol_IndexedDataMapOfShapeShape;
|
||||
|
||||
#endif
|
@@ -1,4 +1,5 @@
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2015 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
@@ -11,17 +12,14 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef OPENGL_TRANSFORM_PERSISTENCE_H
|
||||
#define OPENGL_TRANSFORM_PERSISTENCE_H
|
||||
#ifndef BOPCol_IndexedMapOfOrientedShape_HeaderFile
|
||||
#define BOPCol_IndexedMapOfOrientedShape_HeaderFile
|
||||
|
||||
enum TP_FLAGS
|
||||
{
|
||||
TPF_PAN = 0x001,
|
||||
TPF_ZOOM = 0x002,
|
||||
TPF_ROTATE = 0x008,
|
||||
TPF_TRIEDRON = 0x020,
|
||||
TPF_2D = 0x040,
|
||||
TPF_2D_ISTOPDOWN = 0x041
|
||||
};
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_OrientedShapeMapHasher.hxx>
|
||||
|
||||
#endif /*OPENGL_TRANSFORM_PERSISTENCE_H*/
|
||||
#include <NCollection_IndexedMap.hxx>
|
||||
|
||||
typedef NCollection_IndexedMap<TopoDS_Shape, TopTools_OrientedShapeMapHasher> BOPCol_IndexedMapOfOrientedShape;
|
||||
|
||||
#endif
|
@@ -21,6 +21,8 @@ BOPCol_IndexedDataMapOfShapeInteger.hxx
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape.hxx
|
||||
BOPCol_IndexedMapOfInteger.hxx
|
||||
BOPCol_IndexedMapOfShape.hxx
|
||||
BOPCol_IndexedDataMapOfShapeShape.hxx
|
||||
BOPCol_IndexedMapOfOrientedShape.hxx
|
||||
BOPCol_ListOfInteger.hxx
|
||||
BOPCol_ListOfListOfShape.hxx
|
||||
BOPCol_ListOfShape.hxx
|
||||
|
@@ -1363,7 +1363,7 @@ void BOPDS_DS::FaceInfoIn(const Standard_Integer theF,
|
||||
if (aSx.ShapeType()==TopAbs_VERTEX){
|
||||
nV=Index(aSx);
|
||||
if (HasShapeSD(nV, nVSD)) {
|
||||
nV=nVSD;
|
||||
nV=nVSD;
|
||||
}
|
||||
theMI.Add(nV);
|
||||
}
|
||||
@@ -1446,20 +1446,19 @@ void BOPDS_DS::AloneVertices(const Standard_Integer theI,
|
||||
{
|
||||
if (HasFaceInfo(theI)) {
|
||||
//
|
||||
Standard_Integer i, nV1, nV2, nV;
|
||||
BOPDS_MapIteratorOfMapOfPaveBlock aItMPB;
|
||||
Standard_Integer i, j, nV1, nV2, nV, aNbPB;
|
||||
BOPCol_MapIteratorOfMapOfInteger aItMI;
|
||||
//
|
||||
BOPCol_MapOfInteger aMI(100, myAllocator);
|
||||
//
|
||||
const BOPDS_FaceInfo& aFI=FaceInfo(theI);
|
||||
//
|
||||
for (i=0; i<2; ++i) {
|
||||
for (i = 0; i < 2; ++i) {
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPB=
|
||||
(!i) ? aFI.PaveBlocksIn() : aFI.PaveBlocksSc();
|
||||
aItMPB.Initialize(aMPB);
|
||||
for (; aItMPB.More(); aItMPB.Next()) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
|
||||
aNbPB = aMPB.Extent();
|
||||
for (j = 1; j <= aNbPB; ++j) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aMPB(j);
|
||||
aPB->Indices(nV1, nV2);
|
||||
aMI.Add(nV1);
|
||||
aMI.Add(nV2);
|
||||
|
@@ -12,14 +12,12 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BOPCol_BoxBndTree.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerInteger.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
|
||||
#include <BOPCol_DataMapOfShapeInteger.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
|
||||
#include <BOPCol_IndexedMapOfInteger.hxx>
|
||||
#include <BOPCol_ListOfInteger.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_IndexRange.hxx>
|
||||
@@ -89,7 +87,6 @@ void BOPDS_IteratorSI::Intersect()
|
||||
TopAbs_ShapeEnum aTi, aTj;
|
||||
Handle(NCollection_IncAllocator) aAllocator;
|
||||
BOPCol_ListIteratorOfListOfInteger aIt;
|
||||
BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD;
|
||||
//
|
||||
//-----------------------------------------------------scope_1 f
|
||||
aAllocator=new NCollection_IncAllocator();
|
||||
@@ -120,10 +117,10 @@ void BOPDS_IteratorSI::Intersect()
|
||||
const BOPCol_ListOfInteger& aLA=aSI.SubShapes();
|
||||
aIt.Initialize(aLA);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
iX=aIt.Value();
|
||||
aPKXB.Clear();
|
||||
aPKXB.SetIds(i, iX);
|
||||
aMPA.Add(aPKXB);
|
||||
iX=aIt.Value();
|
||||
aPKXB.Clear();
|
||||
aPKXB.SetIds(i, iX);
|
||||
aMPA.Add(aPKXB);
|
||||
}
|
||||
}
|
||||
//
|
||||
|
@@ -236,21 +236,19 @@
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BOPDS_PaveBlock::ContainsParameter(const Standard_Real theT,
|
||||
const Standard_Real theTol)const
|
||||
const Standard_Real theTol,
|
||||
Standard_Integer& theInd) const
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Real dT;
|
||||
BOPDS_ListIteratorOfListOfPave aIt;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
bRet = Standard_False;
|
||||
aIt.Initialize(myExtPaves);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
dT=aIt.Value().Parameter()-theT;
|
||||
if (dT<0.) {
|
||||
dT=-dT;
|
||||
}
|
||||
if (dT<theTol) {
|
||||
bRet=!bRet;
|
||||
const BOPDS_Pave& aPave = aIt.Value();
|
||||
bRet = (Abs(aPave.Parameter() - theT) < theTol);
|
||||
if (bRet) {
|
||||
theInd = aPave.Index();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -129,7 +129,8 @@ public:
|
||||
//! Selector
|
||||
//! Returns the pave indices <theIndex1,theIndex2>
|
||||
//! of the pave block
|
||||
Standard_EXPORT void Indices (Standard_Integer& theIndex1, Standard_Integer& theIndex2) const;
|
||||
Standard_EXPORT void Indices (Standard_Integer& theIndex1,
|
||||
Standard_Integer& theIndex2) const;
|
||||
|
||||
|
||||
//! Query
|
||||
@@ -162,28 +163,36 @@ public:
|
||||
//! to create new pave blocks <theLPB>.
|
||||
//! <theFlag> - if true, the first pave and the second
|
||||
//! pave are used to produce new pave blocks.
|
||||
Standard_EXPORT void Update (BOPDS_ListOfPaveBlock& theLPB, const Standard_Boolean theFlag = Standard_True);
|
||||
Standard_EXPORT void Update (BOPDS_ListOfPaveBlock& theLPB,
|
||||
const Standard_Boolean theFlag = Standard_True);
|
||||
|
||||
|
||||
//! Query
|
||||
//! Returns true if the extra paves contain the pave
|
||||
//! with given value of the parameter <thePrm>
|
||||
//! <theTol> - the value of the tolerance to compare
|
||||
Standard_EXPORT Standard_Boolean ContainsParameter (const Standard_Real thePrm, const Standard_Real theTol) const;
|
||||
//! <theInd> - index of the found pave
|
||||
Standard_EXPORT Standard_Boolean ContainsParameter (const Standard_Real thePrm,
|
||||
const Standard_Real theTol,
|
||||
Standard_Integer& theInd) const;
|
||||
|
||||
|
||||
//! Modifier
|
||||
//! Sets the shrunk data for the pave block
|
||||
//! <theTS1>, <theTS2> - shrunk range
|
||||
//! <theBox> - the bounding box
|
||||
Standard_EXPORT void SetShrunkData (const Standard_Real theTS1, const Standard_Real theTS2, const Bnd_Box& theBox);
|
||||
Standard_EXPORT void SetShrunkData (const Standard_Real theTS1,
|
||||
const Standard_Real theTS2,
|
||||
const Bnd_Box& theBox);
|
||||
|
||||
|
||||
//! Selector
|
||||
//! Returns the shrunk data for the pave block
|
||||
//! <theTS1>, <theTS2> - shrunk range
|
||||
//! <theBox> - the bounding box
|
||||
Standard_EXPORT void ShrunkData (Standard_Real& theTS1, Standard_Real& theTS2, Bnd_Box& theBox) const;
|
||||
Standard_EXPORT void ShrunkData (Standard_Real& theTS1,
|
||||
Standard_Real& theTS2,
|
||||
Bnd_Box& theBox) const;
|
||||
|
||||
|
||||
//! Query
|
||||
|
@@ -39,8 +39,9 @@ void BOPTest::AllCommands(Draw_Interpretor& theCommands)
|
||||
BOPTest::TolerCommands (theCommands);
|
||||
BOPTest::ObjCommands (theCommands);
|
||||
BOPTest::PartitionCommands (theCommands);
|
||||
BOPTest::APICommands (theCommands);
|
||||
BOPTest::OptionCommands (theCommands);
|
||||
BOPTest::APICommands (theCommands);
|
||||
BOPTest::OptionCommands (theCommands);
|
||||
BOPTest::HistoryCommands (theCommands);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Factory
|
||||
|
@@ -53,6 +53,7 @@ public:
|
||||
|
||||
Standard_EXPORT static void Factory (Draw_Interpretor& aDI);
|
||||
|
||||
Standard_EXPORT static void HistoryCommands (Draw_Interpretor& aDI);
|
||||
|
||||
|
||||
|
||||
|
@@ -379,7 +379,9 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
Standard_Boolean isS2 = Standard_False;
|
||||
Standard_Integer indxS2 = 0;
|
||||
Standard_Real aTolerance = 0;
|
||||
|
||||
Standard_Boolean bRunParallel;
|
||||
//
|
||||
bRunParallel=BOPTest_Objects::RunParallel();
|
||||
aTolerance=BOPTest_Objects::FuzzyValue();
|
||||
|
||||
if(n >= 3) {
|
||||
@@ -424,6 +426,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
|
||||
// init checker
|
||||
BOPAlgo_ArgumentAnalyzer aChecker;
|
||||
aChecker.SetRunParallel(bRunParallel);
|
||||
aChecker.SetFuzzyValue(aTolerance);
|
||||
aChecker.SetShape1(aS1);
|
||||
|
||||
|
184
src/BOPTest/BOPTest_HistoryCommands.cxx
Normal file
184
src/BOPTest/BOPTest_HistoryCommands.cxx
Normal file
@@ -0,0 +1,184 @@
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2015 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 <BOPTest.hxx>
|
||||
//
|
||||
#include <Draw.hxx>
|
||||
#include <DBRep.hxx>
|
||||
//
|
||||
#include <BRep_Builder.hxx>
|
||||
//
|
||||
#include <TopoDS_Compound.hxx>
|
||||
//
|
||||
#include <BOPAlgo_Builder.hxx>
|
||||
//
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
//
|
||||
#include <BOPTest_DrawableShape.hxx>
|
||||
#include <BOPTest_Objects.hxx>
|
||||
|
||||
//
|
||||
static Standard_Integer bmodified (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
static Standard_Integer bgenerated (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
static Standard_Integer bisdeleted (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
|
||||
//=======================================================================
|
||||
//function : HistoryCommands
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTest::HistoryCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
// Chapter's name
|
||||
const char* g = "BOPTest commands";
|
||||
// Commands
|
||||
theCommands.Add("bmodified" , "Use: bmodified rc shape", __FILE__, bmodified , g);
|
||||
theCommands.Add("bgenerated", "Use: bgenerated rc shape", __FILE__, bgenerated, g);
|
||||
theCommands.Add("bisdeleted", "Use: bisdeleted shape" , __FILE__, bisdeleted, g);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : bmodified
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer bmodified(Draw_Interpretor& di,
|
||||
Standard_Integer n,
|
||||
const char** a)
|
||||
{
|
||||
if (n < 3) {
|
||||
di << "Use: bmodified rc shape\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
TopoDS_Shape aS = DBRep::Get(a[2]);
|
||||
if (aS.IsNull()) {
|
||||
di << "Null shape\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
TopAbs_ShapeEnum aType = aS.ShapeType();
|
||||
if (!(aType==TopAbs_VERTEX || aType==TopAbs_EDGE ||
|
||||
aType==TopAbs_FACE || aType==TopAbs_SOLID)) {
|
||||
di << "The shape must be one of the following types: VERTEX, EDGE, FACE or SOLID\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
BOPAlgo_Builder& aBuilder = BOPTest_Objects::Builder();
|
||||
const TopTools_ListOfShape& aLS = aBuilder.Modified(aS);
|
||||
//
|
||||
if (aLS.IsEmpty()) {
|
||||
di << "The shape has not been modified\n";
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Compound aRes;
|
||||
//
|
||||
aBB.MakeCompound(aRes);
|
||||
TopTools_ListIteratorOfListOfShape aIt(aLS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS = aIt.Value();
|
||||
aBB.Add(aRes, aS);
|
||||
}
|
||||
//
|
||||
DBRep::Set(a[1], aRes);
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : bgenerated
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer bgenerated(Draw_Interpretor& di,
|
||||
Standard_Integer n,
|
||||
const char** a)
|
||||
{
|
||||
if (n < 3) {
|
||||
di << "Use: bgenerated rc shape\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
TopoDS_Shape aS = DBRep::Get(a[2]);
|
||||
if (aS.IsNull()) {
|
||||
di << "Null shape\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
TopAbs_ShapeEnum aType = aS.ShapeType();
|
||||
if (!(aType==TopAbs_VERTEX || aType==TopAbs_EDGE ||
|
||||
aType==TopAbs_FACE || aType==TopAbs_SOLID)) {
|
||||
di << "The shape must be one of the following types: VERTEX, EDGE, FACE or SOLID\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
BOPAlgo_Builder& aBuilder = BOPTest_Objects::Builder();
|
||||
const TopTools_ListOfShape& aLS = aBuilder.Generated(aS);
|
||||
//
|
||||
if (aLS.IsEmpty()) {
|
||||
di << "No shapes were generated from the shape\n";
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Compound aRes;
|
||||
//
|
||||
aBB.MakeCompound(aRes);
|
||||
TopTools_ListIteratorOfListOfShape aIt(aLS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS = aIt.Value();
|
||||
aBB.Add(aRes, aS);
|
||||
}
|
||||
//
|
||||
DBRep::Set(a[1], aRes);
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : bisdeleted
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer bisdeleted(Draw_Interpretor& di,
|
||||
Standard_Integer n,
|
||||
const char** a)
|
||||
{
|
||||
if (n < 2) {
|
||||
di << "Use: bisdeleted shape\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
TopoDS_Shape aS = DBRep::Get(a[1]);
|
||||
if (aS.IsNull()) {
|
||||
di << "Null shape\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
TopAbs_ShapeEnum aType = aS.ShapeType();
|
||||
if (!(aType==TopAbs_VERTEX || aType==TopAbs_EDGE ||
|
||||
aType==TopAbs_FACE || aType==TopAbs_SOLID)) {
|
||||
di << "The shape must be one of the following types: VERTEX, EDGE, FACE or SOLID\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
BOPAlgo_Builder& aBuilder = BOPTest_Objects::Builder();
|
||||
Standard_Boolean isDeleted = aBuilder.IsDeleted(aS);
|
||||
//
|
||||
di << (isDeleted ? "Deleted" : "Not deleted") << "\n";
|
||||
//
|
||||
return 0;
|
||||
}
|
@@ -158,6 +158,7 @@ Standard_Integer bbuild(Draw_Interpretor& di,
|
||||
//
|
||||
BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller();
|
||||
//
|
||||
BOPTest_Objects::SetBuilderDefault();
|
||||
BOPAlgo_Builder& aBuilder=BOPTest_Objects::Builder();
|
||||
aBuilder.Clear();
|
||||
//
|
||||
@@ -320,6 +321,8 @@ Standard_Integer bbop(Draw_Interpretor& di,
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
BOPTest_Objects::SetBuilder(pBuilder);
|
||||
//
|
||||
DBRep::Set(a[1], aR);
|
||||
return 0;
|
||||
}
|
||||
|
@@ -12,3 +12,4 @@ BOPTest_Objects.hxx
|
||||
BOPTest_OptionCommands.cxx
|
||||
BOPTest_PartitionCommands.cxx
|
||||
BOPTest_TolerCommands.cxx
|
||||
BOPTest_HistoryCommands.cxx
|
@@ -24,13 +24,16 @@
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
|
||||
//! Tool class implementing necessary functionality for copying geometry
|
||||
class BRepBuilderAPI_Copy_Modification : public BRepTools_Modification
|
||||
{
|
||||
public:
|
||||
BRepBuilderAPI_Copy_Modification (const Standard_Boolean copyGeom)
|
||||
: myCopyGeom(copyGeom)
|
||||
BRepBuilderAPI_Copy_Modification (const Standard_Boolean copyGeom,
|
||||
const Standard_Boolean copyMesh = Standard_False)
|
||||
: myCopyGeom(copyGeom),
|
||||
myCopyMesh(copyMesh)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -50,6 +53,23 @@ public:
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy triangulation;
|
||||
//! copies it if required
|
||||
Standard_Boolean NewTriangulation(const TopoDS_Face& F, Handle(Poly_Triangulation)& T)
|
||||
{
|
||||
if (!myCopyMesh)
|
||||
return Standard_False;
|
||||
|
||||
TopLoc_Location L;
|
||||
T = BRep_Tool::Triangulation(F, L);
|
||||
|
||||
if (T.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
T = T->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy edge;
|
||||
//! copies curves if requested
|
||||
Standard_Boolean NewCurve (const TopoDS_Edge& E, Handle(Geom_Curve)& C,
|
||||
@@ -118,6 +138,7 @@ public:
|
||||
|
||||
private:
|
||||
Standard_Boolean myCopyGeom;
|
||||
Standard_Boolean myCopyMesh;
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(BRepBuilderAPI_Copy_Modification, BRepTools_Modification)
|
||||
@@ -139,9 +160,9 @@ BRepBuilderAPI_Copy::BRepBuilderAPI_Copy ()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepBuilderAPI_Copy::BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_Boolean copyGeom)
|
||||
BRepBuilderAPI_Copy::BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_Boolean copyGeom, const Standard_Boolean copyMesh)
|
||||
{
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(copyGeom);
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(copyGeom, copyMesh);
|
||||
DoModif(S);
|
||||
}
|
||||
|
||||
@@ -151,9 +172,9 @@ BRepBuilderAPI_Copy::BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_B
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepBuilderAPI_Copy::Perform(const TopoDS_Shape& S, const Standard_Boolean copyGeom)
|
||||
void BRepBuilderAPI_Copy::Perform(const TopoDS_Shape& S, const Standard_Boolean copyGeom, const Standard_Boolean copyMesh)
|
||||
{
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(copyGeom);
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(copyGeom, copyMesh);
|
||||
NotDone(); // on force la copie si on vient deja d`en faire une
|
||||
DoModif(S);
|
||||
}
|
||||
|
@@ -48,13 +48,13 @@ public:
|
||||
//! geometry will be shared with original shape.
|
||||
//! Note: the constructed framework can be reused to copy
|
||||
//! other shapes: just specify them with the function Perform.
|
||||
Standard_EXPORT BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_Boolean copyGeom = Standard_True);
|
||||
Standard_EXPORT BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_Boolean copyGeom = Standard_True, const Standard_Boolean copyMesh = Standard_False);
|
||||
|
||||
//! Copies the shape S.
|
||||
//! Use the function Shape to access the result.
|
||||
//! If copyGeom is False, only topological objects will be copied, while
|
||||
//! geometry will be shared with original shape.
|
||||
Standard_EXPORT void Perform (const TopoDS_Shape& S, const Standard_Boolean copyGeom = Standard_True);
|
||||
Standard_EXPORT void Perform (const TopoDS_Shape& S, const Standard_Boolean copyGeom = Standard_True, const Standard_Boolean copyMesh = Standard_False);
|
||||
|
||||
|
||||
|
||||
|
@@ -284,7 +284,7 @@ void BRepBuilderAPI_FastSewing::Perform(void)
|
||||
Standard_Real aRange = Compute3DRange();
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
NCollection_CellFilter<NodeInspector>
|
||||
aCells(Max(myTolerance, aRange/IntegerLast()), anAlloc);
|
||||
aCells(NodeInspector::Dimension, Max(myTolerance, aRange/IntegerLast()), anAlloc);
|
||||
|
||||
for(Standard_Integer i = myFaceVec.Lower(); i <= myFaceVec.Upper(); i++)
|
||||
{
|
||||
|
@@ -2778,7 +2778,7 @@ static Standard_Boolean GlueVertices(TopTools_IndexedDataMapOfShapeShape& aVerte
|
||||
Standard_Integer i, nbVertices = aVertexNode.Extent();
|
||||
// Create map of node -> vertices
|
||||
TopTools_IndexedDataMapOfShapeListOfShape NodeVertices;
|
||||
BRepBuilderAPI_CellFilter aFilter (Tolerance);
|
||||
BRepBuilderAPI_CellFilter aFilter (BRepBuilderAPI_VertexInspector::Dimension, Tolerance);
|
||||
BRepBuilderAPI_VertexInspector anInspector (Tolerance);
|
||||
for (i = 1; i <= nbVertices; i++) {
|
||||
TopoDS_Shape vertex = aVertexNode.FindKey(i);
|
||||
|
@@ -101,6 +101,32 @@
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
|
||||
#include <TColStd_IndexedMapOfReal.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <NCollection_QuickSort.hxx>
|
||||
#include <BRepTopAdaptor_FClass2d.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <Geom2dAPI_InterCurveCurve.hxx>
|
||||
#include <BRepTools_ReShape.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
#include <Poly_MakeLoops.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <GeomLib.hxx>
|
||||
#include <BRepFill.hxx>
|
||||
#include <ShapeExtend_WireData.hxx>
|
||||
#include <ShapeFix_Wire.hxx>
|
||||
#include <ShapeAnalysis_WireOrder.hxx>
|
||||
#include <ShapeAnalysis_Wire.hxx>
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
#include <BndLib_Add2dCurve.hxx>
|
||||
#include <Bnd_Box2d.hxx>
|
||||
#include <NCollection_DoubleMap.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <NCollection_UBTree.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <TopTools_Array1OfShape.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef OCCT_DEBUG
|
||||
//#define DRAW
|
||||
@@ -120,6 +146,304 @@ static Standard_Integer NbBISSEC = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//! This struct defines link (i.e. edge) with its vertices and first derivative of pcurves on the both tails of the edge
|
||||
struct TopoLink
|
||||
{
|
||||
TopoDS_Vertex myFV;
|
||||
TopoDS_Vertex myLV;
|
||||
gp_Dir2d myD1L;
|
||||
gp_Dir2d myD1F;
|
||||
};
|
||||
|
||||
typedef NCollection_UBTree <Standard_Integer, Bnd_Box2d> BRepFill_BndBoxTree;
|
||||
|
||||
|
||||
//! This class is used to select overlapping 2d boxes, stored in NCollection::UBTree
|
||||
class BRepFill_BndBoxTreeSelector : public BRepFill_BndBoxTree::Selector
|
||||
{
|
||||
public:
|
||||
//! Defines "edge in intersection" info
|
||||
struct EdgeParam
|
||||
{
|
||||
TopoDS_Edge myEdgeInt; //edge in intersection
|
||||
double myParamInt; // parameter on the edge
|
||||
TopoDS_Vertex myIntVertex; // Vertex of the intersection point
|
||||
};
|
||||
|
||||
public:
|
||||
BRepFill_BndBoxTreeSelector( const TopTools_Array1OfShape& theSeqOfEdges,
|
||||
const TopoDS_Face& theWFace)
|
||||
: BRepFill_BndBoxTreeSelector::Selector(), mySeqOfEdges (theSeqOfEdges), myWFace (theWFace) {}
|
||||
|
||||
Standard_Boolean Reject (const Bnd_Box2d& theBox) const
|
||||
{
|
||||
return (myCBox.IsOut (theBox));
|
||||
}
|
||||
|
||||
Standard_Boolean Accept (const Standard_Integer& theObj)
|
||||
{
|
||||
//intersection between bounding boxes was found, try to find intersection of edges
|
||||
NCollection_List<NCollection_Array1<int>>::Iterator It(myEdgeIndexes);
|
||||
for (; It.More(); It.Next())
|
||||
{
|
||||
if (It.Value()(1) == myCInd && It.Value()(2) == theObj) //skip already computed intersections
|
||||
return Standard_False;
|
||||
}
|
||||
if (theObj != myCInd) //try to find intersection between two given edges
|
||||
{
|
||||
TopoDS_Edge E1 = TopoDS::Edge(mySeqOfEdges(theObj));
|
||||
TopoDS_Edge E2 = TopoDS::Edge(mySeqOfEdges(myCInd));
|
||||
{
|
||||
Handle_Geom2d_Curve aCur1;
|
||||
double f, l;
|
||||
aCur1 = BRep_Tool::CurveOnSurface(E1, myWFace, f, l );
|
||||
|
||||
Handle_Geom2d_Curve aCur2;
|
||||
double f2, l2;
|
||||
aCur2 = BRep_Tool::CurveOnSurface(E2, myWFace, f2, l2 );
|
||||
|
||||
double IntPrec = Precision::Confusion();
|
||||
Geom2dAPI_InterCurveCurve inter(aCur1, aCur2, IntPrec);
|
||||
|
||||
for (int i = 1; i <= inter.Intersector().NbPoints(); i++)
|
||||
{
|
||||
double Param1 = inter.Intersector().Point(i).ParamOnFirst();
|
||||
double Param2 = inter.Intersector().Point(i).ParamOnSecond();
|
||||
double prec = 1e-5;
|
||||
if (f + prec < Param1 && Param1 < l - prec && f2 + prec < Param2 && Param2 < l2 - prec)
|
||||
{
|
||||
// Save result of intersection to the map (edge -> seq. of parameters on it)
|
||||
if (!myOutMapOfResult.IsBound(E1))
|
||||
{
|
||||
NCollection_Sequence<double> SeqOfParams;
|
||||
SeqOfParams.Append(Param1);
|
||||
myOutMapOfResult.Bind(E1, SeqOfParams);
|
||||
}
|
||||
else
|
||||
{
|
||||
NCollection_Sequence<double> Val = myOutMapOfResult(E1);
|
||||
Val.Append(Param1);
|
||||
myOutMapOfResult.Bind(E1, Val);
|
||||
}
|
||||
|
||||
if (!myOutMapOfResult.IsBound(E2))
|
||||
{
|
||||
NCollection_Sequence<double> SeqOfParams;
|
||||
SeqOfParams.Append(Param2);
|
||||
myOutMapOfResult.Bind(E2, SeqOfParams);
|
||||
}
|
||||
else
|
||||
{
|
||||
NCollection_Sequence<double> Val = myOutMapOfResult(E2);
|
||||
Val.Append(Param2);
|
||||
myOutMapOfResult.Bind(E2, Val);
|
||||
}
|
||||
TopoDS_Vertex V;
|
||||
|
||||
// Make vertex from intersection point
|
||||
double f_1, f_2, l_1, l_2;
|
||||
TopLoc_Location Loc1, Loc2;
|
||||
gp_Pnt p3d1, p3d2;
|
||||
Handle_Geom_Curve aCur1 = BRep_Tool::Curve(E1, Loc1, f_1, l_1 );
|
||||
Handle_Geom_Curve aCur2 = BRep_Tool::Curve(E2, Loc2, f_2, l_2 );
|
||||
aCur1->D0(Param1, p3d1);
|
||||
aCur2->D0(Param2, p3d2);
|
||||
if (!Loc1.IsIdentity())
|
||||
p3d1.Transform(Loc1.Transformation());
|
||||
if (!Loc2.IsIdentity())
|
||||
p3d2.Transform(Loc2.Transformation());
|
||||
gp_Pnt IntPnt((p3d1.X() + p3d2.X())/2., (p3d1.Y() + p3d2.Y())/2., (p3d1.Z() + p3d2.Z())/2.); //middle point of two intersection points of edge1 & edge2
|
||||
double TolE1 = BRep_Tool::Tolerance(E1);
|
||||
double TolE2 = BRep_Tool::Tolerance(E2);
|
||||
|
||||
myBuilder.MakeVertex(V, IntPnt, 1.01 * (::Max(TolE1, TolE2) + (p3d1.Distance(p3d2)/2.)));
|
||||
|
||||
NCollection_List<BRepFill_BndBoxTreeSelector::EdgeParam> aList;
|
||||
BRepFill_BndBoxTreeSelector::EdgeParam ep;
|
||||
|
||||
ep.myEdgeInt = E1;
|
||||
ep.myParamInt = Param1;
|
||||
ep.myIntVertex = V;
|
||||
myListOfVertexEdgePar.Append(ep);
|
||||
|
||||
ep.myEdgeInt = E2;
|
||||
ep.myParamInt = Param2;
|
||||
ep.myIntVertex = V;
|
||||
myListOfVertexEdgePar.Append(ep);
|
||||
|
||||
NCollection_Array1<int> anIndArr(1, 2);
|
||||
anIndArr(1) = theObj;
|
||||
anIndArr(2) = myCInd;
|
||||
myEdgeIndexes.Append(anIndArr);
|
||||
aCur1.Nullify();
|
||||
aCur2.Nullify();
|
||||
}
|
||||
}
|
||||
aCur1.Nullify();
|
||||
aCur2.Nullify();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else //try to find self-intersection of edge
|
||||
{
|
||||
TopoDS_Edge E1 = TopoDS::Edge(mySeqOfEdges(theObj));
|
||||
{
|
||||
Handle_Geom2d_Curve aCur1;
|
||||
double f, l;
|
||||
aCur1 = BRep_Tool::CurveOnSurface(E1, myWFace, f, l );
|
||||
|
||||
double IntPrec = Precision::Confusion();
|
||||
Geom2dAPI_InterCurveCurve inter(aCur1, IntPrec);
|
||||
|
||||
for (int i = 1; i <= inter.Intersector().NbPoints(); i++)
|
||||
{
|
||||
double Param1 = inter.Intersector().Point(i).ParamOnFirst();
|
||||
double Param2 = inter.Intersector().Point(i).ParamOnSecond();
|
||||
double prec = 1e-5;
|
||||
if (f + prec < Param1 && Param1 < l - prec && f + prec < Param2 && Param2 < l - prec)
|
||||
{
|
||||
// Save result of intersection to the map (edge -> seq. of parameters on it)
|
||||
if (!myOutMapOfResult.IsBound(E1))
|
||||
{
|
||||
NCollection_Sequence<double> SeqOfParams;
|
||||
SeqOfParams.Append(Param1);
|
||||
SeqOfParams.Append(Param2);
|
||||
myOutMapOfResult.Bind(E1, SeqOfParams);
|
||||
}
|
||||
else
|
||||
{
|
||||
NCollection_Sequence<double> Val = myOutMapOfResult(E1);
|
||||
Val.Append(Param1);
|
||||
Val.Append(Param2);
|
||||
myOutMapOfResult.Bind(E1, Val);
|
||||
}
|
||||
|
||||
// Make vertex from intersection point
|
||||
TopoDS_Vertex V;
|
||||
|
||||
double f_1, l_1 ;
|
||||
TopLoc_Location Loc1;
|
||||
gp_Pnt p3d1, p3d2;
|
||||
Handle_Geom_Curve aCur1 = BRep_Tool::Curve(E1, Loc1, f_1, l_1 );
|
||||
aCur1->D0(Param1, p3d1);
|
||||
aCur1->D0(Param2, p3d2);
|
||||
if (!Loc1.IsIdentity())
|
||||
p3d1.Transform(Loc1.Transformation());
|
||||
gp_Pnt IntPnt((p3d1.X() + p3d2.X())/2., (p3d1.Y() + p3d2.Y())/2., (p3d1.Z() + p3d2.Z())/2.);
|
||||
double TolE1 = BRep_Tool::Tolerance(E1);
|
||||
|
||||
myBuilder.MakeVertex(V, IntPnt, 1.01* (TolE1 + (p3d1.Distance(p3d2)/2.)));
|
||||
|
||||
NCollection_List<BRepFill_BndBoxTreeSelector::EdgeParam> aList;
|
||||
BRepFill_BndBoxTreeSelector::EdgeParam ep;
|
||||
|
||||
ep.myEdgeInt = E1;
|
||||
ep.myParamInt = Param1;
|
||||
ep.myIntVertex = V;
|
||||
myListOfVertexEdgePar.Append(ep);
|
||||
|
||||
ep.myEdgeInt = E1;
|
||||
ep.myParamInt = Param2;
|
||||
ep.myIntVertex = V;
|
||||
myListOfVertexEdgePar.Append(ep);
|
||||
|
||||
NCollection_Array1<int> anIndArr(1, 2);
|
||||
anIndArr(1) = theObj;
|
||||
anIndArr(2) = theObj;
|
||||
myEdgeIndexes.Append(anIndArr);
|
||||
aCur1.Nullify();
|
||||
}
|
||||
}
|
||||
aCur1.Nullify();
|
||||
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
void ClearResult()
|
||||
{
|
||||
myOutMapOfResult.Clear();
|
||||
}
|
||||
|
||||
void SetCurrentBox (const Bnd_Box2d& theBox, int theInd)
|
||||
{
|
||||
myCBox = theBox;
|
||||
myCInd = theInd;
|
||||
}
|
||||
|
||||
void GetResult( NCollection_DataMap<TopoDS_Edge, NCollection_Sequence<double>>& theOutMapOfResult)
|
||||
{
|
||||
theOutMapOfResult = myOutMapOfResult;
|
||||
}
|
||||
|
||||
void GetListOfVertexEdgePar( NCollection_List<BRepFill_BndBoxTreeSelector::EdgeParam>& theOutList)
|
||||
{
|
||||
theOutList = myListOfVertexEdgePar;
|
||||
}
|
||||
|
||||
private:
|
||||
BRepFill_BndBoxTreeSelector(const BRepFill_BndBoxTreeSelector& );
|
||||
BRepFill_BndBoxTreeSelector& operator=(const BRepFill_BndBoxTreeSelector& );
|
||||
|
||||
private:
|
||||
const TopTools_Array1OfShape& mySeqOfEdges; //edges to be intersected with each other
|
||||
const TopoDS_Face& myWFace; //work spine face
|
||||
NCollection_DataMap<TopoDS_Edge, NCollection_Sequence<double>> myOutMapOfResult; // map "edge to it's intersection parameters"
|
||||
NCollection_List<BRepFill_BndBoxTreeSelector::EdgeParam> myListOfVertexEdgePar;
|
||||
Bnd_Box2d myCBox;
|
||||
int myCInd;
|
||||
NCollection_List<NCollection_Array1<int>> myEdgeIndexes; //used to store already computed edge's indexes
|
||||
BRep_Builder myBuilder;
|
||||
};
|
||||
|
||||
|
||||
class Poly_Helper : public Poly_MakeLoops2D::Helper
|
||||
{
|
||||
public:
|
||||
Poly_Helper(TopTools_IndexedMapOfShape& themN2V,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& themV2E,
|
||||
NCollection_DoubleMap<Poly_MakeLoops2D::Link, TopoDS_Edge>& themPL2E,
|
||||
NCollection_DataMap<TopoDS_Edge, TopoLink>& themE2EInfo,
|
||||
const NCollection_DataMap<int, Poly_MakeLoops2D::ListOfLink>& themNode2ListOfLinks) :
|
||||
mymN2V (themN2V), mymV2E (themV2E), mymPL2E (themPL2E), mymE2EInfo (themE2EInfo),
|
||||
mymNode2ListOfLinks (themNode2ListOfLinks)
|
||||
{
|
||||
//Poly_MakeLoops2D::Helper();
|
||||
};
|
||||
|
||||
virtual const Poly_MakeLoops2D::ListOfLink& GetAdjacentLinks (Standard_Integer theNode) const
|
||||
{
|
||||
return mymNode2ListOfLinks(theNode);
|
||||
}
|
||||
virtual Standard_Boolean GetFirstTangent(const Poly_MakeLoops2D::Link& theLink, gp_Dir2d& theDir) const
|
||||
{
|
||||
TopoDS_Edge E = mymPL2E.Find1(theLink);
|
||||
theDir = mymE2EInfo(E).myD1F;
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual Standard_Boolean GetLastTangent(const Poly_MakeLoops2D::Link& theLink, gp_Dir2d& theDir) const
|
||||
{
|
||||
TopoDS_Edge E = mymPL2E.Find1(theLink);
|
||||
theDir = mymE2EInfo(E).myD1L;
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
Poly_Helper(const Poly_Helper& theOther);
|
||||
Poly_Helper& operator= (const Poly_Helper &theOther);
|
||||
|
||||
private:
|
||||
TopTools_IndexedMapOfShape& mymN2V; //map 'node to vertex'
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& mymV2E;
|
||||
NCollection_DoubleMap<Poly_MakeLoops2D::Link, TopoDS_Edge>& mymPL2E; //map 'link to edge'
|
||||
NCollection_DataMap<TopoDS_Edge, TopoLink>& mymE2EInfo;
|
||||
const NCollection_DataMap<int, Poly_MakeLoops2D::ListOfLink>& mymNode2ListOfLinks; //used internally by poly_makeloops algo
|
||||
|
||||
};
|
||||
|
||||
// Modified by Sergey KHROMOV - Thu Nov 16 17:24:39 2000 Begin
|
||||
|
||||
static void QuasiFleche(const Adaptor3d_Curve& C,
|
||||
@@ -222,6 +546,8 @@ static void MakeOffset
|
||||
const GeomAbs_JoinType theJoinType,
|
||||
const TopoDS_Vertex * Ends);
|
||||
|
||||
static bool RemoveLoops(TopoDS_Shape& theInputSh, const TopoDS_Face& theWorkSpine, const Handle(Geom_Plane)& theRefPlane );
|
||||
|
||||
//=======================================================================
|
||||
//function : KPartCircle
|
||||
//purpose :
|
||||
@@ -811,6 +1137,24 @@ void BRepFill_OffsetWire::PerformWithBiLo
|
||||
}
|
||||
}
|
||||
|
||||
//Remove possible hanging arcs on vertices
|
||||
if (myIsOpenResult && myJoinType == GeomAbs_Arc)
|
||||
{
|
||||
if (!myMap.IsEmpty() &&
|
||||
myMap.FindKey(1).ShapeType() == TopAbs_VERTEX)
|
||||
{
|
||||
//myMap.RemoveFirst();
|
||||
TopoDS_Shape LastShape = myMap.FindKey(myMap.Extent());
|
||||
TopTools_ListOfShape LastList;
|
||||
LastList.Append(myMap(myMap.Extent()));
|
||||
myMap.RemoveLast();
|
||||
if (!myMap.IsEmpty())
|
||||
myMap.Substitute(1, LastShape, LastList);
|
||||
}
|
||||
if (!myMap.IsEmpty() &&
|
||||
myMap.FindKey(myMap.Extent()).ShapeType() == TopAbs_VERTEX)
|
||||
myMap.RemoveLast();
|
||||
}
|
||||
|
||||
#ifdef OCCT_DEBUG
|
||||
#ifdef DRAW
|
||||
@@ -1140,6 +1484,8 @@ void BRepFill_OffsetWire::PerformWithBiLo
|
||||
if (!myIsOpenResult)
|
||||
FixHoles();
|
||||
|
||||
RemoveLoops(myShape, myWorkSpine, RefPlane);
|
||||
|
||||
myIsDone = Standard_True;
|
||||
}
|
||||
|
||||
@@ -2734,3 +3080,485 @@ static void QuasiFleche(const Adaptor3d_Curve& C,
|
||||
}
|
||||
}
|
||||
|
||||
static bool AddIntersectionVertices(const Handle_Geom_Plane& theRefPlane,
|
||||
const TopoDS_Face& theWorkSpine,
|
||||
const TopTools_Array1OfShape& Seq,
|
||||
Handle(BRepTools_ReShape)& reshape,
|
||||
TopoDS_Wire& aW,
|
||||
TopTools_IndexedMapOfShape& EdgesInInter,
|
||||
TopTools_MapOfShape& InterV )
|
||||
{
|
||||
NCollection_DataMap<TopoDS_Edge, NCollection_Sequence<double>> ME2IP; //map edge to params on this edges
|
||||
gp_Pln pl = theRefPlane->Pln();
|
||||
|
||||
//Prepare UBTree filler
|
||||
// Used to speedup the intersection process by using overlapped 2d bounding boxes
|
||||
BRepFill_BndBoxTree aTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFiller (aTree);
|
||||
|
||||
BRepFill_BndBoxTreeSelector aSelector(Seq, theWorkSpine);
|
||||
|
||||
// Prepare bounding boxes
|
||||
int EdgeSize = Seq.Length();
|
||||
NCollection_Array1<Bnd_Box2d> BndBoxesOfEdges(1, EdgeSize);
|
||||
for (int i = 1; i <= EdgeSize; i++)
|
||||
{
|
||||
double f, l;
|
||||
Handle_Geom2d_Curve aCur = BRep_Tool::CurveOnSurface(TopoDS::Edge(Seq(i)), theWorkSpine, f, l );
|
||||
Bnd_Box2d aBox;
|
||||
BndLib_Add2dCurve::Add( aCur, f, l, 0., aBox );
|
||||
//aBox.Enlarge(1e-4);
|
||||
aTreeFiller.Add(i, aBox);
|
||||
BndBoxesOfEdges.SetValue(i, aBox);
|
||||
}
|
||||
|
||||
aTreeFiller.Fill();
|
||||
|
||||
//Perform searching and intersecting of edges
|
||||
aSelector.ClearResult();
|
||||
for (int i = 1; i <= BndBoxesOfEdges.Size(); i++)
|
||||
{
|
||||
aSelector.SetCurrentBox(BndBoxesOfEdges(i), i);
|
||||
aTree.Select(aSelector);
|
||||
}
|
||||
|
||||
aSelector.GetResult(ME2IP); //Retrieve result from algo
|
||||
NCollection_List<BRepFill_BndBoxTreeSelector::EdgeParam> LVEP;
|
||||
aSelector.GetListOfVertexEdgePar(LVEP);
|
||||
|
||||
if (ME2IP.IsEmpty())
|
||||
return false; //if no intersection point => go to the next wire
|
||||
|
||||
for (NCollection_DataMap<TopoDS_Edge, NCollection_Sequence<double>>::Iterator aMapIt (ME2IP); aMapIt.More(); aMapIt.Next())
|
||||
{
|
||||
TopoDS_Edge E = aMapIt.Key();
|
||||
//NCollection_Sequence<double> Params = aMapIt.Value();
|
||||
Handle_Geom_Curve aCur;
|
||||
double f, l;
|
||||
aCur = BRep_Tool::Curve(E, f, l );
|
||||
|
||||
//prepare params on the edge
|
||||
NCollection_Sequence<double> ParamSeq = aMapIt.Value();
|
||||
ParamSeq.Append(f);
|
||||
ParamSeq.Append(l);
|
||||
//ParamSeq.Append(Params);
|
||||
|
||||
//sort parameters
|
||||
NCollection_QuickSort<NCollection_Sequence<double>, double>::Perform(ParamSeq, NCollection_Comparator<double>(), ParamSeq.Lower(), ParamSeq.Upper());
|
||||
NCollection_Sequence<TopoDS_Vertex> aVOnEdge; //Vertexes on the edge which divide it in the intersection points into sequence of edges
|
||||
TopoDS_Vertex VF, VL;
|
||||
VF = TopExp::FirstVertex(E);
|
||||
VL = TopExp::LastVertex(E);
|
||||
aVOnEdge.Append(VF);
|
||||
|
||||
for (int i = 2; i <= ParamSeq.Length() - 1; i++)
|
||||
{
|
||||
double P = ParamSeq(i);
|
||||
TopoDS_Vertex MV;
|
||||
for (NCollection_List<BRepFill_BndBoxTreeSelector::EdgeParam>::Iterator anIt (LVEP); anIt.More(); anIt.Next())
|
||||
{
|
||||
BRepFill_BndBoxTreeSelector::EdgeParam ep = anIt.Value();
|
||||
if (ep.myEdgeInt == E && ep.myParamInt == P)
|
||||
{
|
||||
MV = anIt.Value().myIntVertex;
|
||||
InterV.Add(MV);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
aVOnEdge.Append(MV);
|
||||
}
|
||||
aVOnEdge.Append(VL);
|
||||
|
||||
//Split old edge => Construct a new sequence of new edges
|
||||
NCollection_Array1<TopoDS_Edge> NewEdgeSeq (1, aVOnEdge.Length() - 1);
|
||||
TopoDS_Edge DE;
|
||||
for (int j = 1; j < aVOnEdge.Length(); j++)
|
||||
{
|
||||
DE = BRepBuilderAPI_MakeEdge(aCur, aVOnEdge(j), aVOnEdge(j+1), ParamSeq(j), ParamSeq(j+1));
|
||||
BRep_Builder BB;
|
||||
BB.UpdateEdge(DE, BRep_Tool::Tolerance(E));
|
||||
NewEdgeSeq.SetValue(j, DE);
|
||||
}
|
||||
|
||||
BRepBuilderAPI_MakeWire MW;
|
||||
for (int i = 1; i <= NewEdgeSeq.Length(); i++)
|
||||
{
|
||||
MW.Add(NewEdgeSeq(i));
|
||||
EdgesInInter.Add(NewEdgeSeq(i));
|
||||
}
|
||||
MW.Build();
|
||||
TopoDS_Wire TW = MW.Wire(); //make wire from the sequence of edges
|
||||
TW.Orientation(E.Orientation());
|
||||
reshape->Replace(E, TW); //replace old edge with wire
|
||||
}
|
||||
|
||||
aW = TopoDS::Wire(reshape->Apply(aW));
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool AddAdditionalVertices( Handle(BRepTools_ReShape)& reshape,
|
||||
TopoDS_Wire& aW,
|
||||
TopTools_IndexedMapOfShape& EdgesInInter)
|
||||
{
|
||||
bool Stat = true;
|
||||
// Prepare wire for Poly_MakeLoops algo:
|
||||
// Insert neccesary vertices if two edges shares same (two) vertices
|
||||
for (int i = 1; i <= EdgesInInter.Extent() && Stat; i++)
|
||||
for (int j = i; j <= EdgesInInter.Extent() && Stat; j++)
|
||||
{
|
||||
TopoDS_Edge E1 = TopoDS::Edge(EdgesInInter(i));
|
||||
TopoDS_Edge E2 = TopoDS::Edge(EdgesInInter(j));
|
||||
if (E1 == E2)
|
||||
continue;
|
||||
TopoDS_Vertex VF1, VL1, VF2, VL2;
|
||||
TopExp::Vertices(E1, VF1, VL1);
|
||||
TopExp::Vertices(E2, VF2, VL2);
|
||||
if ((VF1.IsSame(VF2) && VL1.IsSame(VL2)) || (VF1.IsSame(VL2) && VL1.IsSame(VF2)))
|
||||
{
|
||||
gp_Pnt MP;
|
||||
Handle_Geom_Curve cur;
|
||||
double f, l;
|
||||
cur = BRep_Tool::Curve(E1, f, l);
|
||||
cur->D0(f + (l-f)/2., MP);
|
||||
TopoDS_Vertex MV = BRepLib_MakeVertex(MP);
|
||||
TopoDS_Edge DE1, DE2;
|
||||
BRepBuilderAPI_MakeEdge MEB;
|
||||
MEB.Init(cur, VF1, MV, f, f + (l-f)/2 );
|
||||
if (!MEB.IsDone()) {
|
||||
Stat = false;
|
||||
break;
|
||||
}
|
||||
DE1 = MEB.Edge();
|
||||
MEB.Init(cur, MV, VL1, f + (l-f)/2, l );
|
||||
if (!MEB.IsDone()) {
|
||||
Stat = false;
|
||||
break;
|
||||
}
|
||||
DE2 = MEB.Edge();
|
||||
TopoDS_Wire W = BRepBuilderAPI_MakeWire(DE1, DE2);
|
||||
TopTools_IndexedMapOfShape DummyM;
|
||||
TopExp::MapShapes(W, TopAbs_VERTEX, DummyM);
|
||||
if (DummyM.Extent() !=3 )
|
||||
{
|
||||
Stat = false;
|
||||
break;
|
||||
}
|
||||
reshape->Replace(E1, W.Oriented(E1.Orientation()));
|
||||
}
|
||||
}
|
||||
|
||||
if (Stat)
|
||||
aW = TopoDS::Wire(reshape->Apply(aW));
|
||||
return Stat;
|
||||
}
|
||||
|
||||
bool RemoveEdgeLoop(Handle(BRepTools_ReShape)& reshape,
|
||||
TopoDS_Wire& aW,
|
||||
NCollection_Vector<TopoDS_Wire>& EdgeLoop )
|
||||
{
|
||||
// If edges contains only one vertex => check if it's a loop
|
||||
// If it's a loop then remove it from wire
|
||||
//bool Stat = true;
|
||||
TopExp_Explorer ExpE( aW, TopAbs_EDGE );
|
||||
for (; ExpE.More(); ExpE.Next())
|
||||
{
|
||||
TopoDS_Edge E = TopoDS::Edge(ExpE.Current());
|
||||
TopoDS_Vertex VF, VL;
|
||||
TopExp::Vertices(E, VF, VL);
|
||||
|
||||
if (VF.IsSame( VL )/* && (InterV.Contains(VL) || InterV.Contains(VF))*/)
|
||||
{
|
||||
reshape->Remove(E, true);
|
||||
if (BRep_Tool::Degenerated(E))
|
||||
continue;
|
||||
BRepBuilderAPI_MakeWire WM(E);
|
||||
if (WM.Wire().Closed())
|
||||
EdgeLoop.Append(WM.Wire());
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DoReorder( Handle(BRepTools_ReShape)& reshape,
|
||||
TopoDS_Wire& aW)
|
||||
{
|
||||
//Perform reorder of wire
|
||||
aW = TopoDS::Wire(reshape->Apply(aW));
|
||||
Handle(ShapeExtend_WireData) aWireData = new ShapeExtend_WireData;
|
||||
Handle(ShapeFix_Wire) aShFixWire = new ShapeFix_Wire;
|
||||
|
||||
Handle(ShapeAnalysis_Wire) aWireAnalyzer;
|
||||
ShapeAnalysis_WireOrder aWireOrder;
|
||||
|
||||
aShFixWire->Load(aWireData);
|
||||
aShFixWire->SetPrecision(1e-7);
|
||||
|
||||
TopExp_Explorer Exp1( aW, TopAbs_EDGE );
|
||||
for (; Exp1.More(); Exp1.Next())
|
||||
aWireData->Add(TopoDS::Edge(Exp1.Current()));
|
||||
|
||||
aWireOrder.KeepLoopsMode() = 0;
|
||||
aWireAnalyzer = aShFixWire->Analyzer();
|
||||
aShFixWire->ModifyTopologyMode() = Standard_True;
|
||||
//aShFixWire->FixConnected(1e-7);
|
||||
aWireAnalyzer->CheckOrder(aWireOrder, Standard_True);
|
||||
aWireOrder.Perform(1);
|
||||
aShFixWire->ClosedWireMode() = 1;
|
||||
aShFixWire->FixReorder(aWireOrder);
|
||||
//aShFixWire->FixDegenerated();
|
||||
bool IsDone = !aShFixWire->StatusReorder(ShapeExtend_FAIL);
|
||||
|
||||
if (!IsDone)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
aW = aWireData->Wire();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static bool ExtractLoopsFromWire(TopoDS_Wire& aW,
|
||||
const TopoDS_Face& theWorkSpine,
|
||||
NCollection_Vector<TopoDS_Wire>& aLoops)
|
||||
{
|
||||
// Prepare 'TopoLink' info for Poly_MakeLoops algo => Calculate derivatives of the edges
|
||||
NCollection_DataMap<TopoDS_Edge, TopoLink> mE2EInfo;
|
||||
TopExp_Explorer ExpE(aW, TopAbs_EDGE);
|
||||
for (; ExpE.More(); ExpE.Next())
|
||||
{
|
||||
TopoLink anEngeInfo;
|
||||
TopoDS_Edge E = TopoDS::Edge(ExpE.Current());
|
||||
Handle_Geom2d_Curve aCur;
|
||||
double f, l;
|
||||
gp_Pnt2d Pnt;
|
||||
gp_Vec2d Vec;
|
||||
|
||||
aCur = BRep_Tool::CurveOnSurface(E, theWorkSpine, f, l );
|
||||
if (aCur.IsNull())
|
||||
continue;
|
||||
if (E.Orientation() == TopAbs_FORWARD)
|
||||
{
|
||||
anEngeInfo.myFV = TopExp::FirstVertex(E);
|
||||
anEngeInfo.myLV = TopExp::LastVertex(E);
|
||||
aCur->D1(f, Pnt, Vec);
|
||||
anEngeInfo.myD1F.SetCoord(Vec.X(), Vec.Y());
|
||||
aCur->D1(l, Pnt, Vec);
|
||||
anEngeInfo.myD1L.SetCoord(Vec.X(), Vec.Y());
|
||||
}
|
||||
else
|
||||
{
|
||||
anEngeInfo.myFV = TopExp::LastVertex(E);
|
||||
anEngeInfo.myLV = TopExp::FirstVertex(E);
|
||||
aCur->D1(l, Pnt, Vec);
|
||||
anEngeInfo.myD1F.SetCoord(-Vec.X(), -Vec.Y());
|
||||
aCur->D1(f, Pnt, Vec);
|
||||
anEngeInfo.myD1L.SetCoord(-Vec.X(), -Vec.Y());
|
||||
}
|
||||
mE2EInfo.Bind(E, anEngeInfo);
|
||||
}
|
||||
|
||||
TopTools_IndexedMapOfShape mN2V;
|
||||
TopExp::MapShapes(aW, TopAbs_VERTEX, mN2V);
|
||||
|
||||
TopTools_IndexedDataMapOfShapeListOfShape mV2E;
|
||||
TopExp::MapShapesAndAncestors(aW, TopAbs_VERTEX, TopAbs_EDGE, mV2E);
|
||||
|
||||
//Create links for Poly_MakeLoops algo and bind them to the existing edges
|
||||
NCollection_DoubleMap<Poly_MakeLoops2D::Link, TopoDS_Edge> mPL2E;
|
||||
ExpE.Init(aW, TopAbs_EDGE);
|
||||
for (; ExpE.More(); ExpE.Next())
|
||||
{
|
||||
TopoDS_Edge E = TopoDS::Edge(ExpE.Current());
|
||||
if (!mE2EInfo.IsBound(E))
|
||||
continue;
|
||||
TopoLink L = mE2EInfo(E);
|
||||
int Node1 = mN2V.FindIndex(L.myFV);
|
||||
int Node2 = mN2V.FindIndex(L.myLV);
|
||||
Poly_MakeLoops2D::Link aLink(Node1, Node2);
|
||||
aLink.flags = Poly_MakeLoops2D::LF_Fwd;
|
||||
mPL2E.Bind(aLink, E);
|
||||
}
|
||||
|
||||
NCollection_DataMap<int, Poly_MakeLoops2D::ListOfLink> mNode2ListOfLinks;
|
||||
for (int i = 1; i <= mN2V.Extent(); i++)
|
||||
{
|
||||
TopoDS_Vertex V = TopoDS::Vertex(mN2V(i));
|
||||
TopTools_ListOfShape Edges = mV2E.FindFromKey(V);
|
||||
TopTools_ListIteratorOfListOfShape It(Edges);
|
||||
Poly_MakeLoops2D::ListOfLink aListOfLinks;
|
||||
for (;It.More(); It.Next())
|
||||
{
|
||||
TopoDS_Edge E = TopoDS::Edge(It.Value());
|
||||
if (!mPL2E.IsBound2(E))
|
||||
continue;
|
||||
Poly_MakeLoops2D::Link aL = mPL2E.Find2(E);
|
||||
aListOfLinks.Append(aL);
|
||||
}
|
||||
mNode2ListOfLinks.Bind(i, aListOfLinks);
|
||||
}
|
||||
|
||||
Poly_Helper helper(mN2V, mV2E, mPL2E, mE2EInfo, mNode2ListOfLinks);
|
||||
Poly_MakeLoops2D aLoopMaker(1, &helper, NCollection_BaseAllocator::CommonBaseAllocator() );
|
||||
for (NCollection_DoubleMap<Poly_MakeLoops2D::Link, TopoDS_Edge>::Iterator aMapIt (mPL2E); aMapIt.More(); aMapIt.Next())
|
||||
aLoopMaker.AddLink(aMapIt.Key1());
|
||||
|
||||
aLoopMaker.Perform(); //try to find loops
|
||||
int NbLoops = aLoopMaker.GetNbLoops();
|
||||
int NbHangs = aLoopMaker.GetNbHanging();
|
||||
|
||||
if (NbLoops == 0 || NbHangs != 0 )
|
||||
return false;
|
||||
|
||||
for (int i = 1; i <= NbLoops; i++) //try to construct loops
|
||||
{
|
||||
Poly_MakeLoops2D::Loop aLoop = aLoopMaker.GetLoop(i);
|
||||
Poly_MakeLoops2D::Loop::Iterator it(aLoop);
|
||||
BRepBuilderAPI_MakeWire aWM;
|
||||
TopoDS_Edge E;
|
||||
for (;it.More(); it.Next())
|
||||
{
|
||||
E = mPL2E.Find1(it.Value());
|
||||
aWM.Add(E);
|
||||
}
|
||||
if (aWM.IsDone())
|
||||
{
|
||||
TopoDS_Wire W = aWM.Wire();
|
||||
if (!W.Closed())
|
||||
return false;
|
||||
aLoops.Append(W);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool CollectNeccessaryLoops(const NCollection_Vector<TopoDS_Wire>& aLoops,
|
||||
const Handle(Geom_Plane)& theRefPlane,
|
||||
const TopoDS_Face& theWorkSpine,
|
||||
TopoDS_Compound& Co)
|
||||
{
|
||||
// try to classify wires
|
||||
NCollection_Vector<TopoDS_Wire> InnerMWires; // interior wires
|
||||
NCollection_Vector<TopoDS_Wire> ExtMWires; //wires which defines a hole
|
||||
for (int i = 0; i < aLoops.Length(); i++)
|
||||
{
|
||||
TopoDS_Face af = BRepBuilderAPI_MakeFace (theRefPlane, Precision::Confusion() ); //TopoDS::Face ( myWorkSpine.EmptyCopied() );
|
||||
af.Orientation ( TopAbs_REVERSED );
|
||||
BRep_Builder BB;
|
||||
BB.Add (af, aLoops(i));
|
||||
|
||||
BRepTopAdaptor_FClass2d FClass(af, Precision::PConfusion());
|
||||
if (FClass.PerformInfinitePoint() == TopAbs_OUT)
|
||||
InnerMWires.Append(aLoops(i));
|
||||
else
|
||||
ExtMWires.Append(aLoops(i));
|
||||
}
|
||||
|
||||
if (InnerMWires.Length() == ExtMWires.Length())
|
||||
return false;
|
||||
|
||||
if (InnerMWires.Length() < ExtMWires.Length())
|
||||
//probably incorrect orientation
|
||||
return false;
|
||||
//try to find an outer wire
|
||||
int IndOfOuterW = -1;
|
||||
for (int i = 0; i < InnerMWires.Length(); i++)
|
||||
{
|
||||
bool IsInside = true;
|
||||
BRepBuilderAPI_MakeFace aDB(theRefPlane, InnerMWires(i));
|
||||
TopoDS_Face aDummyFace = TopoDS::Face(aDB.Shape());
|
||||
BRepTopAdaptor_FClass2d FClass(aDummyFace, Precision::PConfusion());
|
||||
for (int j = 0; j < InnerMWires.Length(); j++)
|
||||
{
|
||||
if ( i == j )
|
||||
continue;
|
||||
double f, l;
|
||||
TopExp_Explorer ExpE( InnerMWires(j), TopAbs_EDGE );
|
||||
Handle_Geom2d_Curve aCur = BRep_Tool::CurveOnSurface(TopoDS::Edge(ExpE.Current()), theWorkSpine, f, l );
|
||||
|
||||
gp_Pnt2d MP = aCur->Value((l + f) / 2.0);
|
||||
if (FClass.Perform(MP) != TopAbs_IN)
|
||||
{
|
||||
IsInside = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (IsInside)
|
||||
{
|
||||
IndOfOuterW = i;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (IndOfOuterW == -1)
|
||||
return false; //cant find an outer wire
|
||||
|
||||
TopoDS_Wire OuterWire = InnerMWires(IndOfOuterW);
|
||||
//make compound: outer wire + holes
|
||||
BRep_Builder BBC;
|
||||
BBC.MakeCompound(Co);
|
||||
BBC.Add(Co, OuterWire);
|
||||
|
||||
for (int i = 0; i < ExtMWires.Length(); i++)
|
||||
BBC.Add(Co, ExtMWires(i));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//! Used to remove loops from offset result
|
||||
static bool RemoveLoops(TopoDS_Shape& theInputSh, const TopoDS_Face& theWorkSpine, const Handle(Geom_Plane)& theRefPlane )
|
||||
{
|
||||
Handle(BRepTools_ReShape) ExtReShape = new BRepTools_ReShape;
|
||||
|
||||
TopExp_Explorer Exp( theInputSh, TopAbs_WIRE );
|
||||
|
||||
for (; Exp.More(); Exp.Next())
|
||||
{
|
||||
Handle(BRepTools_ReShape) reshape = new BRepTools_ReShape;
|
||||
TopoDS_Wire InitialW = TopoDS::Wire( Exp.Current() );
|
||||
if (!InitialW.Closed())
|
||||
continue;
|
||||
TopoDS_Wire aW = TopoDS::Wire( Exp.Current() );
|
||||
|
||||
int NbEdges = 0;
|
||||
TopExp_Explorer ExpE( aW, TopAbs_EDGE );
|
||||
for (; ExpE.More(); ExpE.Next())
|
||||
NbEdges++;
|
||||
|
||||
TopTools_Array1OfShape Seq (1, NbEdges);
|
||||
ExpE.Init( aW, TopAbs_EDGE );
|
||||
for (int i = 1; ExpE.More(); ExpE.Next(), i++ )
|
||||
Seq.SetValue(i, ExpE.Current() );
|
||||
|
||||
if (!DoReorder(reshape, aW))
|
||||
continue;
|
||||
|
||||
TopTools_IndexedMapOfShape EdgesInInter;
|
||||
TopTools_MapOfShape InterV;
|
||||
if (!AddIntersectionVertices(theRefPlane, theWorkSpine, Seq, reshape, aW, EdgesInInter, InterV))
|
||||
continue;
|
||||
|
||||
if (!AddAdditionalVertices(reshape, aW, EdgesInInter))
|
||||
continue;
|
||||
|
||||
NCollection_Vector<TopoDS_Wire> aLoops;
|
||||
if (!RemoveEdgeLoop(reshape, aW, aLoops))
|
||||
continue;
|
||||
|
||||
if (!ExtractLoopsFromWire (aW, theWorkSpine, aLoops))
|
||||
continue;
|
||||
|
||||
TopoDS_Compound Co;
|
||||
if (!CollectNeccessaryLoops(aLoops, theRefPlane, theWorkSpine, Co))
|
||||
continue;
|
||||
|
||||
ExtReShape->Replace(InitialW, Co);
|
||||
|
||||
}
|
||||
|
||||
theInputSh = ExtReShape->Apply(theInputSh);
|
||||
return true;
|
||||
}
|
||||
|
@@ -12,353 +12,25 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Adaptor2d_HCurve2d.hxx>
|
||||
#include <Adaptor3d_CurveOnSurface.hxx>
|
||||
#include <Adaptor3d_HSurface.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepLib_CheckCurveOnSurface.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Geom2dAdaptor.hxx>
|
||||
#include <Geom2dAdaptor_GHCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <GeomAdaptor_HCurve.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <GeomProjLib.hxx>
|
||||
#include <math_Matrix.hxx>
|
||||
#include <math_MultipleVarFunctionWithHessian.hxx>
|
||||
#include <math_NewtonMinimum.hxx>
|
||||
#include <math_PSO.hxx>
|
||||
#include <math_PSOParticlesPool.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <OSD_Parallel.hxx>
|
||||
#include <ProjLib_ProjectedCurve.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
|
||||
class BRepLib_CheckCurveOnSurface_TargetFunc;
|
||||
|
||||
static
|
||||
Standard_Boolean MinComputing(
|
||||
BRepLib_CheckCurveOnSurface_TargetFunc& theFunction,
|
||||
const Standard_Real theEpsilon, //1.0e-3
|
||||
const Standard_Integer theNbParticles,
|
||||
Standard_Real& theBestValue,
|
||||
Standard_Real& theBestParameter);
|
||||
|
||||
static Standard_Integer FillSubIntervals( const Handle(Geom_Curve)& theCurve3d,
|
||||
const Handle(Geom2d_Curve)& theCurve2d,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
Standard_Integer &theNbParticles,
|
||||
TColStd_Array1OfReal* const theSubIntervals = 0);
|
||||
|
||||
//=======================================================================
|
||||
//class : BRepLib_CheckCurveOnSurface_TargetFunc
|
||||
//purpose : Target function (to be minimized)
|
||||
//=======================================================================
|
||||
class BRepLib_CheckCurveOnSurface_TargetFunc :
|
||||
public math_MultipleVarFunctionWithHessian
|
||||
{
|
||||
public:
|
||||
BRepLib_CheckCurveOnSurface_TargetFunc( const Adaptor3d_Curve& theC3D,
|
||||
const Adaptor3d_Curve& theAdCS,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast):
|
||||
myCurve1(theC3D),
|
||||
myCurve2(theAdCS),
|
||||
myFirst(theFirst),
|
||||
myLast(theLast)
|
||||
{
|
||||
}
|
||||
|
||||
//returns the number of parameters of the function
|
||||
//(the function is one-dimension).
|
||||
virtual Standard_Integer NbVariables() const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//returns value of the function when parameters are equal to theX
|
||||
virtual Standard_Boolean Value(const math_Vector& theX,
|
||||
Standard_Real& theFVal)
|
||||
{
|
||||
return Value(theX(1), theFVal);
|
||||
}
|
||||
|
||||
//returns value of the one-dimension-function when parameter
|
||||
//is equal to theX
|
||||
Standard_Boolean Value( const Standard_Real theX,
|
||||
Standard_Real& theFVal) const
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
if (!CheckParameter(theX))
|
||||
return Standard_False;
|
||||
|
||||
const gp_Pnt aP1(myCurve1.Value(theX)),
|
||||
aP2(myCurve2.Value(theX));
|
||||
|
||||
theFVal = -1.0*aP1.SquareDistance(aP2);
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
return Standard_False;
|
||||
}
|
||||
//
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//see analogical method for abstract owner class math_MultipleVarFunction
|
||||
virtual Standard_Integer GetStateNumber()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//returns the gradient of the function when parameters are
|
||||
//equal to theX
|
||||
virtual Standard_Boolean Gradient(const math_Vector& theX,
|
||||
math_Vector& theGrad)
|
||||
{
|
||||
return Derive(theX(1), theGrad(1));
|
||||
}
|
||||
|
||||
//returns 1st derivative of the the one-dimension-function when
|
||||
//parameter is equal to theX
|
||||
Standard_Boolean Derive(const Standard_Real theX, Standard_Real& theDeriv) const
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
if (!CheckParameter(theX))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
//
|
||||
gp_Pnt aP1, aP2;
|
||||
gp_Vec aDC1, aDC2;
|
||||
//
|
||||
myCurve1.D1(theX, aP1, aDC1);
|
||||
myCurve2.D1(theX, aP2, aDC2);
|
||||
|
||||
const gp_Vec aVec1(aP1, aP2), aVec2(aDC2-aDC1);
|
||||
//
|
||||
theDeriv = -2.0*aVec1.Dot(aVec2);
|
||||
}
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//returns value and gradient
|
||||
virtual Standard_Boolean Values(const math_Vector& theX,
|
||||
Standard_Real& theVal,
|
||||
math_Vector& theGrad)
|
||||
{
|
||||
if (!Value(theX, theVal))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
//
|
||||
if (!Gradient(theX, theGrad)) {
|
||||
return Standard_False;
|
||||
}
|
||||
//
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//returns value, gradient and hessian
|
||||
virtual Standard_Boolean Values(const math_Vector& theX,
|
||||
Standard_Real& theVal,
|
||||
math_Vector& theGrad,
|
||||
math_Matrix& theHessian)
|
||||
{
|
||||
if (!Value(theX, theVal))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
//
|
||||
if (!Gradient(theX, theGrad))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
//
|
||||
theHessian(1,1) = theGrad(1);
|
||||
//
|
||||
return Standard_True;
|
||||
}
|
||||
//
|
||||
Standard_Real FirstParameter() const
|
||||
{
|
||||
return myFirst;
|
||||
}
|
||||
|
||||
//
|
||||
Standard_Real LastParameter() const
|
||||
{
|
||||
return myLast;
|
||||
}
|
||||
|
||||
private:
|
||||
BRepLib_CheckCurveOnSurface_TargetFunc operator=(BRepLib_CheckCurveOnSurface_TargetFunc&);
|
||||
|
||||
//checks if the function can be computed when its parameter is
|
||||
//equal to theParam
|
||||
Standard_Boolean CheckParameter(const Standard_Real theParam) const
|
||||
{
|
||||
return ((myFirst <= theParam) && (theParam <= myLast));
|
||||
}
|
||||
|
||||
const Adaptor3d_Curve& myCurve1;
|
||||
const Adaptor3d_Curve& myCurve2;
|
||||
const Standard_Real myFirst;
|
||||
const Standard_Real myLast;
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//class : BRepLib_CheckCurveOnSurface_Local
|
||||
//purpose : Created for parallelization possibility only
|
||||
//=======================================================================
|
||||
class BRepLib_CheckCurveOnSurface_Local
|
||||
{
|
||||
public:
|
||||
BRepLib_CheckCurveOnSurface_Local(
|
||||
const Handle(Geom_Curve)& theCurve3D,
|
||||
const Handle(Geom2d_Curve)& theCurve2D,
|
||||
const Handle(Geom_Surface)& theSurface,
|
||||
const TColStd_Array1OfReal& theIntervalsArr,
|
||||
const Standard_Real theEpsilonRange,
|
||||
const Standard_Integer theNbParticles):
|
||||
myCurve3D(theCurve3D),
|
||||
myCurve2D(theCurve2D),
|
||||
mySurface(theSurface),
|
||||
mySubIntervals(theIntervalsArr),
|
||||
myEpsilonRange(theEpsilonRange),
|
||||
myNbParticles(theNbParticles),
|
||||
myArrOfDist(theIntervalsArr.Lower(), theIntervalsArr.Upper()-1),
|
||||
myArrOfParam(theIntervalsArr.Lower(), theIntervalsArr.Upper()-1)
|
||||
{
|
||||
}
|
||||
|
||||
void operator()(const Standard_Integer& theIndex) const
|
||||
{
|
||||
//For every sub-interval (which is set by mySubIntervals array) this method
|
||||
//computes optimal value of BRepLib_CheckCurveOnSurface_TargetFunc function.
|
||||
//This optimal value will be put in corresponding (depending on theIndex - the
|
||||
//identificator of the current interval in mySubIntervals array) cell of
|
||||
//myArrOfDist and myArrOfParam arrays.
|
||||
const GeomAdaptor_Curve anAC(myCurve3D);
|
||||
const Handle(Adaptor2d_HCurve2d) anAd2dC = new Geom2dAdaptor_GHCurve(myCurve2D);
|
||||
const Handle(Adaptor3d_HSurface) anAdS = new GeomAdaptor_HSurface(mySurface);
|
||||
|
||||
const Adaptor3d_CurveOnSurface anACS(anAd2dC, anAdS);
|
||||
|
||||
BRepLib_CheckCurveOnSurface_TargetFunc aFunc( anAC, anACS,
|
||||
mySubIntervals.Value(theIndex),
|
||||
mySubIntervals.Value(theIndex+1));
|
||||
|
||||
Standard_Real aMinDist = RealLast(), aPar = 0.0;
|
||||
if(!MinComputing(aFunc, myEpsilonRange, myNbParticles, aMinDist, aPar))
|
||||
{
|
||||
myArrOfDist(theIndex) = RealLast();
|
||||
myArrOfParam(theIndex) = aFunc.FirstParameter();
|
||||
return;
|
||||
}
|
||||
|
||||
myArrOfDist(theIndex) = aMinDist;
|
||||
myArrOfParam(theIndex) = aPar;
|
||||
}
|
||||
|
||||
//Returns optimal value (inverse of square of maximal distance)
|
||||
void OptimalValues(Standard_Real& theMinimalValue, Standard_Real& theParameter) const
|
||||
{
|
||||
//This method looks for the minimal value of myArrOfDist.
|
||||
|
||||
const Standard_Integer aStartInd = myArrOfDist.Lower();
|
||||
theMinimalValue = myArrOfDist(aStartInd);
|
||||
theParameter = myArrOfParam(aStartInd);
|
||||
for(Standard_Integer i = aStartInd + 1; i <= myArrOfDist.Upper(); i++)
|
||||
{
|
||||
if(myArrOfDist(i) < theMinimalValue)
|
||||
{
|
||||
theMinimalValue = myArrOfDist(i);
|
||||
theParameter = myArrOfParam(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
BRepLib_CheckCurveOnSurface_Local operator=(BRepLib_CheckCurveOnSurface_Local&);
|
||||
const Handle(Geom_Curve)& myCurve3D;
|
||||
const Handle(Geom2d_Curve)& myCurve2D;
|
||||
const Handle(Geom_Surface)& mySurface;
|
||||
|
||||
const TColStd_Array1OfReal& mySubIntervals;
|
||||
const Standard_Real myEpsilonRange;
|
||||
const Standard_Integer myNbParticles;
|
||||
mutable NCollection_Array1<Standard_Real> myArrOfDist;
|
||||
mutable NCollection_Array1<Standard_Real> myArrOfParam;
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepLib_CheckCurveOnSurface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepLib_CheckCurveOnSurface::BRepLib_CheckCurveOnSurface()
|
||||
:
|
||||
myFirst(0.),
|
||||
myLast(0.),
|
||||
myErrorStatus(0),
|
||||
myMaxDistance(RealLast()),
|
||||
myMaxParameter(0.)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepLib_CheckCurveOnSurface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepLib_CheckCurveOnSurface::BRepLib_CheckCurveOnSurface
|
||||
(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace)
|
||||
:
|
||||
myErrorStatus(0),
|
||||
myMaxDistance(RealLast()),
|
||||
myMaxParameter(0.)
|
||||
( const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace)
|
||||
{
|
||||
Init(theEdge, theFace);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepLib_CheckCurveOnSurface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepLib_CheckCurveOnSurface::BRepLib_CheckCurveOnSurface
|
||||
(const Handle(Geom_Curve)& the3DCurve,
|
||||
const Handle(Geom2d_Curve)& the2DCurve,
|
||||
const Handle(Geom_Surface)& theSurface,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast)
|
||||
:
|
||||
myErrorStatus(0),
|
||||
myMaxDistance(RealLast()),
|
||||
myMaxParameter(0.)
|
||||
{
|
||||
Init(the3DCurve, the2DCurve, theSurface, theFirst, theLast);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
@@ -367,100 +39,59 @@ void BRepLib_CheckCurveOnSurface::Init
|
||||
(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace)
|
||||
{
|
||||
myCurve.Nullify();
|
||||
myPCurve.Nullify();
|
||||
myPCurve2.Nullify();
|
||||
mySurface.Nullify();
|
||||
myErrorStatus = 0;
|
||||
myMaxDistance = RealLast();
|
||||
myMaxParameter = 0.0;
|
||||
myFirst = 0.0;
|
||||
myLast = 0.0;
|
||||
myCOnSurfGeom.Init();
|
||||
|
||||
if (theEdge.IsNull() || theFace.IsNull()) {
|
||||
if (theEdge.IsNull() || theFace.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (BRep_Tool::Degenerated(theEdge) ||
|
||||
!BRep_Tool::IsGeometric(theEdge)) {
|
||||
!BRep_Tool::IsGeometric(theEdge))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
TopLoc_Location aLocE, aLocF, aLocC2D;
|
||||
Standard_Real aFirst = 0.0, aLast = 0.0;
|
||||
//
|
||||
// 3D curve initialization
|
||||
const Handle(Geom_Curve)& aC = BRep_Tool::Curve(theEdge, aLocE, myFirst, myLast);
|
||||
myCurve = Handle(Geom_Curve)::DownCast(aC->Transformed(aLocE.Transformation()));
|
||||
const Handle(Geom_Curve)& aC3dTmp = BRep_Tool::Curve(theEdge, aLocE, aFirst, aLast);
|
||||
const Handle(Geom_Curve) aC3d(Handle(Geom_Curve)::DownCast(aC3dTmp->Transformed(aLocE.Transformation())));
|
||||
|
||||
// Surface initialization
|
||||
const Handle(Geom_Surface)& aS = BRep_Tool::Surface(theFace, aLocF);
|
||||
mySurface = Handle(Geom_Surface)::DownCast(aS->Transformed(aLocF.Transformation()));
|
||||
const Handle(Geom_Surface)& aSTmp = BRep_Tool::Surface(theFace, aLocF);
|
||||
const Handle(Geom_Surface) aS(Handle(Geom_Surface)::DownCast(aSTmp->Transformed(aLocF.Transformation())));
|
||||
//
|
||||
// 2D curves initialization
|
||||
myPCurve = BRep_Tool::CurveOnSurface(theEdge, theFace, myFirst, myLast);
|
||||
myPCurve = BRep_Tool::CurveOnSurface(theEdge, theFace, aFirst, aLast);
|
||||
|
||||
if(BRep_Tool::IsClosed(theEdge, theFace))
|
||||
myPCurve2 = BRep_Tool::CurveOnSurface(TopoDS::Edge(theEdge.Reversed()),
|
||||
theFace, myFirst, myLast);
|
||||
}
|
||||
theFace, aFirst, aLast);
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepLib_CheckCurveOnSurface::Init
|
||||
(const Handle(Geom_Curve)& the3DCurve,
|
||||
const Handle(Geom2d_Curve)& the2DCurve,
|
||||
const Handle(Geom_Surface)& theSurface,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast)
|
||||
{
|
||||
myCurve = the3DCurve;
|
||||
myPCurve = the2DCurve;
|
||||
myPCurve2.Nullify();
|
||||
mySurface = theSurface;
|
||||
myFirst = theFirst;
|
||||
myLast = theLast;
|
||||
myErrorStatus = 0;
|
||||
myMaxDistance = RealLast();
|
||||
myMaxParameter = 0.0;
|
||||
myCOnSurfGeom.Init(aC3d, aS, aFirst, aLast);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose : if isTheMTDisabled == TRUE parallelization is not used
|
||||
//=======================================================================
|
||||
#ifndef HAVE_TBB
|
||||
//After fixing bug # 26365, this fragment should be deleted
|
||||
//(together the text "#ifdef HAVE_TBB")
|
||||
|
||||
void BRepLib_CheckCurveOnSurface::Perform(const Standard_Boolean)
|
||||
{
|
||||
const Standard_Boolean isTheMTDisabled = Standard_True;
|
||||
#else
|
||||
void BRepLib_CheckCurveOnSurface::Perform(const Standard_Boolean isTheMTDisabled)
|
||||
{
|
||||
#endif
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
//
|
||||
// 1. Check data
|
||||
CheckData();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Compute the max distance
|
||||
Compute(myPCurve, isTheMTDisabled);
|
||||
//
|
||||
if (!myPCurve2.IsNull()) {
|
||||
// compute max distance for myPCurve2
|
||||
// (for the second curve on closed surface)
|
||||
Compute(myPCurve2, isTheMTDisabled);
|
||||
}
|
||||
// Compute the max distance
|
||||
Compute(myPCurve, isTheMTDisabled);
|
||||
if (ErrorStatus())
|
||||
{
|
||||
return;
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
myErrorStatus = 3;
|
||||
//
|
||||
if (!myPCurve2.IsNull())
|
||||
{
|
||||
// compute max distance for myPCurve2
|
||||
// (for the second curve on closed surface)
|
||||
Compute(myPCurve2, isTheMTDisabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,247 +102,5 @@ void BRepLib_CheckCurveOnSurface::Perform(const Standard_Boolean isTheMTDisabled
|
||||
void BRepLib_CheckCurveOnSurface::Compute(const Handle(Geom2d_Curve)& thePCurve,
|
||||
const Standard_Boolean isTheMTDisabled)
|
||||
{
|
||||
const Standard_Real anEpsilonRange = 1.e-3;
|
||||
|
||||
Standard_Integer aNbParticles = 3;
|
||||
|
||||
//Polynomial function with degree n has not more than n-1 maxima and
|
||||
//minima (degree of 1st derivative is equal to n-1 => 1st derivative has
|
||||
//no greater than n-1 roots). Consequently, this function has
|
||||
//maximum n monotonicity intervals. That is a good idea to try to put
|
||||
//at least one particle in every monotonicity interval. Therefore,
|
||||
//number of particles should be equal to n.
|
||||
|
||||
const Standard_Integer aNbSubIntervals =
|
||||
FillSubIntervals( myCurve, thePCurve,
|
||||
myFirst, myLast, aNbParticles);
|
||||
|
||||
if(!aNbSubIntervals)
|
||||
{
|
||||
myErrorStatus = 3;
|
||||
return;
|
||||
}
|
||||
|
||||
TColStd_Array1OfReal anIntervals(1, aNbSubIntervals+1);
|
||||
FillSubIntervals(myCurve, thePCurve, myFirst, myLast, aNbParticles, &anIntervals);
|
||||
|
||||
BRepLib_CheckCurveOnSurface_Local aComp(myCurve, thePCurve,
|
||||
mySurface, anIntervals, anEpsilonRange, aNbParticles);
|
||||
|
||||
OSD_Parallel::For(anIntervals.Lower(), anIntervals.Upper(), aComp, isTheMTDisabled);
|
||||
|
||||
aComp.OptimalValues(myMaxDistance, myMaxParameter);
|
||||
|
||||
myMaxDistance = sqrt(Abs(myMaxDistance));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function : FillSubIntervals
|
||||
// purpose : Divides [theFirst, theLast] interval on parts
|
||||
// in order to make searching-algorithm more precisely
|
||||
// (fills theSubIntervals array).
|
||||
// Returns number of subintervals.
|
||||
//=======================================================================
|
||||
Standard_Integer FillSubIntervals(const Handle(Geom_Curve)& theCurve3d,
|
||||
const Handle(Geom2d_Curve)& theCurve2d,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
Standard_Integer &theNbParticles,
|
||||
TColStd_Array1OfReal* const theSubIntervals)
|
||||
{
|
||||
const Standard_Real anArrTempC[2] = {theFirst, theLast};
|
||||
const TColStd_Array1OfReal anArrTemp(anArrTempC[0], 1, 2);
|
||||
|
||||
theNbParticles = 3;
|
||||
Handle(Geom2d_BSplineCurve) aBS2DCurv;
|
||||
Handle(Geom_BSplineCurve) aBS3DCurv;
|
||||
|
||||
//
|
||||
if (theCurve3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)))
|
||||
{
|
||||
aBS3DCurv = Handle(Geom_BSplineCurve)::
|
||||
DownCast(Handle(Geom_TrimmedCurve)::
|
||||
DownCast(theCurve3d)->BasisCurve());
|
||||
}
|
||||
else
|
||||
{
|
||||
aBS3DCurv = Handle(Geom_BSplineCurve)::DownCast(theCurve3d);
|
||||
}
|
||||
|
||||
|
||||
if (theCurve2d->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
|
||||
{
|
||||
aBS2DCurv = Handle(Geom2d_BSplineCurve)::
|
||||
DownCast(Handle(Geom2d_TrimmedCurve)::
|
||||
DownCast(theCurve2d)->BasisCurve());
|
||||
}
|
||||
else
|
||||
{
|
||||
aBS2DCurv = Handle(Geom2d_BSplineCurve)::DownCast(theCurve2d);
|
||||
}
|
||||
|
||||
const TColStd_Array1OfReal &anArrKnots3D = !aBS3DCurv.IsNull() ?
|
||||
aBS3DCurv->Knots() :
|
||||
anArrTemp;
|
||||
const TColStd_Array1OfReal &anArrKnots2D = !aBS2DCurv.IsNull() ?
|
||||
aBS2DCurv->Knots() :
|
||||
anArrTemp;
|
||||
|
||||
Standard_Integer aNbSubIntervals = 1;
|
||||
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
const Standard_Integer anIndMax3D = anArrKnots3D.Upper(),
|
||||
anIndMax2D = anArrKnots2D.Upper();
|
||||
|
||||
Standard_Integer anIndex3D = anArrKnots3D.Lower(),
|
||||
anIndex2D = anArrKnots2D.Lower();
|
||||
|
||||
if(theSubIntervals)
|
||||
theSubIntervals->ChangeValue(aNbSubIntervals) = theFirst;
|
||||
|
||||
while((anIndex3D <= anIndMax3D) && (anIndex2D <= anIndMax2D))
|
||||
{
|
||||
const Standard_Real aVal3D = anArrKnots3D.Value(anIndex3D),
|
||||
aVal2D = anArrKnots2D.Value(anIndex2D);
|
||||
const Standard_Real aDelta = aVal3D - aVal2D;
|
||||
|
||||
if(aDelta < Precision::PConfusion())
|
||||
{//aVal3D <= aVal2D
|
||||
if((aVal3D > theFirst) && (aVal3D < theLast))
|
||||
{
|
||||
aNbSubIntervals++;
|
||||
|
||||
if(theSubIntervals)
|
||||
theSubIntervals->ChangeValue(aNbSubIntervals) = aVal3D;
|
||||
}
|
||||
|
||||
anIndex3D++;
|
||||
|
||||
if(-aDelta < Precision::PConfusion())
|
||||
{//aVal3D == aVal2D
|
||||
anIndex2D++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{//aVal2D < aVal3D
|
||||
if((aVal2D > theFirst) && (aVal2D < theLast))
|
||||
{
|
||||
aNbSubIntervals++;
|
||||
|
||||
if(theSubIntervals)
|
||||
theSubIntervals->ChangeValue(aNbSubIntervals) = aVal2D;
|
||||
}
|
||||
|
||||
anIndex2D++;
|
||||
}
|
||||
}
|
||||
|
||||
if(theSubIntervals)
|
||||
theSubIntervals->ChangeValue(aNbSubIntervals+1) = theLast;
|
||||
|
||||
if(!aBS3DCurv.IsNull())
|
||||
{
|
||||
theNbParticles = Max(theNbParticles, aBS3DCurv->Degree());
|
||||
}
|
||||
|
||||
if(!aBS2DCurv.IsNull())
|
||||
{
|
||||
theNbParticles = Max(theNbParticles, aBS2DCurv->Degree());
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "ERROR! BRepLib_CheckCurveOnSurface.cxx, "
|
||||
"FillSubIntervals(): Incorrect filling!" << endl;
|
||||
#endif
|
||||
|
||||
aNbSubIntervals = 0;
|
||||
}
|
||||
|
||||
return aNbSubIntervals;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//class : MinComputing
|
||||
//purpose : Performs computing minimal value
|
||||
//=======================================================================
|
||||
Standard_Boolean MinComputing (
|
||||
BRepLib_CheckCurveOnSurface_TargetFunc& theFunction,
|
||||
const Standard_Real theEpsilon, //1.0e-3
|
||||
const Standard_Integer theNbParticles,
|
||||
Standard_Real& theBestValue,
|
||||
Standard_Real& theBestParameter)
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
//They are used for finding a position of theNbParticles worst places
|
||||
const Standard_Integer aNbControlPoints = 3*theNbParticles;
|
||||
//
|
||||
math_Vector aParInf(1, 1), aParSup(1, 1), anOutputParam(1, 1), aStepPar(1,1);
|
||||
aParInf(1) = theFunction.FirstParameter();
|
||||
aParSup(1) = theFunction.LastParameter();
|
||||
theBestParameter = aParInf(1);
|
||||
theBestValue = RealLast();
|
||||
|
||||
const Standard_Real aDeltaParam = aParSup(1) - aParInf(1);
|
||||
if(aDeltaParam < Precision::PConfusion())
|
||||
return Standard_False;
|
||||
|
||||
aStepPar(1) = theEpsilon*aDeltaParam;
|
||||
|
||||
math_PSOParticlesPool aParticles(theNbParticles, 1);
|
||||
|
||||
const Standard_Real aStep = aDeltaParam/(aNbControlPoints-1);
|
||||
Standard_Integer aCount = 1;
|
||||
for(Standard_Real aPrm = aParInf(1); aCount <= aNbControlPoints; aCount++,
|
||||
aPrm = (aCount == aNbControlPoints)? aParSup(1) : aPrm+aStep)
|
||||
{
|
||||
Standard_Real aVal = RealLast();
|
||||
theFunction.Value(aPrm, aVal);
|
||||
|
||||
PSO_Particle* aParticle = aParticles.GetWorstParticle();
|
||||
|
||||
if(aVal > aParticle->BestDistance)
|
||||
continue;
|
||||
|
||||
aParticle->Position[0] = aPrm;
|
||||
aParticle->BestPosition[0] = aPrm;
|
||||
aParticle->Distance = aVal;
|
||||
aParticle->BestDistance = aVal;
|
||||
}
|
||||
|
||||
math_PSO aPSO(&theFunction, aParInf, aParSup, aStepPar);
|
||||
aPSO.Perform(aParticles, theNbParticles, theBestValue, anOutputParam);
|
||||
|
||||
//Here, anOutputParam contains parameter, which is near to optimal.
|
||||
//It needs to be more precise. Precision is made by math_NewtonMinimum.
|
||||
math_NewtonMinimum anA(theFunction);
|
||||
anA.Perform(theFunction, anOutputParam);
|
||||
|
||||
if(!anA.IsDone())
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "BRepLib_CheckCurveOnSurface::Compute(): No solution found!" << endl;
|
||||
#endif
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
anA.Location(anOutputParam);
|
||||
theBestParameter = anOutputParam(1);
|
||||
theBestValue = anA.Minimum();
|
||||
}
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "BRepLib_CheckCurveOnSurface.cxx: Exception in MinComputing()!" << endl;
|
||||
#endif
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
myCOnSurfGeom.Perform(thePCurve, isTheMTDisabled);
|
||||
}
|
||||
|
@@ -15,144 +15,106 @@
|
||||
#ifndef _BRepLib_CheckCurveOnSurface_HeaderFile
|
||||
#define _BRepLib_CheckCurveOnSurface_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Geom_Curve;
|
||||
class Geom2d_Curve;
|
||||
class Geom_Surface;
|
||||
class TopoDS_Edge;
|
||||
class TopoDS_Face;
|
||||
|
||||
|
||||
#include <GeomLib_CheckCurveOnSurface.hxx>
|
||||
|
||||
//! Computes the max distance between edge and its
|
||||
//! 2d representation on the face.
|
||||
//!
|
||||
//! The algorithm can be initialized in the following ways:
|
||||
//! 1. Input args are Edge and Face;
|
||||
//! 2. Input args are 3D curve, 2d curve, Surface and
|
||||
//! parametric range of the curve (first and last values).
|
||||
|
||||
class BRepLib_CheckCurveOnSurface
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Default contructor
|
||||
BRepLib_CheckCurveOnSurface() {}
|
||||
|
||||
|
||||
//! Empty contructor
|
||||
Standard_EXPORT BRepLib_CheckCurveOnSurface();
|
||||
|
||||
|
||||
//! Contructor
|
||||
Standard_EXPORT BRepLib_CheckCurveOnSurface(const TopoDS_Edge& theEdge, const TopoDS_Face& theFace);
|
||||
Standard_EXPORT BRepLib_CheckCurveOnSurface(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace);
|
||||
|
||||
|
||||
//! Contructor
|
||||
Standard_EXPORT BRepLib_CheckCurveOnSurface(const Handle(Geom_Curve)& theCurve, const Handle(Geom2d_Curve)& thePCurve, const Handle(Geom_Surface)& theSurface, const Standard_Real theFirst, const Standard_Real theLast);
|
||||
|
||||
|
||||
//! Sets the data for the algorithm
|
||||
Standard_EXPORT void Init (const TopoDS_Edge& theEdge, const TopoDS_Face& theFace);
|
||||
|
||||
|
||||
//! Sets the data for the algorithm
|
||||
Standard_EXPORT void Init (const Handle(Geom_Curve)& theCurve, const Handle(Geom2d_Curve)& thePCurve, const Handle(Geom_Surface)& theSurface, const Standard_Real theFirst, const Standard_Real theLast);
|
||||
|
||||
|
||||
//! Returns my3DCurve
|
||||
const Handle(Geom_Curve)& Curve() const;
|
||||
|
||||
|
||||
//! Returns my2DCurve
|
||||
const Handle(Geom2d_Curve)& PCurve() const;
|
||||
|
||||
|
||||
//! Returns my2DCurve
|
||||
const Handle(Geom2d_Curve)& PCurve2() const;
|
||||
|
||||
|
||||
//! Returns mySurface
|
||||
const Handle(Geom_Surface)& Surface() const;
|
||||
|
||||
|
||||
//! Returns the range
|
||||
void Range (Standard_Real& theFirst, Standard_Real& theLast);
|
||||
|
||||
|
||||
//! Performs the calculation
|
||||
//! If isTheMultyTheadDisabled == TRUE then computation will be made
|
||||
//! without any parallelization.
|
||||
Standard_EXPORT void Perform (const Standard_Boolean isTheMultyTheradDisabled = Standard_False);
|
||||
|
||||
//! Returns source 3D-Curve
|
||||
const Handle(Geom_Curve)& Curve() const
|
||||
{
|
||||
return myCOnSurfGeom.Curve();
|
||||
}
|
||||
|
||||
//! Returns true if the max distance has been found
|
||||
Standard_Boolean IsDone() const;
|
||||
//! Returns mine 2D-Curve
|
||||
const Handle(Geom2d_Curve)& PCurve() const
|
||||
{
|
||||
return myPCurve;
|
||||
}
|
||||
|
||||
//! Returns 2nd 2D-Curve (if it exists, e.g. for seam-edge)
|
||||
const Handle(Geom2d_Curve)& PCurve2() const
|
||||
{
|
||||
return myPCurve2;
|
||||
}
|
||||
|
||||
//! Returns source surface
|
||||
const Handle(Geom_Surface)& Surface() const
|
||||
{
|
||||
return myCOnSurfGeom.Surface();
|
||||
}
|
||||
|
||||
//! Returns first and last parameter of the curves
|
||||
//! (2D- and 3D-curves are considered to have same range)
|
||||
void Range (Standard_Real& theFirst, Standard_Real& theLast)
|
||||
{
|
||||
myCOnSurfGeom.Range(theFirst, theLast);
|
||||
}
|
||||
|
||||
//! Returns true if the max distance has been found
|
||||
Standard_Boolean IsDone() const
|
||||
{
|
||||
return myCOnSurfGeom.ErrorStatus() == 0;
|
||||
}
|
||||
|
||||
|
||||
//! Returns error status
|
||||
//! The possible values are:
|
||||
//! 0 - OK;
|
||||
//! 1 - null curve or surface or 2d curve;
|
||||
//! 2 - invalid parametric range;
|
||||
//! 3 - error in calculations.
|
||||
Standard_Integer ErrorStatus() const;
|
||||
Standard_Integer ErrorStatus() const
|
||||
{
|
||||
return myCOnSurfGeom.ErrorStatus();
|
||||
}
|
||||
|
||||
|
||||
//! Returns max distance
|
||||
Standard_Real MaxDistance() const;
|
||||
Standard_Real MaxDistance() const
|
||||
{
|
||||
return myCOnSurfGeom.MaxDistance();
|
||||
}
|
||||
|
||||
|
||||
//! Returns parameter in which the distance is maximal
|
||||
Standard_Real MaxParameter() const;
|
||||
|
||||
|
||||
|
||||
Standard_Real MaxParameter() const
|
||||
{
|
||||
return myCOnSurfGeom.MaxParameter();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
//! Checks the data
|
||||
Standard_EXPORT void CheckData();
|
||||
|
||||
|
||||
//! Computes the max distance for the 3d curve <myCurve>
|
||||
//! Computes the max distance for the 3d curve of <myCOnSurfGeom>
|
||||
//! and 2d curve <thePCurve>
|
||||
//! If isTheMultyTheadDisabled == TRUE then computation will be made
|
||||
//! without any parallelization.
|
||||
Standard_EXPORT void Compute (const Handle(Geom2d_Curve)& thePCurve, const Standard_Boolean isTheMultyTheradDisabled);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(Geom2d_Curve)& thePCurve,
|
||||
const Standard_Boolean isTheMultyTheradDisabled);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Handle(Geom_Curve) myCurve;
|
||||
GeomLib_CheckCurveOnSurface myCOnSurfGeom;
|
||||
Handle(Geom2d_Curve) myPCurve;
|
||||
Handle(Geom2d_Curve) myPCurve2;
|
||||
Handle(Geom_Surface) mySurface;
|
||||
Standard_Real myFirst;
|
||||
Standard_Real myLast;
|
||||
Standard_Integer myErrorStatus;
|
||||
Standard_Real myMaxDistance;
|
||||
Standard_Real myMaxParameter;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <BRepLib_CheckCurveOnSurface.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BRepLib_CheckCurveOnSurface_HeaderFile
|
||||
|
@@ -1,112 +0,0 @@
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2014 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 <Geom_Curve.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Curve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline const Handle(Geom_Curve)& BRepLib_CheckCurveOnSurface::Curve() const
|
||||
{
|
||||
return myCurve;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline const Handle(Geom2d_Curve)& BRepLib_CheckCurveOnSurface::PCurve() const
|
||||
{
|
||||
return myPCurve;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PCurve2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline const Handle(Geom2d_Curve)& BRepLib_CheckCurveOnSurface::PCurve2() const
|
||||
{
|
||||
return myPCurve2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Surface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline const Handle(Geom_Surface)& BRepLib_CheckCurveOnSurface::Surface() const
|
||||
{
|
||||
return mySurface;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Range
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void BRepLib_CheckCurveOnSurface::Range
|
||||
(Standard_Real& theFirst,
|
||||
Standard_Real& theLast)
|
||||
{
|
||||
theFirst = myFirst;
|
||||
theLast = myLast;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckData
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void BRepLib_CheckCurveOnSurface::CheckData()
|
||||
{
|
||||
if (myCurve.IsNull() ||
|
||||
myPCurve.IsNull() ||
|
||||
mySurface.IsNull()) {
|
||||
myErrorStatus = 1;
|
||||
return;
|
||||
}
|
||||
//
|
||||
if ((myCurve->FirstParameter() > myFirst) ||
|
||||
(myCurve->LastParameter() < myLast) ||
|
||||
(myPCurve->FirstParameter() > myFirst) ||
|
||||
(myPCurve->LastParameter() < myLast)) {
|
||||
myErrorStatus = 2;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Boolean BRepLib_CheckCurveOnSurface::IsDone() const
|
||||
{
|
||||
return (myErrorStatus == 0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxDistance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Real BRepLib_CheckCurveOnSurface::MaxDistance() const
|
||||
{
|
||||
return myMaxDistance;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Real BRepLib_CheckCurveOnSurface::MaxParameter() const
|
||||
{
|
||||
return myMaxParameter;
|
||||
}
|
@@ -2,7 +2,6 @@ BRepLib.cxx
|
||||
BRepLib.hxx
|
||||
BRepLib_CheckCurveOnSurface.cxx
|
||||
BRepLib_CheckCurveOnSurface.hxx
|
||||
BRepLib_CheckCurveOnSurface.lxx
|
||||
BRepLib_Command.cxx
|
||||
BRepLib_Command.hxx
|
||||
BRepLib_EdgeError.hxx
|
||||
|
@@ -50,7 +50,7 @@ BRepMesh_CircleTool::BRepMesh_CircleTool(
|
||||
const Handle(NCollection_IncAllocator)& theAllocator)
|
||||
: myTolerance (Precision::PConfusion() * Precision::PConfusion()),
|
||||
myAllocator (theAllocator),
|
||||
myCellFilter(10, theAllocator),
|
||||
myCellFilter(BRepMesh_CircleInspector::Dimension, 10, theAllocator),
|
||||
mySelector (myTolerance, 64, theAllocator)
|
||||
{
|
||||
}
|
||||
@@ -64,7 +64,7 @@ BRepMesh_CircleTool::BRepMesh_CircleTool(
|
||||
const Handle(NCollection_IncAllocator)& theAllocator)
|
||||
: myTolerance (Precision::PConfusion() * Precision::PConfusion()),
|
||||
myAllocator (theAllocator),
|
||||
myCellFilter(10, theAllocator),
|
||||
myCellFilter(BRepMesh_CircleInspector::Dimension, 10, theAllocator),
|
||||
mySelector (myTolerance, Max(theReservedSize, 64), theAllocator)
|
||||
{
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BRepMesh.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
|
||||
class gp_Circ2d;
|
||||
|
||||
@@ -67,7 +68,8 @@ public:
|
||||
inline void SetCellSize(const Standard_Real theSizeX,
|
||||
const Standard_Real theSizeY)
|
||||
{
|
||||
Standard_Real aCellSize[2] = { theSizeX, theSizeY };
|
||||
Standard_Real aCellSizeC[2] = { theSizeX, theSizeY };
|
||||
NCollection_Array1<Standard_Real> aCellSize(aCellSizeC[0], 1, 2);
|
||||
myCellFilter.Reset(aCellSize, myAllocator);
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,8 @@ BRepMesh_EdgeParameterProvider::BRepMesh_EdgeParameterProvider(
|
||||
const Handle(TColStd_HArray1OfReal)& theParameters)
|
||||
: myParameters(theParameters),
|
||||
myIsSameParam(BRep_Tool::SameParameter(theEdge)),
|
||||
myScale(1.)
|
||||
myScale(1.),
|
||||
myCurveAdaptor(theEdge, theFace)
|
||||
{
|
||||
if (myIsSameParam)
|
||||
return;
|
||||
@@ -58,9 +59,8 @@ BRepMesh_EdgeParameterProvider::BRepMesh_EdgeParameterProvider(
|
||||
(aOldLastParam - myOldFirstParam);
|
||||
}
|
||||
|
||||
BRepAdaptor_Curve aCOnS(theEdge, theFace);
|
||||
myProjector.Initialize(aCOnS, aCOnS.FirstParameter(),
|
||||
aCOnS.LastParameter(), Precision::PConfusion());
|
||||
myProjector.Initialize(myCurveAdaptor, myCurveAdaptor.FirstParameter(),
|
||||
myCurveAdaptor.LastParameter(), Precision::PConfusion());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Extrema_LocateExtPC.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
|
||||
class gp_Pnt;
|
||||
class TopoDS_Edge;
|
||||
@@ -63,6 +64,7 @@ private:
|
||||
Standard_Real myCurParam;
|
||||
Standard_Real myFoundParam;
|
||||
|
||||
BRepAdaptor_Curve myCurveAdaptor;
|
||||
Extrema_LocateExtPC myProjector;
|
||||
};
|
||||
|
||||
|
@@ -59,7 +59,7 @@ BRepMesh_VertexTool::BRepMesh_VertexTool(
|
||||
const Standard_Integer theReservedSize,
|
||||
const Handle(NCollection_IncAllocator)& theAllocator)
|
||||
: myAllocator (theAllocator),
|
||||
myCellFilter(0., myAllocator),
|
||||
myCellFilter(BRepMesh_VertexInspector::Dimension, 0., myAllocator),
|
||||
mySelector (Max(theReservedSize, 64),myAllocator)
|
||||
{
|
||||
const Standard_Real aTol = Precision::Confusion();
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#ifndef _BRepMesh_VertexTool_HeaderFile
|
||||
#define _BRepMesh_VertexTool_HeaderFile
|
||||
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
@@ -54,7 +55,8 @@ public:
|
||||
Standard_EXPORT void SetCellSize(const Standard_Real theSizeX,
|
||||
const Standard_Real theSizeY)
|
||||
{
|
||||
Standard_Real aCellSize[2] = { theSizeX, theSizeY };
|
||||
Standard_Real aCellSizeC[2] = { theSizeX, theSizeY };
|
||||
NCollection_Array1<Standard_Real> aCellSize(aCellSizeC[0], 1, 2);
|
||||
myCellFilter.Reset(aCellSize, myAllocator);
|
||||
mySelector.Clear();
|
||||
}
|
||||
|
@@ -171,7 +171,7 @@ void BRepOffset_Analyse::Perform (const TopoDS_Shape& S,
|
||||
myShape = S;
|
||||
|
||||
angle = Angle;
|
||||
Standard_Real SinTol = sin(Angle);
|
||||
Standard_Real SinTol = Sin(Angle);
|
||||
|
||||
// Build ancestors.
|
||||
BuildAncestors (S,ancestors);
|
||||
|
@@ -666,7 +666,7 @@ static void EvalMax(const TopoDS_Shape& S, Standard_Real& Tol)
|
||||
|
||||
void BRepOffset_MakeOffset::MakeOffsetShape()
|
||||
{
|
||||
myDone = Standard_False;
|
||||
myDone = Standard_False;
|
||||
//------------------------------------------
|
||||
// Construction of myShape without caps.
|
||||
//------------------------------------------
|
||||
@@ -674,20 +674,40 @@ void BRepOffset_MakeOffset::MakeOffsetShape()
|
||||
{
|
||||
RemoveCorks (myShape,myFaces);
|
||||
}
|
||||
|
||||
|
||||
if (! IsConnectedShell(myShape))
|
||||
Standard_ConstructionError::Raise("BRepOffset_MakeOffset : Incorrect set of faces to remove, the remaining shell is not connected");
|
||||
|
||||
if (Abs(myOffset) < myTol) return;
|
||||
if (Abs(myOffset) <= myTol)
|
||||
{
|
||||
// Check for face with non-null offset value.
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
TopTools_DataMapIteratorOfDataMapOfShapeReal anIter(myFaceOffset);
|
||||
for( ; anIter.More(); anIter.Next())
|
||||
{
|
||||
if (Abs(anIter.Value()) > myTol)
|
||||
{
|
||||
isFound = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isFound)
|
||||
{
|
||||
// No face with non-null offset found.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
TopAbs_State Side = TopAbs_IN;
|
||||
if (myOffset < 0.) Side = TopAbs_OUT;
|
||||
|
||||
// ------------
|
||||
// Preanalyse.
|
||||
// ------------
|
||||
EvalMax(myShape,myTol);
|
||||
// There are possible second variant: analytical continuation of arcsin.
|
||||
Standard_Real TolAngleCoeff = Min(myTol/Abs(myOffset*0.5), 1.0);
|
||||
Standard_Real TolAngleCoeff = Min(myTol / (Abs(myOffset * 0.5) + Precision::Confusion()), 1.0);
|
||||
Standard_Real TolAngle = 4*ASin(TolAngleCoeff);
|
||||
myAnalyse.Perform(myShape,TolAngle);
|
||||
//---------------------------------------------------
|
||||
@@ -1033,12 +1053,12 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
|
||||
// Extension of neighbor edges of new edges and intersection between neighbors.
|
||||
//--------------------------------------------------------------------------------
|
||||
Handle(BRepAlgo_AsDes) AsDes2d = new BRepAlgo_AsDes();
|
||||
for (Exp.Init(myShape,TopAbs_FACE) ; Exp.More(); Exp.Next()) {
|
||||
for (Exp.Init(myShape,TopAbs_FACE) ; Exp.More(); Exp.Next())
|
||||
{
|
||||
const TopoDS_Face& FI = TopoDS::Face(Exp.Current());
|
||||
// Modified by skv - Mon Jan 12 11:50:02 2004 OCC4455 Begin
|
||||
// BRepOffset_Inter2d::ConnexIntByInt (FI,MapSF(FI),MES,Build,AsDes2d,myTol);
|
||||
BRepOffset_Inter2d::ConnexIntByInt (FI,MapSF(FI),MES,Build,AsDes2d,myOffset, myTol);
|
||||
// Modified by skv - Mon Jan 12 11:50:03 2004 OCC4455 End
|
||||
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(FI);
|
||||
BRepOffset_Inter2d::ConnexIntByInt (FI, MapSF(FI), MES, Build,
|
||||
AsDes2d, myOffset, aCurrFaceTol);
|
||||
}
|
||||
//-----------------------------------------------------------
|
||||
// Great restriction of new edges and update of AsDes.
|
||||
@@ -1114,17 +1134,21 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
|
||||
}
|
||||
|
||||
TopTools_ListIteratorOfListOfShape itLFE(LFE);
|
||||
for (; itLFE.More(); itLFE.Next()) {
|
||||
for (; itLFE.More(); itLFE.Next())
|
||||
{
|
||||
const TopoDS_Face& NEF = TopoDS::Face(itLFE.Value());
|
||||
BRepOffset_Inter2d::Compute(AsDes,NEF,NewEdges,myTol);
|
||||
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(NEF);
|
||||
BRepOffset_Inter2d::Compute(AsDes, NEF, NewEdges, aCurrFaceTol);
|
||||
}
|
||||
//----------------------------------------------
|
||||
// Intersections 2d on caps.
|
||||
//----------------------------------------------
|
||||
Standard_Integer i;
|
||||
for (i = 1; i <= myFaces.Extent(); i++) {
|
||||
for (i = 1; i <= myFaces.Extent(); i++)
|
||||
{
|
||||
const TopoDS_Face& Cork = TopoDS::Face(myFaces(i));
|
||||
BRepOffset_Inter2d::Compute(AsDes,Cork,NewEdges,myTol);
|
||||
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(Cork);
|
||||
BRepOffset_Inter2d::Compute(AsDes, Cork, NewEdges, aCurrFaceTol);
|
||||
}
|
||||
|
||||
//-------------------------------
|
||||
|
@@ -537,11 +537,29 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face,
|
||||
TopTools_SequenceOfShape DegEdges;
|
||||
TopExp_Explorer Explo(Face, TopAbs_EDGE);
|
||||
for (; Explo.More(); Explo.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current());
|
||||
if (BRep_Tool::Degenerated(anEdge))
|
||||
DegEdges.Append(anEdge);
|
||||
}
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current());
|
||||
|
||||
if (BRep_Tool::Degenerated(anEdge))
|
||||
{
|
||||
Standard_Real aF, aL;
|
||||
Handle(Geom2d_Curve) c2d = BRep_Tool::CurveOnSurface(anEdge, Face, aF, aL);
|
||||
|
||||
gp_Pnt2d aFPnt2d = c2d->Value(aF),
|
||||
aLPnt2d = c2d->Value(aL);
|
||||
|
||||
gp_Pnt aFPnt = S->Value(aFPnt2d.X(), aFPnt2d.Y()),
|
||||
aLPnt = S->Value(aLPnt2d.X(), aLPnt2d.Y());
|
||||
|
||||
// aFPnt.SquareDistance(aLPnt) > Precision::SquareConfusion() -
|
||||
// is a sufficient condition of troubles: non-singular case, but edge is degenerated.
|
||||
// So, normal handling of degenerated edges is not applicable in case of non-singular point.
|
||||
if (aFPnt.SquareDistance(aLPnt) < Precision::SquareConfusion())
|
||||
{
|
||||
DegEdges.Append(anEdge);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DegEdges.IsEmpty())
|
||||
{
|
||||
const Standard_Real TolApex = 1.e-5;
|
||||
@@ -1640,6 +1658,3 @@ BRepOffset_Status BRepOffset_Offset::Status() const
|
||||
{
|
||||
return myStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -16,7 +16,7 @@
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAlgo_Section.hxx>
|
||||
#include <BRepAlgoAPI_Section.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepFill_Generator.hxx>
|
||||
#include <BRepLib_MakeEdge.hxx>
|
||||
@@ -126,8 +126,7 @@ void BRepProj_Projection::BuildSection (const TopoDS_Shape& theShape,
|
||||
Standard_ConstructionError::Raise(__FILE__": target shape has no faces");
|
||||
|
||||
// build section computing pcurves on the shape
|
||||
// BRepAlgoAPI_Section aSectionTool (aShape, theTool, Standard_False);
|
||||
BRepAlgo_Section aSectionTool (aShape, theTool, Standard_False);
|
||||
BRepAlgoAPI_Section aSectionTool (aShape, theTool, Standard_False);
|
||||
aSectionTool.Approximation (Standard_True);
|
||||
aSectionTool.ComputePCurveOn1 (Standard_True);
|
||||
aSectionTool.Build();
|
||||
|
@@ -211,24 +211,39 @@ static Standard_Integer deform(Draw_Interpretor& di,Standard_Integer n,const cha
|
||||
static Standard_Integer tcopy(Draw_Interpretor& di,Standard_Integer n,const char** a)
|
||||
{
|
||||
Standard_Boolean copyGeom = Standard_True;
|
||||
Standard_Boolean copyMesh = Standard_False;
|
||||
Standard_Integer iFirst = 1; // index of first shape argument
|
||||
|
||||
if (n > 1 && a[1][0] == '-' && a[1][1] == 'n' )
|
||||
if (n > 1)
|
||||
{
|
||||
copyGeom = Standard_False;
|
||||
iFirst = 2;
|
||||
for (Standard_Integer i = 1; i <= 2; i++)
|
||||
{
|
||||
if (a[i][0] != '-')
|
||||
break;
|
||||
if (a[i][1] == 'n')
|
||||
{
|
||||
copyGeom = Standard_False;
|
||||
iFirst++;
|
||||
}
|
||||
else if (a[i][1] == 'm')
|
||||
{
|
||||
copyMesh = Standard_True;
|
||||
iFirst++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (n < 3 || (n - iFirst) % 2) {
|
||||
cout << "Use: " << a[0] << " [-n(ogeom)] shape1 copy1 [shape2 copy2 [...]]" << endl;
|
||||
cout << "Option -n forbids copying of geometry (it will be shared)" << endl;
|
||||
cout << "Use: " << a[0] << " [-n(ogeom)] [-m(esh)] shape1 copy1 [shape2 copy2 [...]]" << endl;
|
||||
cout << "Option -n forbids copying of geometry (it will be shared)" << endl;
|
||||
cout << "Option -m forces copying of mesh (disabled by default)" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
BRepBuilderAPI_Copy cop;
|
||||
Standard_Integer nbPairs = (n - iFirst) / 2;
|
||||
for (Standard_Integer i=0; i < nbPairs; i++) {
|
||||
cop.Perform(DBRep::Get(a[i+iFirst]), copyGeom);
|
||||
cop.Perform(DBRep::Get(a[i+iFirst]), copyGeom, copyMesh);
|
||||
DBRep::Set(a[i+iFirst+1],cop.Shape());
|
||||
di << a[i+iFirst+1] << " ";
|
||||
}
|
||||
@@ -870,7 +885,7 @@ void BRepTest::BasicCommands(Draw_Interpretor& theCommands)
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("tcopy",
|
||||
"tcopy [-n(ogeom)] name1 result1 [name2 result2 ...]",
|
||||
"tcopy [-n(ogeom)] [-m(esh)] name1 result1 [name2 result2 ...]",
|
||||
__FILE__,
|
||||
tcopy,g);
|
||||
|
||||
|
@@ -25,3 +25,9 @@
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
|
||||
Standard_Boolean BRepTools_Modification::NewTriangulation(const TopoDS_Face&, Handle(Poly_Triangulation)&)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ class Geom_Curve;
|
||||
class TopoDS_Vertex;
|
||||
class gp_Pnt;
|
||||
class Geom2d_Curve;
|
||||
class Poly_Triangulation;
|
||||
|
||||
|
||||
class BRepTools_Modification;
|
||||
@@ -59,7 +60,12 @@ public:
|
||||
//! false, and the values of S, L, Tol, RevWires and
|
||||
//! RevFace are not significant.
|
||||
Standard_EXPORT virtual Standard_Boolean NewSurface (const TopoDS_Face& F, Handle(Geom_Surface)& S, TopLoc_Location& L, Standard_Real& Tol, Standard_Boolean& RevWires, Standard_Boolean& RevFace) = 0;
|
||||
|
||||
|
||||
//! Returns true if the face has been modified according to changed triangulation.
|
||||
//! If the face has been modified:
|
||||
//! - T is a new triangulation on the face
|
||||
Standard_EXPORT virtual Standard_Boolean NewTriangulation(const TopoDS_Face& F, Handle(Poly_Triangulation)& T);
|
||||
|
||||
//! Returns true if the edge, E, has been modified.
|
||||
//! If the edge has been modified:
|
||||
//! - C is the new geometry associated with the edge,
|
||||
|
@@ -286,6 +286,20 @@ Standard_Boolean BRepTools_Modifier::Rebuild
|
||||
B.NaturalRestriction(TopoDS::Face(result),
|
||||
BRep_Tool::NaturalRestriction(TopoDS::Face(S)));
|
||||
}
|
||||
|
||||
// update triangulation on the copied face
|
||||
Handle(Poly_Triangulation) aTriangulation;
|
||||
if (M->NewTriangulation(TopoDS::Face(S), aTriangulation))
|
||||
{
|
||||
if (rebuild) // the copied face already exists => update it
|
||||
B.UpdateFace(TopoDS::Face(result), aTriangulation);
|
||||
else
|
||||
{ // create new face with bare triangulation
|
||||
B.MakeFace(TopoDS::Face(result), aTriangulation);
|
||||
result.Location(S.Location());
|
||||
}
|
||||
rebuild = Standard_True;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
286
src/D3DHost/D3DHost_FrameBuffer.cxx
Normal file
286
src/D3DHost/D3DHost_FrameBuffer.cxx
Normal file
@@ -0,0 +1,286 @@
|
||||
// Created on: 2015-06-10
|
||||
// Created by: Kirill Gavrilov
|
||||
// Copyright (c) 2015 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 <d3d9.h>
|
||||
|
||||
#include <D3DHost_FrameBuffer.hxx>
|
||||
|
||||
#include <OpenGl_GlCore20.hxx>
|
||||
#include <OpenGl_ArbFBO.hxx>
|
||||
#include <Standard_ProgramError.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : D3DHost_FrameBuffer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
D3DHost_FrameBuffer::D3DHost_FrameBuffer()
|
||||
: OpenGl_FrameBuffer(),
|
||||
myD3dSurf (NULL),
|
||||
myD3dSurfShare (NULL),
|
||||
myGlD3dDevice (NULL),
|
||||
myGlD3dSurf (NULL)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ~D3DHost_FrameBuffer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
D3DHost_FrameBuffer::~D3DHost_FrameBuffer()
|
||||
{
|
||||
Release (NULL);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Release
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void D3DHost_FrameBuffer::Release (OpenGl_Context* theCtx)
|
||||
{
|
||||
if (myGlD3dDevice != NULL)
|
||||
{
|
||||
const OpenGl_GlFunctions* aFuncs = (theCtx != NULL && theCtx->IsValid())
|
||||
? (const OpenGl_GlFunctions* )theCtx->core11
|
||||
: NULL;
|
||||
if (myGlD3dSurf != NULL)
|
||||
{
|
||||
if (aFuncs != NULL)
|
||||
{
|
||||
aFuncs->wglDXUnregisterObjectNV (myGlD3dDevice, myGlD3dSurf);
|
||||
}
|
||||
myGlD3dSurf = NULL;
|
||||
}
|
||||
|
||||
if (aFuncs != NULL)
|
||||
{
|
||||
aFuncs->wglDXCloseDeviceNV (myGlD3dDevice);
|
||||
}
|
||||
myGlD3dDevice = NULL;
|
||||
}
|
||||
|
||||
if (myD3dSurf != NULL)
|
||||
{
|
||||
myD3dSurf->Release();
|
||||
myD3dSurf = NULL;
|
||||
myD3dSurfShare = NULL;
|
||||
}
|
||||
|
||||
OpenGl_FrameBuffer::Release (theCtx);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean D3DHost_FrameBuffer::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
IDirect3DDevice9* theD3DDevice,
|
||||
const Standard_Boolean theIsD3dEx,
|
||||
const Standard_Integer theSizeX,
|
||||
const Standard_Integer theSizeY)
|
||||
{
|
||||
myVPSizeX = theSizeX;
|
||||
myVPSizeY = theSizeY;
|
||||
const Standard_Integer aSizeX = theSizeX > 0 ? theSizeX : 2;
|
||||
const Standard_Integer aSizeY = theSizeY > 0 ? theSizeY : 2;
|
||||
|
||||
Release (theCtx.operator->());
|
||||
|
||||
// Render target surface should be lockable on
|
||||
// Windows XP and non-lockable on Windows Vista or higher
|
||||
if (theD3DDevice->CreateRenderTarget (aSizeX, aSizeY,
|
||||
D3DFMT_X8R8G8B8, D3DMULTISAMPLE_NONE, 0, theIsD3dEx ? TRUE : FALSE,
|
||||
&myD3dSurf, theIsD3dEx ? &myD3dSurfShare : NULL) != D3D_OK)
|
||||
{
|
||||
TCollection_ExtendedString aMsg = TCollection_ExtendedString()
|
||||
+ "D3DHost_FrameBuffer, could not D3DFMT_X8R8G8B8 render target " + aSizeX + "x" + aSizeY;
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB,
|
||||
GL_DEBUG_TYPE_ERROR_ARB,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH_ARB,
|
||||
aMsg);
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const OpenGl_GlFunctions* aFuncs = (const OpenGl_GlFunctions* )theCtx->core11;
|
||||
if (aFuncs->wglDXOpenDeviceNV == NULL)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB,
|
||||
GL_DEBUG_TYPE_ERROR_ARB,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH_ARB,
|
||||
"D3DHost_FrameBuffer, WGL_NV_DX_interop is unavailable!");
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myGlD3dDevice = aFuncs->wglDXOpenDeviceNV (theD3DDevice);
|
||||
if (myGlD3dDevice == NULL)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB,
|
||||
GL_DEBUG_TYPE_ERROR_ARB,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH_ARB,
|
||||
"D3DHost_FrameBuffer, could not create the GL <-> DirectX Interop using wglDXOpenDeviceNV()");
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if (!registerD3dBuffer (theCtx))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
theCtx->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
|
||||
|
||||
if (!myDepthStencilTexture->Init (theCtx, GL_DEPTH24_STENCIL8,
|
||||
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8,
|
||||
aSizeX, aSizeY, Graphic3d_TOT_2D))
|
||||
{
|
||||
TCollection_ExtendedString aMsg = TCollection_ExtendedString()
|
||||
+ "D3DHost_FrameBuffer, could not initialize GL_DEPTH24_STENCIL8 texture " + aSizeX + "x" + aSizeY;
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB,
|
||||
GL_DEBUG_TYPE_ERROR_ARB,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH_ARB,
|
||||
aMsg);
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : registerD3dBuffer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean D3DHost_FrameBuffer::registerD3dBuffer (const Handle(OpenGl_Context)& theCtx)
|
||||
{
|
||||
const OpenGl_GlFunctions* aFuncs = (const OpenGl_GlFunctions* )theCtx->core11;
|
||||
if (myGlD3dSurf != NULL)
|
||||
{
|
||||
if (!aFuncs->wglDXUnregisterObjectNV (myGlD3dDevice, myGlD3dSurf))
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB,
|
||||
GL_DEBUG_TYPE_ERROR_ARB,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH_ARB,
|
||||
"D3DHost_FrameBuffer, can not unregister color buffer");
|
||||
return Standard_False;
|
||||
}
|
||||
myGlD3dSurf = NULL;
|
||||
}
|
||||
|
||||
if (!aFuncs->wglDXSetResourceShareHandleNV (myD3dSurf, myD3dSurfShare))
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB,
|
||||
GL_DEBUG_TYPE_ERROR_ARB,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH_ARB,
|
||||
"D3DHost_FrameBuffer, wglDXSetResourceShareHandleNV() has failed");
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myColorTexture->Release (theCtx.operator->());
|
||||
myColorTexture->Create (theCtx);
|
||||
|
||||
myGlD3dSurf = aFuncs->wglDXRegisterObjectNV (myGlD3dDevice,
|
||||
myD3dSurf,
|
||||
myColorTexture->TextureId(),
|
||||
GL_TEXTURE_2D,
|
||||
WGL_ACCESS_WRITE_DISCARD_NV);
|
||||
|
||||
if (myGlD3dSurf == NULL)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB,
|
||||
GL_DEBUG_TYPE_ERROR_ARB,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH_ARB,
|
||||
"D3DHost_FrameBuffer, can not register color buffer");
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : BindBuffer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void D3DHost_FrameBuffer::BindBuffer (const Handle(OpenGl_Context)& theCtx)
|
||||
{
|
||||
Standard_ProgramError_Raise_if (myLockCount < 1, "D3DHost_FrameBuffer::BindBuffer(), resource should be locked beforehand!");
|
||||
|
||||
OpenGl_FrameBuffer::BindBuffer (theCtx);
|
||||
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_TEXTURE_2D, myColorTexture->TextureId(), 0);
|
||||
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
|
||||
GL_TEXTURE_2D, myDepthStencilTexture->TextureId(), 0);
|
||||
if (theCtx->arbFBO->glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB,
|
||||
GL_DEBUG_TYPE_ERROR_ARB,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH_ARB,
|
||||
"D3DHost_FrameBuffer, OpenGL FBO is incomplete!");
|
||||
Release (theCtx.operator->());
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : LockSurface
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void D3DHost_FrameBuffer::LockSurface (const Handle(OpenGl_Context)& theCtx)
|
||||
{
|
||||
if (myGlD3dSurf == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (++myLockCount > 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const OpenGl_GlFunctions* aFuncs = (const OpenGl_GlFunctions* )theCtx->core11;
|
||||
if (!aFuncs->wglDXLockObjectsNV (myGlD3dDevice, 1, &myGlD3dSurf))
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB,
|
||||
GL_DEBUG_TYPE_ERROR_ARB,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH_ARB,
|
||||
"D3DHost_FrameBuffer::LockSurface(), lock failed!");
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : UnlockSurface
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void D3DHost_FrameBuffer::UnlockSurface (const Handle(OpenGl_Context)& theCtx)
|
||||
{
|
||||
if (myGlD3dSurf == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (--myLockCount != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const OpenGl_GlFunctions* aFuncs = (const OpenGl_GlFunctions* )theCtx->core11;
|
||||
aFuncs->wglDXUnlockObjectsNV (myGlD3dDevice, 1, &myGlD3dSurf);
|
||||
}
|
83
src/D3DHost/D3DHost_FrameBuffer.hxx
Normal file
83
src/D3DHost/D3DHost_FrameBuffer.hxx
Normal file
@@ -0,0 +1,83 @@
|
||||
// Created on: 2015-06-10
|
||||
// Created by: Kirill Gavrilov
|
||||
// Copyright (c) 2015 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 _D3DHost_FrameBuffer_HeaderFile
|
||||
#define _D3DHost_FrameBuffer_HeaderFile
|
||||
|
||||
#include <OpenGl_FrameBuffer.hxx>
|
||||
|
||||
struct IDirect3DDevice9;
|
||||
|
||||
//! Implements bridge FBO for direct rendering to Direct3D surfaces.
|
||||
class D3DHost_FrameBuffer : public OpenGl_FrameBuffer
|
||||
{
|
||||
public:
|
||||
|
||||
//! Empty constructor.
|
||||
Standard_EXPORT D3DHost_FrameBuffer();
|
||||
|
||||
//! Destructor, should be called after Release().
|
||||
Standard_EXPORT ~D3DHost_FrameBuffer();
|
||||
|
||||
//! Releases D3D and OpenGL resources.
|
||||
Standard_EXPORT virtual void Release (OpenGl_Context* theCtx) Standard_OVERRIDE;
|
||||
|
||||
//! Initializes OpenGL FBO for Direct3D interoperability.
|
||||
Standard_EXPORT Standard_Boolean Init (const Handle(OpenGl_Context)& theCtx,
|
||||
IDirect3DDevice9* theD3DDevice,
|
||||
const Standard_Boolean theIsD3dEx,
|
||||
const Standard_Integer theSizeX,
|
||||
const Standard_Integer theSizeY);
|
||||
|
||||
//! Binds Direct3D color buffer to OpenGL texture.
|
||||
Standard_EXPORT Standard_Boolean registerD3dBuffer (const Handle(OpenGl_Context)& theCtx);
|
||||
|
||||
//! Binds Direct3D objects for OpenGL drawing.
|
||||
//! Should be called before LockSurface() and followed by UnlockSurface();
|
||||
Standard_EXPORT virtual void BindBuffer (const Handle(OpenGl_Context)& theCtx) Standard_OVERRIDE;
|
||||
|
||||
//! Acquires D3D resource for OpenGL usage.
|
||||
Standard_EXPORT virtual void LockSurface (const Handle(OpenGl_Context)& theCtx);
|
||||
|
||||
//! Releases D3D resource.
|
||||
Standard_EXPORT virtual void UnlockSurface (const Handle(OpenGl_Context)& theCtx);
|
||||
|
||||
//! Returns D3D surface used as color buffer.
|
||||
IDirect3DSurface9* D3dColorSurface() { return myD3dSurf; }
|
||||
|
||||
//! Returns WDDM hande for D3D color surface.
|
||||
HANDLE D3dColorSurfaceShare() { return myD3dSurfShare; }
|
||||
|
||||
protected:
|
||||
|
||||
using OpenGl_FrameBuffer::Init;
|
||||
|
||||
protected:
|
||||
|
||||
IDirect3DSurface9* myD3dSurf; //!< D3D surface
|
||||
HANDLE myD3dSurfShare; //!< D3D surface share handle in WDDM
|
||||
HANDLE myGlD3dDevice; //!< WGL/D3D device handle
|
||||
HANDLE myGlD3dSurf; //!< WGL/D3D surface handle
|
||||
Standard_Integer myLockCount; //!< locking counter
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI(D3DHost_FrameBuffer, OpenGl_FrameBuffer)
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(D3DHost_FrameBuffer, OpenGl_FrameBuffer)
|
||||
|
||||
#endif // _D3DHost_FrameBuffer_HeaderFile
|
104
src/D3DHost/D3DHost_GraphicDriver.cxx
Normal file
104
src/D3DHost/D3DHost_GraphicDriver.cxx
Normal file
@@ -0,0 +1,104 @@
|
||||
// Created on: 2015-06-10
|
||||
// Created by: Kirill Gavrilov
|
||||
// Copyright (c) 2015 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 <d3d9.h>
|
||||
|
||||
#include <D3DHost_GraphicDriver.hxx>
|
||||
|
||||
#include <D3DHost_Workspace.hxx>
|
||||
#include <OpenGl_CView.hxx>
|
||||
#include <Visual3d_View.hxx>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment (lib, "D3D9.lib")
|
||||
#endif
|
||||
|
||||
// =======================================================================
|
||||
// function : D3DHost_GraphicDriver
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
D3DHost_GraphicDriver::D3DHost_GraphicDriver()
|
||||
: OpenGl_GraphicDriver (Handle(Aspect_DisplayConnection)(), Standard_False)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ~D3DHost_GraphicDriver
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
D3DHost_GraphicDriver::~D3DHost_GraphicDriver()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : View
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean D3DHost_GraphicDriver::View (Graphic3d_CView& theCView)
|
||||
{
|
||||
Handle(OpenGl_Context) aShareCtx = GetSharedContext();
|
||||
OpenGl_CView* aCView = (OpenGl_CView* )theCView.ptrView;
|
||||
if (aCView != NULL
|
||||
&& myMapOfView.Contains (aCView->View))
|
||||
{
|
||||
Handle(D3DHost_Workspace) anOldWS = Handle(D3DHost_Workspace)::DownCast (aCView->WS);
|
||||
Handle(D3DHost_Workspace) aWS = new D3DHost_Workspace (this, theCView.DefWindow, theCView.GContext, myCaps, aShareCtx);
|
||||
theCView.ptrFBO = aWS->D3dWglBuffer().operator->();
|
||||
aCView->WS = aWS;
|
||||
aWS->SetActiveView (aCView->View, theCView.ViewId);
|
||||
|
||||
myMapOfWS.Remove (anOldWS);
|
||||
myMapOfWS.Add (aWS);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Handle(D3DHost_Workspace) aWS = new D3DHost_Workspace (this, theCView.DefWindow, theCView.GContext, myCaps, aShareCtx);
|
||||
Handle(OpenGl_View) aView = new OpenGl_View (theCView.Context, &myStateCounter);
|
||||
myMapOfWS .Add (aWS);
|
||||
myMapOfView.Add (aView);
|
||||
|
||||
aCView = new OpenGl_CView();
|
||||
aCView->View = aView;
|
||||
aCView->WS = aWS;
|
||||
theCView.ptrFBO = aWS->D3dWglBuffer().operator->();
|
||||
theCView.ptrView = aCView;
|
||||
aWS->SetActiveView (aCView->View, theCView.ViewId);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : D3dColorSurface
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
IDirect3DSurface9* D3DHost_GraphicDriver::D3dColorSurface (const Handle(Visual3d_View)& theView) const
|
||||
{
|
||||
Graphic3d_CView* aCView = (Graphic3d_CView* )(theView->CView());
|
||||
if (aCView == NULL
|
||||
|| aCView->ptrView == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Handle(D3DHost_Workspace) aWS = Handle(D3DHost_Workspace)::DownCast (((OpenGl_CView* )aCView->ptrView)->WS);
|
||||
if (aWS.IsNull()
|
||||
|| aWS->D3dWglBuffer().IsNull())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return aWS->D3dWglBuffer()->D3dColorSurface();
|
||||
}
|
49
src/D3DHost/D3DHost_GraphicDriver.hxx
Normal file
49
src/D3DHost/D3DHost_GraphicDriver.hxx
Normal file
@@ -0,0 +1,49 @@
|
||||
// Created on: 2015-06-10
|
||||
// Created by: Kirill Gavrilov
|
||||
// Copyright (c) 2015 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 _D3DHost_GraphicDriver_HeaderFile
|
||||
#define _D3DHost_GraphicDriver_HeaderFile
|
||||
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
|
||||
class Visual3d_View;
|
||||
struct IDirect3DSurface9;
|
||||
|
||||
//! This class defines D3D host for an OpenGl graphic driver
|
||||
class D3DHost_GraphicDriver : public OpenGl_GraphicDriver
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT D3DHost_GraphicDriver();
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~D3DHost_GraphicDriver();
|
||||
|
||||
//! Create new view.
|
||||
Standard_EXPORT virtual Standard_Boolean View (Graphic3d_CView& theCView);
|
||||
|
||||
//! Return D3D surface for specified view.
|
||||
Standard_EXPORT IDirect3DSurface9* D3dColorSurface (const Handle(Visual3d_View)& theCView) const;
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI(D3DHost_GraphicDriver, OpenGl_GraphicDriver)
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(D3DHost_GraphicDriver, OpenGl_GraphicDriver)
|
||||
|
||||
#endif // _D3DHost_GraphicDriver_HeaderFile
|
364
src/D3DHost/D3DHost_Workspace.cxx
Normal file
364
src/D3DHost/D3DHost_Workspace.cxx
Normal file
@@ -0,0 +1,364 @@
|
||||
// Created on: 2015-06-10
|
||||
// Created by: Kirill Gavrilov
|
||||
// Copyright (c) 2015 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 <d3d9.h>
|
||||
|
||||
#include <D3DHost_Workspace.hxx>
|
||||
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : d3dFormatError
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TCollection_AsciiString D3DHost_Workspace::d3dFormatError (HRESULT theErrCode)
|
||||
{
|
||||
switch (theErrCode)
|
||||
{
|
||||
case D3D_OK: return "OK";
|
||||
case D3DERR_DEVICELOST: return "Device lost";
|
||||
case D3DERR_DEVICEREMOVED: return "Device removed";
|
||||
case D3DERR_DRIVERINTERNALERROR: return "Driver internal error";
|
||||
case D3DERR_OUTOFVIDEOMEMORY: return "Out of video memory";
|
||||
case D3DERR_INVALIDCALL: return "Invalid call";
|
||||
default: return TCollection_AsciiString ("Error #") + int(theErrCode) + ")";
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : D3DHost_Workspace
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
D3DHost_Workspace::D3DHost_Workspace (const Handle(OpenGl_GraphicDriver)& theDriver,
|
||||
const CALL_DEF_WINDOW& theCWindow,
|
||||
Aspect_RenderingContext theGContext,
|
||||
const Handle(OpenGl_Caps)& theCaps,
|
||||
const Handle(OpenGl_Context)& theShareCtx)
|
||||
: OpenGl_Workspace (theDriver, theCWindow, theGContext, theCaps, theShareCtx),
|
||||
myD3dLib (NULL),
|
||||
myD3dDevice (NULL),
|
||||
myRefreshRate (D3DPRESENT_RATE_DEFAULT),
|
||||
myIsD3dEx (false)
|
||||
{
|
||||
myD3dParams = {};
|
||||
myCurrMode = {};
|
||||
myD3dParams.Windowed = TRUE;
|
||||
myD3dParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
myD3dParams.BackBufferFormat = D3DFMT_X8R8G8B8;
|
||||
myD3dParams.BackBufferCount = 1;
|
||||
myD3dParams.BackBufferHeight = 2;
|
||||
myD3dParams.BackBufferWidth = 2;
|
||||
myD3dParams.EnableAutoDepthStencil = FALSE;
|
||||
myD3dParams.AutoDepthStencilFormat = D3DFMT_D16_LOCKABLE;
|
||||
myD3dParams.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
|
||||
myD3dParams.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
|
||||
|
||||
d3dInit (theCWindow);
|
||||
d3dCreateRenderTarget();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ~D3DHost_Workspace
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
D3DHost_Workspace::~D3DHost_Workspace()
|
||||
{
|
||||
if (!myD3dWglFbo.IsNull())
|
||||
{
|
||||
myD3dWglFbo->Release (myGlContext.operator->());
|
||||
myD3dWglFbo.Nullify();
|
||||
}
|
||||
if (myD3dDevice != NULL)
|
||||
{
|
||||
myD3dDevice->Release();
|
||||
myD3dDevice = NULL;
|
||||
}
|
||||
if (myD3dLib != NULL)
|
||||
{
|
||||
myD3dLib->Release();
|
||||
myD3dLib = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : d3dInitLib
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool D3DHost_Workspace::d3dInitLib()
|
||||
{
|
||||
if (myD3dLib == NULL)
|
||||
{
|
||||
IDirect3D9Ex* aD3dLibEx = NULL;
|
||||
// we link against d3d (using Direct3DCreate9 symbol), thus it should be already loaded
|
||||
HMODULE aLib = GetModuleHandleW (L"d3d9");
|
||||
if (aLib != NULL)
|
||||
{
|
||||
// retrieve D3D9Ex function dynamically (available only since Vista+)
|
||||
typedef HRESULT (WINAPI* Direct3DCreate9Ex_t)(UINT , IDirect3D9Ex** );
|
||||
Direct3DCreate9Ex_t Direct3DCreate9ExProc = (Direct3DCreate9Ex_t )GetProcAddress (aLib, "Direct3DCreate9Ex");
|
||||
if (Direct3DCreate9ExProc != NULL)
|
||||
{
|
||||
Direct3DCreate9ExProc(D3D_SDK_VERSION, &aD3dLibEx);
|
||||
}
|
||||
}
|
||||
myD3dLib = aD3dLibEx;
|
||||
myIsD3dEx = aD3dLibEx != NULL;
|
||||
if (myD3dLib == NULL)
|
||||
{
|
||||
myD3dLib = Direct3DCreate9 (D3D_SDK_VERSION);
|
||||
}
|
||||
}
|
||||
return myD3dLib != NULL;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : d3dInit
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool D3DHost_Workspace::d3dInit (const CALL_DEF_WINDOW& theCWindow)
|
||||
{
|
||||
if (!d3dInitLib())
|
||||
{
|
||||
myGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB,
|
||||
GL_DEBUG_TYPE_ERROR_ARB,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH_ARB,
|
||||
"Direct3DCreate9 failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
UINT anAdapterId = D3DADAPTER_DEFAULT;
|
||||
|
||||
// setup the present parameters
|
||||
if (myD3dLib->GetAdapterDisplayMode (anAdapterId, &myCurrMode) == D3D_OK)
|
||||
{
|
||||
myD3dParams.BackBufferFormat = myCurrMode.Format;
|
||||
myRefreshRate = myCurrMode.RefreshRate;
|
||||
}
|
||||
myD3dParams.Windowed = TRUE;
|
||||
myD3dParams.BackBufferWidth = theCWindow.dx;
|
||||
myD3dParams.BackBufferHeight = theCWindow.dy;
|
||||
myD3dParams.hDeviceWindow = (HWND )theCWindow.XWindow;
|
||||
|
||||
// create the Video Device
|
||||
HRESULT isOK = myD3dLib->CreateDevice (anAdapterId, D3DDEVTYPE_HAL,
|
||||
(HWND )theCWindow.XWindow,
|
||||
D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE,
|
||||
&myD3dParams, &myD3dDevice);
|
||||
if (isOK < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return myD3dDevice != NULL;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : d3dReset
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool D3DHost_Workspace::d3dReset (const CALL_DEF_WINDOW& theCWindow)
|
||||
{
|
||||
if (myD3dDevice == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
myD3dParams.Windowed = TRUE;
|
||||
myD3dParams.BackBufferWidth = theCWindow.dx;
|
||||
myD3dParams.BackBufferHeight = theCWindow.dy;
|
||||
myD3dParams.hDeviceWindow = (HWND )theCWindow.XWindow;
|
||||
myD3dParams.FullScreen_RefreshRateInHz = !myD3dParams.Windowed ? myRefreshRate : 0;
|
||||
|
||||
HRESULT isOK = myD3dDevice->Reset(&myD3dParams);
|
||||
return isOK == D3D_OK;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : d3dCreateRenderTarget
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool D3DHost_Workspace::d3dCreateRenderTarget()
|
||||
{
|
||||
if (myD3dWglFbo.IsNull())
|
||||
{
|
||||
myD3dWglFbo = new D3DHost_FrameBuffer();
|
||||
}
|
||||
if (!myD3dWglFbo->Init (myGlContext, myD3dDevice, myIsD3dEx, myWidth, myHeight))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
myD3dDevice->SetRenderTarget (0, myD3dWglFbo->D3dColorSurface());
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : d3dBeginRender
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void D3DHost_Workspace::d3dBeginRender()
|
||||
{
|
||||
if (myD3dDevice == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// clear the back buffer
|
||||
myD3dDevice->Clear (0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
|
||||
myD3dDevice->BeginScene();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : d3dEndRender
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void D3DHost_Workspace::d3dEndRender()
|
||||
{
|
||||
if (myD3dDevice != NULL)
|
||||
{
|
||||
myD3dDevice->EndScene();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : d3dSwap
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool D3DHost_Workspace::d3dSwap()
|
||||
{
|
||||
if (myD3dDevice == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const HRESULT isOK = myD3dDevice->Present (NULL, NULL, NULL, NULL);
|
||||
if (isOK != D3D_OK)
|
||||
{
|
||||
TCollection_ExtendedString aMsg = TCollection_ExtendedString()
|
||||
+ "Direct3D9, Present device failed, " + d3dFormatError (isOK);
|
||||
myGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB,
|
||||
GL_DEBUG_TYPE_ERROR_ARB,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH_ARB,
|
||||
aMsg);
|
||||
}
|
||||
return isOK == D3D_OK;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Redraw
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void D3DHost_Workspace::Redraw (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer)
|
||||
{
|
||||
if (!Activate()
|
||||
|| myD3dDevice == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myToFlipOutput = Standard_True;
|
||||
myD3dWglFbo->LockSurface (myGlContext);
|
||||
OpenGl_Workspace::Redraw (theCView, theCUnderLayer, theCOverLayer);
|
||||
myD3dWglFbo->UnlockSurface (myGlContext);
|
||||
myToFlipOutput = Standard_False;
|
||||
if (myGlContext->caps->buffersNoSwap)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// blit result to the D3D back buffer and swap
|
||||
d3dBeginRender();
|
||||
|
||||
IDirect3DSurface9* aBackbuffer = NULL;
|
||||
myD3dDevice->GetBackBuffer (0, 0, D3DBACKBUFFER_TYPE_MONO, &aBackbuffer);
|
||||
myD3dDevice->StretchRect (myD3dWglFbo->D3dColorSurface(), NULL, aBackbuffer, NULL, D3DTEXF_LINEAR);
|
||||
aBackbuffer->Release();
|
||||
|
||||
d3dEndRender();
|
||||
d3dSwap();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : RedrawImmediate
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void D3DHost_Workspace::RedrawImmediate (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer)
|
||||
{
|
||||
if (!myTransientDrawToFront
|
||||
|| !myBackBufferRestored
|
||||
|| (myGlContext->caps->buffersNoSwap && !myMainSceneFbos[0]->IsValid()))
|
||||
{
|
||||
Redraw (theCView, theCUnderLayer, theCOverLayer);
|
||||
return;
|
||||
}
|
||||
else if (!Activate()
|
||||
|| myD3dDevice == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myToFlipOutput = Standard_True;
|
||||
myD3dWglFbo->LockSurface (myGlContext);
|
||||
OpenGl_Workspace::RedrawImmediate (theCView, theCUnderLayer, theCOverLayer);
|
||||
myD3dWglFbo->UnlockSurface (myGlContext);
|
||||
myToFlipOutput = Standard_False;
|
||||
if (myGlContext->caps->buffersNoSwap)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// blit result to the D3D back buffer and swap
|
||||
d3dBeginRender();
|
||||
|
||||
IDirect3DSurface9* aBackbuffer = NULL;
|
||||
myD3dDevice->GetBackBuffer (0, 0, D3DBACKBUFFER_TYPE_MONO, &aBackbuffer);
|
||||
myD3dDevice->StretchRect (myD3dWglFbo->D3dColorSurface(), NULL, aBackbuffer, NULL, D3DTEXF_LINEAR);
|
||||
aBackbuffer->Release();
|
||||
|
||||
d3dEndRender();
|
||||
d3dSwap();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Resize
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void D3DHost_Workspace::Resize (const CALL_DEF_WINDOW& theCWindow)
|
||||
{
|
||||
const Standard_Integer aWidthOld = myWidth;
|
||||
const Standard_Integer aHeightOld = myHeight;
|
||||
OpenGl_Workspace::Resize (theCWindow);
|
||||
if (aWidthOld == myWidth
|
||||
&& aHeightOld == myHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myD3dWglFbo.IsNull())
|
||||
{
|
||||
myD3dWglFbo->Release (myGlContext.operator->());
|
||||
}
|
||||
if (!myGlContext->caps->buffersNoSwap)
|
||||
{
|
||||
d3dReset (theCWindow);
|
||||
}
|
||||
d3dCreateRenderTarget();
|
||||
}
|
110
src/D3DHost/D3DHost_Workspace.hxx
Normal file
110
src/D3DHost/D3DHost_Workspace.hxx
Normal file
@@ -0,0 +1,110 @@
|
||||
// Created on: 2015-06-10
|
||||
// Created by: Kirill Gavrilov
|
||||
// Copyright (c) 2015 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 _D3DHost_Workspace_HeaderFile
|
||||
#define _D3DHost_Workspace_HeaderFile
|
||||
|
||||
#include <d3d9.h>
|
||||
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
#include <D3DHost_FrameBuffer.hxx>
|
||||
|
||||
//! The D3D host containing OpenGL viewer.
|
||||
class D3DHost_Workspace : public OpenGl_Workspace
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Main constructor.
|
||||
Standard_EXPORT D3DHost_Workspace (const Handle(OpenGl_GraphicDriver)& theDriver,
|
||||
const CALL_DEF_WINDOW& theCWindow,
|
||||
Aspect_RenderingContext theGContext,
|
||||
const Handle(OpenGl_Caps)& theCaps,
|
||||
const Handle(OpenGl_Context)& theShareCtx);
|
||||
|
||||
//! Destroy D3D connection and OpenGL workspace.
|
||||
Standard_EXPORT virtual ~D3DHost_Workspace();
|
||||
|
||||
//! Resizes the window.
|
||||
Standard_EXPORT virtual void Resize (const CALL_DEF_WINDOW& theCWindow) Standard_OVERRIDE;
|
||||
|
||||
//! Redraw the all content.
|
||||
Standard_EXPORT virtual void Redraw (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer) Standard_OVERRIDE;
|
||||
|
||||
//! Redraw only immediate layer.
|
||||
Standard_EXPORT virtual void RedrawImmediate (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer) Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
//! @return true if IDirect3DDevice9Ex device has been created
|
||||
bool isD3dEx() const { return myIsD3dEx; }
|
||||
|
||||
//! Access Direct3D device instance.
|
||||
IDirect3DDevice9* D3dDevice() const { return myD3dDevice; }
|
||||
|
||||
//! Return D3D/WGL FBO.
|
||||
const Handle(D3DHost_FrameBuffer)& D3dWglBuffer() const { return myD3dWglFbo; }
|
||||
|
||||
protected:
|
||||
|
||||
//! Auxiliary method.
|
||||
Standard_EXPORT static TCollection_AsciiString d3dFormatError (HRESULT theErrCode);
|
||||
|
||||
//! Initialize the D3D library.
|
||||
Standard_EXPORT bool d3dInitLib();
|
||||
|
||||
//! Initialize Direct3D output device.
|
||||
Standard_EXPORT bool d3dInit (const CALL_DEF_WINDOW& theCWindow);
|
||||
|
||||
//! Reset Direct3D output settings. Could be used to switch windowed/fullscreen modes.
|
||||
//! Use very carefully! Most objects should be released before and recreated after!
|
||||
Standard_EXPORT bool d3dReset (const CALL_DEF_WINDOW& theCWindow);
|
||||
|
||||
//! (Re-)create D3D surface.
|
||||
Standard_EXPORT bool d3dCreateRenderTarget();
|
||||
|
||||
//! Starts the scene render.
|
||||
//! Clears the backbuffer and sets the device to start rendering to it.
|
||||
Standard_EXPORT void d3dBeginRender();
|
||||
|
||||
//! Ends the scene render.
|
||||
Standard_EXPORT void d3dEndRender();
|
||||
|
||||
//! Presents to the screen.
|
||||
Standard_EXPORT bool d3dSwap();
|
||||
|
||||
protected:
|
||||
|
||||
IDirect3D9* myD3dLib; //!< Direct3D library instance
|
||||
IDirect3DDevice9* myD3dDevice; //!< Direct3D device object
|
||||
D3DPRESENT_PARAMETERS myD3dParams; //!< parameters for created Direct3D device
|
||||
D3DDISPLAYMODE myCurrMode; //!< temporary variable
|
||||
UINT myRefreshRate; //!< refresh rate in fullscreen mode
|
||||
bool myIsD3dEx; //!< D3dEx flag for WDDM
|
||||
Handle(D3DHost_FrameBuffer) myD3dWglFbo; //!< D3D/WGL interop FBO
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI(D3DHost_Workspace, OpenGl_Workspace)
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(D3DHost_Workspace, OpenGl_Workspace)
|
||||
|
||||
#endif // _D3DHost_Workspace_HeaderFile
|
6
src/D3DHost/FILES
Normal file
6
src/D3DHost/FILES
Normal file
@@ -0,0 +1,6 @@
|
||||
D3DHost_GraphicDriver.hxx
|
||||
D3DHost_GraphicDriver.cxx
|
||||
D3DHost_FrameBuffer.hxx
|
||||
D3DHost_FrameBuffer.cxx
|
||||
D3DHost_Workspace.hxx
|
||||
D3DHost_Workspace.cxx
|
@@ -210,7 +210,7 @@ void Extrema_GenExtCC::Perform()
|
||||
anIntervals2.Upper() - anIntervals2.Lower())
|
||||
* Precision::PConfusion() / (2.0 * Sqrt(2.0));
|
||||
Extrema_CCPointsInspector anInspector(Precision::PConfusion());
|
||||
NCollection_CellFilter<Extrema_CCPointsInspector> aFilter(aCellSize);
|
||||
NCollection_CellFilter<Extrema_CCPointsInspector> aFilter(Extrema_CCPointsInspector::Dimension, aCellSize);
|
||||
NCollection_Vector<gp_XY> aPnts;
|
||||
|
||||
Standard_Integer i,j,k;
|
||||
|
@@ -11,3 +11,6 @@ Font_NameOfFont.hxx
|
||||
Font_NListOfSystemFont.hxx
|
||||
Font_SystemFont.cxx
|
||||
Font_SystemFont.hxx
|
||||
Font_NameOfFont.hxx
|
||||
Font_TextFormatter.hxx
|
||||
Font_TextFormatter.cxx
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user