mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5949fa544d | ||
|
a4eda038a8 |
@@ -86,11 +86,6 @@ if (BUILD_WITH_DEBUG)
|
||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:DEBUG>:OCCT_DEBUG>)
|
||||
endif()
|
||||
|
||||
# option disabling OCCT exceptions in Release builds (No_Exception)
|
||||
if (NOT DEFINED BUILD_RELEASE_DISABLE_EXCEPTIONS)
|
||||
set (BUILD_RELEASE_DISABLE_EXCEPTIONS ON CACHE BOOL "${BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR}")
|
||||
endif()
|
||||
|
||||
# option to enable or disable use of precompiled headers
|
||||
if (NOT DEFINED BUILD_USE_PCH)
|
||||
set (BUILD_USE_PCH OFF CACHE BOOL "${BUILD_USE_PCH_DESCR}")
|
||||
|
1
adm/.gitignore
vendored
1
adm/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build-*
|
@@ -203,7 +203,6 @@ n Aspect
|
||||
n DsgPrs
|
||||
n Graphic3d
|
||||
n Image
|
||||
n Media
|
||||
n MeshVS
|
||||
n OpenGl
|
||||
n D3DHost
|
||||
|
@@ -65,7 +65,6 @@ if (WIN32)
|
||||
set (CSF_shell32 "shell32.lib")
|
||||
set (CSF_wsock32 "wsock32.lib")
|
||||
set (CSF_psapi "psapi.lib")
|
||||
set (CSF_winmm "winmm.lib")
|
||||
set (CSF_d3d9 "D3D9.lib")
|
||||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" OR USE_GLES2)
|
||||
set (CSF_OpenGlLibs "libEGL libGLESv2")
|
||||
|
@@ -143,7 +143,5 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
|
||||
endif()
|
||||
|
||||
if (BUILD_RELEASE_DISABLE_EXCEPTIONS)
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
|
||||
endif()
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
|
||||
|
@@ -28,11 +28,6 @@ Applies only for Debug configuration.")
|
||||
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
|
||||
"Append the postfix to names of output libraries")
|
||||
|
||||
set (BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR
|
||||
"Disables exceptions like Standard_OutOfRange in Release builds.
|
||||
Defines No_Exception macros for Release builds when enabled (default).
|
||||
These exceptions are always enabled in Debug builds, but disable in Release for better performance")
|
||||
|
||||
set (BUILD_ENABLE_FPE_SIGNAL_HANDLER_DESCR
|
||||
"Enable/Disable the floating point exceptions (FPE) during DRAW execution only.
|
||||
Corresponding environment variable (CSF_FPE) can be changed manually
|
||||
|
@@ -30,30 +30,10 @@ set aRowIter 0
|
||||
set aCheckRowIter 0
|
||||
frame .myFrame -padx 5 -pady 5
|
||||
pack .myFrame -fill both -expand 1
|
||||
frame .myFrame.myPrjFrame
|
||||
frame .myFrame.myVsFrame
|
||||
frame .myFrame.myHxxChecks
|
||||
frame .myFrame.myChecks
|
||||
|
||||
# project file format
|
||||
set SYS_PRJFMT_LIST {}
|
||||
set SYS_PRJNAME_LIST {}
|
||||
if { "$::tcl_platform(platform)" == "windows" } {
|
||||
lappend ::SYS_PRJFMT_LIST "vcxproj"
|
||||
lappend ::SYS_PRJNAME_LIST "Visual Studio (.vcxproj)"
|
||||
}
|
||||
if { "$tcl_platform(os)" == "Darwin" } {
|
||||
lappend ::SYS_PRJFMT_LIST "xcd"
|
||||
lappend ::SYS_PRJNAME_LIST "XCode (.xcd)"
|
||||
}
|
||||
lappend ::SYS_PRJFMT_LIST "cbp"
|
||||
lappend ::SYS_PRJNAME_LIST "Code Blocks (.cbp)"
|
||||
lappend ::SYS_PRJFMT_LIST "pro"
|
||||
lappend ::SYS_PRJNAME_LIST "Qt Creator (.pro)"
|
||||
|
||||
set aPrjIndex [lsearch $::SYS_PRJFMT_LIST $::PRJFMT]
|
||||
set ::PRJNAME [lindex $::SYS_PRJNAME_LIST $aPrjIndex]
|
||||
|
||||
set SYS_VS_LIST {}
|
||||
set SYS_VC_LIST {}
|
||||
set SYS_VCVARS_LIST {}
|
||||
@@ -121,7 +101,6 @@ proc wokdep:gui:Close {} {
|
||||
}
|
||||
|
||||
proc wokdep:gui:SwitchConfig {} {
|
||||
set ::PRJFMT [lindex $::SYS_PRJFMT_LIST [.myFrame.myPrjFrame.myPrjCombo current]]
|
||||
set ::VCVER [lindex $::SYS_VC_LIST [.myFrame.myVsFrame.myVsCombo current]]
|
||||
set ::VCVARS [lindex $::SYS_VCVARS_LIST [.myFrame.myVsFrame.myVsCombo current]]
|
||||
|
||||
@@ -411,8 +390,6 @@ proc wokdep:gui:Show64Bitness { theRowIter } {
|
||||
}
|
||||
|
||||
# Header
|
||||
ttk::label .myFrame.myPrjFrame.myPrjLbl -text "Project format:" -padding {5 5 20 5}
|
||||
ttk::combobox .myFrame.myPrjFrame.myPrjCombo -values $SYS_PRJNAME_LIST -state readonly -textvariable PRJNAME -width 40
|
||||
ttk::label .myFrame.myVsFrame.myVsLbl -text "Visual Studio configuration:" -padding {5 5 20 5}
|
||||
ttk::combobox .myFrame.myVsFrame.myVsCombo -values $SYS_VS_LIST -state readonly -textvariable VSVER -width 40
|
||||
ttk::combobox .myFrame.myVsFrame.myArchCombo -values { {32} {64} } -textvariable ARCH -state readonly -width 6
|
||||
@@ -517,10 +494,6 @@ ttk::button .myFrame.myClose -text "Close" -command wokdep:gui:Close
|
||||
|
||||
# Create grid
|
||||
# Header
|
||||
grid .myFrame.myPrjFrame -row $aRowIter -column 0 -columnspan 10 -sticky w
|
||||
grid .myFrame.myPrjFrame.myPrjLbl -row 0 -column 0
|
||||
grid .myFrame.myPrjFrame.myPrjCombo -row 0 -column 1
|
||||
incr aRowIter
|
||||
if { "$tcl_platform(platform)" == "windows" } {
|
||||
grid .myFrame.myVsFrame -row $aRowIter -column 0 -columnspan 10 -sticky w
|
||||
grid .myFrame.myVsFrame.myVsLbl -row 0 -column 0
|
||||
@@ -619,9 +592,6 @@ grid .myFrame.mySave -row $aRowIter -column 4 -columnspan 2
|
||||
grid .myFrame.myClose -row $aRowIter -column 6 -columnspan 2
|
||||
|
||||
# Bind events
|
||||
bind .myFrame.myPrjFrame.myPrjCombo <<ComboboxSelected>> {
|
||||
wokdep:gui:SwitchConfig
|
||||
}
|
||||
bind .myFrame.myVsFrame.myVsCombo <<ComboboxSelected>> {
|
||||
wokdep:gui:SwitchConfig
|
||||
}
|
||||
|
@@ -27,10 +27,8 @@ if { "$tcl_platform(platform)" == "unix" } {
|
||||
set SYS_EXE_SUFFIX ""
|
||||
if { "$tcl_platform(os)" == "Darwin" } {
|
||||
set SYS_LIB_SUFFIX "dylib"
|
||||
set PRJFMT "xcd"
|
||||
} else {
|
||||
set SYS_LIB_SUFFIX "so"
|
||||
set PRJFMT "cbp"
|
||||
}
|
||||
set VCVER "gcc"
|
||||
set VCVARS ""
|
||||
@@ -41,7 +39,6 @@ if { "$tcl_platform(platform)" == "unix" } {
|
||||
set SYS_EXE_SUFFIX ".exe"
|
||||
set VCVER "vc10"
|
||||
set VCVARS ""
|
||||
set PRJFMT "vcxproj"
|
||||
}
|
||||
|
||||
set SHORTCUT_HEADERS "ShortCut"
|
||||
@@ -85,7 +82,7 @@ if { "$tcl_platform(platform)" != "windows" } {
|
||||
set HAVE_D3D ""
|
||||
set HAVE_RelWithDebInfo ""
|
||||
}
|
||||
foreach anEnvIter {ARCH VCVER VCVARS PRJFMT PRODUCTS_PATH} {
|
||||
foreach anEnvIter {ARCH VCVER VCVARS PRODUCTS_PATH} {
|
||||
if { [info exists ::env(${anEnvIter})] } {
|
||||
set ${anEnvIter} "$::env(${anEnvIter})"
|
||||
}
|
||||
@@ -1121,33 +1118,15 @@ proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
|
||||
return "$isFound"
|
||||
}
|
||||
|
||||
# Returns OCCT version string from file Standard_Version.hxx (if available)
|
||||
proc wokdep:DetectCasVersion {} {
|
||||
set occt_ver 7.0.0
|
||||
set aCasRoot [file normalize [file dirname [info script]]]
|
||||
set filename "${aCasRoot}/src/Standard/Standard_Version.hxx"
|
||||
if { [file exists $filename] } {
|
||||
set fh [open $filename "r"]
|
||||
set fh_loaded [read $fh]
|
||||
close $fh
|
||||
regexp {[^/]\s*#\s*define\s+OCC_VERSION_COMPLETE\s+\"([^\s]*)\"} $fh_loaded dummy occt_ver
|
||||
} else {
|
||||
puts "Error: file '$filename' not found"
|
||||
}
|
||||
return $occt_ver
|
||||
}
|
||||
|
||||
# Generate (override) custom environment file
|
||||
proc wokdep:SaveCustom {} {
|
||||
set aGenInfo "This environment file was generated by genconf.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
|
||||
if { "$::tcl_platform(platform)" == "windows" } {
|
||||
set aCustomFilePath "./custom.bat"
|
||||
set aFile [open $aCustomFilePath "w"]
|
||||
puts $aFile "@echo off"
|
||||
puts $aFile "rem $aGenInfo"
|
||||
puts $aFile "rem 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 "set PRJFMT=$::PRJFMT"
|
||||
puts $aFile "set VCVER=$::VCVER"
|
||||
puts $aFile "set ARCH=$::ARCH"
|
||||
puts $aFile "set VCVARS=$::VCVARS"
|
||||
@@ -1196,10 +1175,9 @@ proc wokdep:SaveCustom {} {
|
||||
set aCustomFilePath "./custom.sh"
|
||||
set aFile [open $aCustomFilePath "w"]
|
||||
puts $aFile "#!/bin/bash"
|
||||
puts $aFile "# $aGenInfo"
|
||||
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 PRJFMT=$::PRJFMT"
|
||||
puts $aFile "export ARCH=$::ARCH"
|
||||
puts $aFile "export SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
|
||||
|
||||
@@ -1233,52 +1211,6 @@ proc wokdep:SaveCustom {} {
|
||||
|
||||
close $aFile
|
||||
}
|
||||
|
||||
puts "Configuration saved to file '$aCustomFilePath'"
|
||||
|
||||
if { "$::PRJFMT" == "pro" } {
|
||||
set aCasVer [wokdep:DetectCasVersion]
|
||||
set aCustomFilePath "./adm/qmake/custom.auto.pri"
|
||||
set aFile [open $aCustomFilePath "w"]
|
||||
puts $aFile "# $aGenInfo"
|
||||
|
||||
puts $aFile ""
|
||||
puts $aFile "VERSION=$aCasVer"
|
||||
puts $aFile "PRODUCTS_PATH=\"$::PRODUCTS_PATH\""
|
||||
|
||||
puts $aFile ""
|
||||
puts $aFile "# Optional 3rd-parties switches"
|
||||
foreach anEnvIter $::THE_ENV_VARIABLES {
|
||||
set aName ${anEnvIter}
|
||||
set aValue [set ::${anEnvIter}]
|
||||
if { "$aValue" == "true" } {
|
||||
puts $aFile "CONFIG += ${aName}"
|
||||
} else {
|
||||
#puts $aFile "CONFIG -= ${aName}"
|
||||
}
|
||||
}
|
||||
|
||||
puts $aFile ""
|
||||
puts $aFile "# Additional headers search paths"
|
||||
foreach anIncPath $::CSF_OPT_INC {
|
||||
puts $aFile "INCLUDEPATH += \"${anIncPath}\""
|
||||
}
|
||||
|
||||
puts $aFile ""
|
||||
puts $aFile "# Additional libraries search paths"
|
||||
foreach aLibPath [set ::CSF_OPT_LIB$::ARCH] {
|
||||
puts $aFile "LIBS += -L\"${aLibPath}\""
|
||||
}
|
||||
|
||||
if { "$::tcl_platform(platform)" == "windows" } {
|
||||
puts $aFile ""
|
||||
puts $aFile "# Additional DLLs search paths"
|
||||
foreach aDllPath [set ::CSF_OPT_BIN$::ARCH] {
|
||||
puts $aFile "LIBS += -L\"${aDllPath}\""
|
||||
}
|
||||
}
|
||||
|
||||
puts $aFile ""
|
||||
close $aFile
|
||||
puts "Configuration saved to file '$aCustomFilePath'"
|
||||
}
|
||||
}
|
||||
|
@@ -256,7 +256,7 @@ proc genAllResources {} {
|
||||
|
||||
# Wrapper-function to generate VS project files
|
||||
proc genproj {theFormat args} {
|
||||
set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "cbp" "xcd" "pro"}
|
||||
set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "cbp" "xcd"}
|
||||
set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" }
|
||||
set isHelpRequire false
|
||||
|
||||
@@ -314,7 +314,6 @@ proc genproj {theFormat args} {
|
||||
vc141 - Visual Studio 2017
|
||||
cbp - CodeBlocks
|
||||
xcd - XCode
|
||||
pro - Qt Creator
|
||||
|
||||
Platform (optional):
|
||||
wnt - Windows Desktop
|
||||
@@ -396,14 +395,9 @@ proc genprojbat {theFormat thePlatform} {
|
||||
"cbp" {
|
||||
file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.sh" "$::path/codeblocks.sh"
|
||||
file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.bat" "$::path/codeblocks.bat"
|
||||
|
||||
# Code::Blocks 16.01 does not create directory for import libs, help him
|
||||
set aPlatformAndCompiler "${thePlatform}/gcc"
|
||||
if { "$thePlatform" == "mac" || "$thePlatform" == "ios" } {
|
||||
set aPlatformAndCompiler "${thePlatform}/clang"
|
||||
}
|
||||
file mkdir "$::path/${aPlatformAndCompiler}/lib"
|
||||
file mkdir "$::path/${aPlatformAndCompiler}/libd"
|
||||
file mkdir "$::path/$thePlatform/cbp/lib"
|
||||
file mkdir "$::path/$thePlatform/cbp/libd"
|
||||
}
|
||||
"xcd" { file copy -force -- "$::THE_CASROOT/adm/templates/xcode.sh" "$::path/xcode.sh" }
|
||||
}
|
||||
@@ -478,6 +472,15 @@ proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl } {
|
||||
}
|
||||
}
|
||||
|
||||
# generate one solution for all projects if complete OS or VAS is processed
|
||||
set anAllSolution "OCCT"
|
||||
|
||||
wokUtils:FILES:mkdir $anOutDir
|
||||
if { ![file exists $anOutDir] } {
|
||||
puts stderr "Error: Could not create output directory \"$anOutDir\""
|
||||
return
|
||||
}
|
||||
|
||||
# create the out dir if it does not exist
|
||||
if (![file isdirectory $path/inc]) {
|
||||
puts "$path/inc folder does not exists and will be created"
|
||||
@@ -488,19 +491,6 @@ proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl } {
|
||||
puts "Collecting required header files into $path/inc ..."
|
||||
osutils:collectinc $aModules $path/inc
|
||||
|
||||
if { "$theFormat" == "pro" } {
|
||||
return
|
||||
}
|
||||
|
||||
# generate one solution for all projects if complete OS or VAS is processed
|
||||
set anAllSolution "OCCT"
|
||||
|
||||
wokUtils:FILES:mkdir $anOutDir
|
||||
if { ![file exists $anOutDir] } {
|
||||
puts stderr "Error: Could not create output directory \"$anOutDir\""
|
||||
return
|
||||
}
|
||||
|
||||
# Generating project files for the selected format
|
||||
switch -exact -- "$theFormat" {
|
||||
"vc7" -
|
||||
@@ -1359,7 +1349,6 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
|
||||
set aLibsMap(CSF_opengl32) "opengl32"
|
||||
set aLibsMap(CSF_wsock32) "wsock32"
|
||||
set aLibsMap(CSF_netapi32) "netapi32"
|
||||
set aLibsMap(CSF_winmm) "winmm"
|
||||
set aLibsMap(CSF_OpenGlLibs) "opengl32"
|
||||
if { "$::HAVE_GLES2" == "true" } {
|
||||
set aLibsMap(CSF_OpenGlLibs) "libEGL libGLESv2"
|
||||
@@ -2306,10 +2295,6 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
|
||||
set aCmplFlagsDebug [list]
|
||||
set toPassArgsByFile 0
|
||||
set aLibPrefix "lib"
|
||||
set aPlatformAndCompiler "${thePlatform}/gcc"
|
||||
if { "$thePlatform" == "mac" || "$thePlatform" == "ios" } {
|
||||
set aPlatformAndCompiler "${thePlatform}/clang"
|
||||
}
|
||||
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" || "$thePlatform" == "qnx" } {
|
||||
set toPassArgsByFile 1
|
||||
}
|
||||
@@ -2366,17 +2351,17 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
|
||||
# Release target configuration
|
||||
puts $aFile "\t\t\t<Target title=\"Release\">"
|
||||
if { "$theIsExe" == "true" } {
|
||||
puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/bin/${theProjName}\" prefix_auto=\"0\" extension_auto=\"0\" />"
|
||||
puts $aFile "\t\t\t\t<Option output=\"../../../${thePlatform}/cbp/bin/${theProjName}\" prefix_auto=\"0\" extension_auto=\"0\" />"
|
||||
puts $aFile "\t\t\t\t<Option type=\"1\" />"
|
||||
} else {
|
||||
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
|
||||
puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/bin/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${aPlatformAndCompiler}/lib/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
|
||||
puts $aFile "\t\t\t\t<Option output=\"../../../${thePlatform}/cbp/bin/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${thePlatform}/cbp/lib/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
|
||||
} else {
|
||||
puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/lib/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
|
||||
puts $aFile "\t\t\t\t<Option output=\"../../../${thePlatform}/cbp/lib/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
|
||||
}
|
||||
puts $aFile "\t\t\t\t<Option type=\"3\" />"
|
||||
}
|
||||
puts $aFile "\t\t\t\t<Option object_output=\"../../../${aPlatformAndCompiler}/obj\" />"
|
||||
puts $aFile "\t\t\t\t<Option object_output=\"../../../${thePlatform}/cbp/obj\" />"
|
||||
puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
|
||||
puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
|
||||
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
|
||||
@@ -2399,7 +2384,7 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
|
||||
if { $toPassArgsByFile == 1 } {
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"\@$aLnkFileName\" />"
|
||||
}
|
||||
puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aPlatformAndCompiler}/lib\" />"
|
||||
puts $aFile "\t\t\t\t\t<Add directory=\"../../../${thePlatform}/cbp/lib\" />"
|
||||
if { "$thePlatform" == "mac" } {
|
||||
if { [ lsearch $theLibsList X11 ] >= 0} {
|
||||
puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
|
||||
@@ -2407,7 +2392,7 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
|
||||
}
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch})\" />"
|
||||
if { "$thePlatform" == "lin" } {
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aPlatformAndCompiler}/lib\" />"
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${thePlatform}/cbp/lib\" />"
|
||||
}
|
||||
puts $aFile "\t\t\t\t</Linker>"
|
||||
|
||||
@@ -2416,17 +2401,17 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
|
||||
# Debug target configuration
|
||||
puts $aFile "\t\t\t<Target title=\"Debug\">"
|
||||
if { "$theIsExe" == "true" } {
|
||||
puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/bind/${theProjName}\" prefix_auto=\"0\" extension_auto=\"0\" />"
|
||||
puts $aFile "\t\t\t\t<Option output=\"../../../${thePlatform}/cbp/bind/${theProjName}\" prefix_auto=\"0\" extension_auto=\"0\" />"
|
||||
puts $aFile "\t\t\t\t<Option type=\"1\" />"
|
||||
} else {
|
||||
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
|
||||
puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/bind/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${aPlatformAndCompiler}/libd/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
|
||||
puts $aFile "\t\t\t\t<Option output=\"../../../${thePlatform}/cbp/bind/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${thePlatform}/cbp/libd/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
|
||||
} else {
|
||||
puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/libd/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
|
||||
puts $aFile "\t\t\t\t<Option output=\"../../../${thePlatform}/cbp/libd/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
|
||||
}
|
||||
puts $aFile "\t\t\t\t<Option type=\"3\" />"
|
||||
}
|
||||
puts $aFile "\t\t\t\t<Option object_output=\"../../../${aPlatformAndCompiler}/objd\" />"
|
||||
puts $aFile "\t\t\t\t<Option object_output=\"../../../${thePlatform}/cbp/objd\" />"
|
||||
puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
|
||||
puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
|
||||
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
|
||||
@@ -2449,7 +2434,7 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
|
||||
if { $toPassArgsByFile == 1 } {
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"\@$aLnkDebFileName\" />"
|
||||
}
|
||||
puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aPlatformAndCompiler}/libd\" />"
|
||||
puts $aFile "\t\t\t\t\t<Add directory=\"../../../${thePlatform}/cbp/libd\" />"
|
||||
if { "$thePlatform" == "mac" } {
|
||||
if { [ lsearch $theLibsList X11 ] >= 0} {
|
||||
puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
|
||||
@@ -2457,7 +2442,7 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
|
||||
}
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch}D)\" />"
|
||||
if { "$thePlatform" == "lin" } {
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aPlatformAndCompiler}/libd\" />"
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${thePlatform}/cbp/libd\" />"
|
||||
}
|
||||
puts $aFile "\t\t\t\t</Linker>"
|
||||
|
||||
@@ -2524,8 +2509,8 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
|
||||
puts $aFile "\t\t\t<Option link=\"0\" />"
|
||||
puts $aFile "\t\t</Unit>"
|
||||
|
||||
set aFileObj [string map {.cxx .o} [string map [list "/src/" "/${aPlatformAndCompiler}/obj/src/"] $aSrcFile]]
|
||||
set aFileObjd [string map {.cxx .o} [string map [list "/src/" "/${aPlatformAndCompiler}/objd/src/"] $aSrcFile]]
|
||||
set aFileObj [string map {.cxx .o} [string map [list "/src/" "/$thePlatform/cbp/obj/src/"] $aSrcFile]]
|
||||
set aFileObjd [string map {.cxx .o} [string map [list "/src/" "/$thePlatform/cbp/objd/src/"] $aSrcFile]]
|
||||
puts -nonewline $aFileLnkObj "$aFileObj "
|
||||
puts -nonewline $aFileLnkObjd "$aFileObjd "
|
||||
} else {
|
||||
|
5
adm/qmake/.gitignore
vendored
5
adm/qmake/.gitignore
vendored
@@ -1,5 +0,0 @@
|
||||
/*/*.pro
|
||||
/*/*/*.pro
|
||||
*.pro.user
|
||||
custom.pri
|
||||
custom.auto.pri
|
@@ -1,150 +0,0 @@
|
||||
# This is project defines C++ compilation rules for building an OCCT Toolkit.
|
||||
|
||||
exists(custom.auto.pri) { include(custom.auto.pri) }
|
||||
exists(custom.pri) { include(custom.pri) }
|
||||
|
||||
# Disable some dummy Qt defaults
|
||||
QT -= core gui
|
||||
CONFIG -= qt app_bundle
|
||||
CONFIG -= qml_debug
|
||||
CONFIG -= debug_and_release
|
||||
|
||||
OccGitRoot = $$_PRO_FILE_PWD_/../../../..
|
||||
|
||||
# Define compilation flags
|
||||
!win32 { DEFINES += OCC_CONVERT_SIGNALS }
|
||||
android {
|
||||
CONFIG += warn_off
|
||||
QMAKE_CFLAGS += -fexceptions -Wno-ignored-qualifiers -Wall
|
||||
QMAKE_CXXFLAGS += -fexceptions -Wno-ignored-qualifiers -Wall
|
||||
#android-g++ { QMAKE_CXXFLAGS += -Wno-strict-overflow }
|
||||
} else:win32 {
|
||||
QMAKE_CXXFLAGS_WARN_ON = -W4
|
||||
QMAKE_CXXFLAGS_EXCEPTIONS_ON = /EHa
|
||||
QMAKE_CXXFLAGS_STL_ON = /EHa
|
||||
|
||||
QMAKE_CXXFLAGS += -fp:precise
|
||||
#QMAKE_CXXFLAGS -= -Zc:throwingNew
|
||||
#QMAKE_CXXFLAGS -= -Zc:rvalueCast
|
||||
|
||||
QMAKE_LFLAGS += -INCREMENTAL:NO
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
QMAKE_CXXFLAGS += -Od
|
||||
QMAKE_CXXFLAGS += -Ob1
|
||||
}
|
||||
|
||||
DEFINES -= WIN32
|
||||
DEFINES -= WIN64
|
||||
DEFINES += _CRT_SECURE_NO_WARNINGS
|
||||
DEFINES += _CRT_NONSTDC_NO_DEPRECATE
|
||||
DEFINES += _SCL_SECURE_NO_WARNINGS
|
||||
} else:mac {
|
||||
CONFIG += c++11
|
||||
CONFIG += warn_off
|
||||
QMAKE_CXXFLAGS += -Wall
|
||||
QMAKE_CXXFLAGS += -fvisibility=default
|
||||
iphoneos {
|
||||
QMAKE_IOS_DEPLOYMENT_TARGET = 8.0
|
||||
} else {
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10
|
||||
}
|
||||
}
|
||||
|
||||
# Define output folder depending on compiler name
|
||||
MY_BITNESS = 32
|
||||
|
||||
equals(QMAKE_TARGET.arch, x86_64) | equals(QMAKE_HOST.arch, x86_64) { MY_BITNESS = 64 }
|
||||
equals(ANDROID_TARGET_ARCH, arm64-v8a) { MY_BITNESS = 64 }
|
||||
has64Target = $$find(QMAKE_TARGET.arch, "x64")
|
||||
count(has64Target, 1) { MY_BITNESS = 64 }
|
||||
|
||||
MY_PLATFORM = platform
|
||||
CONFIG(iphonesimulator, iphoneos|iphonesimulator) { MY_PLATFORM = iphonesimulator
|
||||
} else:CONFIG(iphoneos, iphoneos|iphonesimulator) { MY_PLATFORM = iphoneos
|
||||
} else:android { MY_PLATFORM = android-$$ANDROID_TARGET_ARCH
|
||||
} else:win32 { MY_PLATFORM = win$$MY_BITNESS
|
||||
} else:mac { MY_PLATFORM = mac
|
||||
} else:linux { MY_PLATFORM = lin
|
||||
} else:unix { MY_PLATFORM = unix
|
||||
} else { warning (Unknown platform. "$$MY_PLATFORM" is used) }
|
||||
|
||||
MY_COMPILER = compiler
|
||||
MY_VC_VER = 0
|
||||
android-g++ {
|
||||
MY_COMPILER = gcc
|
||||
} else:clang {
|
||||
MY_COMPILER = clang
|
||||
} else:gcc {
|
||||
MY_COMPILER = gcc
|
||||
} else:win32-msvc2010 {
|
||||
MY_COMPILER = vc10
|
||||
MY_VC_VER = 10
|
||||
} else:win32-msvc2012 {
|
||||
MY_COMPILER = vc11
|
||||
MY_VC_VER = 11
|
||||
} else:win32-msvc2013 {
|
||||
MY_COMPILER = vc12
|
||||
MY_VC_VER = 12
|
||||
} else:win32-msvc2015 {
|
||||
MY_COMPILER = vc14
|
||||
MY_VC_VER = 14
|
||||
} else:win32-msvc2017 {
|
||||
MY_COMPILER = vc14
|
||||
MY_VC_VER = 14
|
||||
} else:win32-msvc {
|
||||
MY_COMPILER = vc14
|
||||
MY_VC_VER = 14
|
||||
aMsvcVer = $$(VisualStudioVersion)
|
||||
equals(aMsvcVer, 14.0){
|
||||
# VS2015, vc140
|
||||
} else:equals(aMsvcVer, 15.0){
|
||||
# VS2015, vc141
|
||||
} else:equals(aMsvcVer, 16.0){
|
||||
# VS2019, vc142
|
||||
} else {
|
||||
warning (Unknown msvc version. "$$MY_COMPILER" is used)
|
||||
}
|
||||
} else {
|
||||
warning (Unknown compiler. "$$MY_COMPILER" is used)
|
||||
}
|
||||
MY_PLATFORM_AND_COMPILER = $$MY_PLATFORM/$$MY_COMPILER
|
||||
#warning (The platform is "$$MY_PLATFORM"; bitness is "$$MY_BITNESS"; compiler is "$$MY_COMPILER")
|
||||
|
||||
CONFIG(debug, debug|release) { MY_BUILDTYPE = d }
|
||||
|
||||
DESTDIR = $$OccGitRoot/$${MY_PLATFORM_AND_COMPILER}/lib$${MY_BUILDTYPE}
|
||||
win32 {
|
||||
DESTDIR = $$OccGitRoot/win$${MY_BITNESS}/vc$${MY_VC_VER}/bin$${MY_BUILDTYPE}
|
||||
aLibDest = $$DESTDIR/../lib$${MY_BUILDTYPE}
|
||||
#DLLDESTDIR = $$DESTDIR/../bin$${MY_BUILDTYPE}
|
||||
|
||||
# dummy target creating lib/libd folder
|
||||
occtkgen_libfolder.input = $$_PRO_FILE_PWD_/../../OcctDummy.in
|
||||
occtkgen_libfolder.output = $$aLibDest/dummy.tmp
|
||||
occtkgen_libfolder.config = verbatim
|
||||
QMAKE_SUBSTITUTES += occtkgen_libfolder
|
||||
|
||||
LIBS += -L$$aLibDest
|
||||
HAVE_RelWithDebInfo {
|
||||
!CONFIG(debug, debug|release) { CONFIG += force_debug_info }
|
||||
}
|
||||
equals(TEMPLATE, lib) {
|
||||
QMAKE_CLEAN += $$DESTDIR/$${TARGET}.dll
|
||||
QMAKE_CLEAN += $$aLibDest/$${TARGET}.lib
|
||||
QMAKE_CLEAN += $$aLibDest/$${TARGET}.exp
|
||||
} else {
|
||||
QMAKE_CLEAN += $$DESTDIR/$${TARGET}.exe
|
||||
}
|
||||
QMAKE_CLEAN += $$DESTDIR/$${TARGET}.pdb
|
||||
QMAKE_LFLAGS += -PDB:"$$DESTDIR/$${TARGET}.pdb"
|
||||
QMAKE_LFLAGS += -IMPLIB:"$$aLibDest/$${TARGET}.lib"
|
||||
} else {
|
||||
LIBS += -L$$DESTDIR
|
||||
equals(TEMPLATE, app) {
|
||||
DESTDIR = $$OccGitRoot/$${MY_PLATFORM_AND_COMPILER}/bin$${MY_BUILDTYPE}
|
||||
}
|
||||
}
|
||||
|
||||
#OBJECTS_DIR = $$DESTDIR/../obj$${MY_BUILDTYPE}/$${TARGET}
|
||||
OBJECTS_DIR = $$DESTDIR/../obj$${MY_BUILDTYPE}
|
@@ -1,36 +0,0 @@
|
||||
# This is a project template file defining an OCCT Module.
|
||||
# This project should be included with predefined OCC_MODULE_NAME variable.
|
||||
TEMPLATE = subdirs
|
||||
exists(custom.auto.pri) { include(custom.auto.pri) }
|
||||
exists(custom.pri) { include(custom.pri) }
|
||||
|
||||
# Iterate over Toolkits within current Module and generate sub-project per Toolkit
|
||||
aModuleList = $$cat(../MODULES, lines)
|
||||
for (aModuleIter, aModuleList) {
|
||||
#aTkList = $$list($$aModuleIter) - this doesn't work, qmake bug?
|
||||
aModule = $$first($$list($$aModuleIter))
|
||||
equals (aModule, $$OCC_MODULE_NAME) {
|
||||
for (aToolKit, $$list($$aModuleIter)) {
|
||||
toSkipToolkit = 0
|
||||
equals (aToolKit, $$OCC_MODULE_NAME) { toSkipToolkit = 1 }
|
||||
!HAVE_VTK:equals (aToolKit, "TKIVtk") { toSkipToolkit = 1 }
|
||||
!HAVE_VTK:equals (aToolKit, "TKIVtkDraw") { toSkipToolkit = 1 }
|
||||
!win32: equals (aToolKit, "TKD3DHost") { toSkipToolkit = 1 }
|
||||
equals (toSkipToolkit, 0) {
|
||||
#warning(aToolKit($$OCC_MODULE_NAME)=$$aToolKit)
|
||||
eval(occtkgen_$${aToolKit}.input = $$_PRO_FILE_PWD_/../OccToolkit.pro.in)
|
||||
eval(occtkgen_$${aToolKit}.output = $$_PRO_FILE_PWD_/$${aToolKit}/$${aToolKit}.pro)
|
||||
eval(occtkgen_$${aToolKit}.config = verbatim)
|
||||
eval(QMAKE_SUBSTITUTES += occtkgen_$${aToolKit})
|
||||
SUBDIRS += $${aToolKit}
|
||||
|
||||
aModExtList = $$cat(../../src/$${aToolKit}/EXTERNLIB, lines)
|
||||
aTkDepends = $${aToolKit}.depends
|
||||
for (aModExtIter, aModExtList) {
|
||||
contains ($$list($$aModuleIter), $$aModExtIter) { eval ($${aTkDepends} += $$aModExtIter) }
|
||||
}
|
||||
#warning($$aToolKit depends on: $$reverse($${aTkDepends}))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,2 +0,0 @@
|
||||
OCC_MODULE_NAME = \$\$TARGET
|
||||
include(../OccModule.pri)
|
@@ -1,137 +0,0 @@
|
||||
# This is a project template file defining an OCCT Toolkit.
|
||||
# This project should be included with predefined OCC_TOOLKIT_NAME variable.
|
||||
|
||||
TEMPLATE = lib
|
||||
!exists(../../src/$$OCC_TOOLKIT_NAME/PACKAGES) {
|
||||
TEMPLATE = app
|
||||
CONFIG += console
|
||||
}
|
||||
win32 {
|
||||
# do not append version to DLL name
|
||||
CONFIG += skip_target_version_ext
|
||||
}
|
||||
|
||||
include(OccCppConfig.pri)
|
||||
|
||||
aSrcRoot = $$OccGitRoot/src
|
||||
aHxxRoot = $$OccGitRoot/inc
|
||||
INCLUDEPATH += $$aHxxRoot
|
||||
|
||||
# CSF variables
|
||||
CSF_FREETYPE = -lfreetype
|
||||
CSF_TclLibs = -ltcl8.6
|
||||
CSF_TclTkLibs = -ltk8.6
|
||||
HAVE_FREEIMAGE { CSF_FreeImagePlus = -lfreeimage } else:win32 { CSF_FreeImagePlus = -lwindowscodecs -lole32 }
|
||||
HAVE_FFMPEG { CSF_FFmpeg = -lavcodec -lavformat -lswscale -lavutil }
|
||||
HAVE_TBB { CSF_TBB = -ltbb -ltbbmalloc }
|
||||
HAVE_ZLIB { CSF_ZLIB = -lzlib }
|
||||
HAVE_LIBLZMA { CSF_LIBLZMA = -lliblzma }
|
||||
win32 {
|
||||
CSF_kernel32 = -lkernel32
|
||||
CSF_advapi32 = -ladvapi32
|
||||
CSF_gdi32 = -lgdi32
|
||||
CSF_user32 = -luser32 -lcomdlg32
|
||||
CSF_shell32 = -lShell32
|
||||
CSF_opengl32 = -lopengl32
|
||||
CSF_wsock32 = -lwsock32
|
||||
CSF_netapi32 = -lnetapi32
|
||||
CSF_OpenGlLibs = -lopengl32
|
||||
HAVE_GLES2 { CSF_OpenGlLibs = -llibEGL -llibGLESv2 }
|
||||
CSF_psapi = -lPsapi
|
||||
CSF_d3d9 = -ld3d9
|
||||
CSF_TclLibs = -ltcl86
|
||||
CSF_TclTkLibs = -ltk86
|
||||
CSF_TBB =
|
||||
} else:mac {
|
||||
CSF_dl = -ldl
|
||||
CSF_objc = -lobjc
|
||||
CSF_Appkit = -framework AppKit
|
||||
CSF_IOKit = -framework IOKit
|
||||
CSF_OpenGlLibs = -framework OpenGL
|
||||
CSF_TclLibs = -framework Tcl
|
||||
CSF_TclTkLibs = -framework Tk
|
||||
} else {
|
||||
CSF_dl = -ldl
|
||||
CSF_ThreadLibs = -lpthread -lrt
|
||||
CSF_OpenGlLibs = -lGL
|
||||
CSF_TclTkLibs = -lX11 -ltk8.6
|
||||
CSF_XwLibs = -lX11 -lXext -lXmu -lXi
|
||||
CSF_MotifLibs = -lX11
|
||||
HAVE_GLES2 { CSF_OpenGlLibs = -lEGL -lGLESv2 }
|
||||
}
|
||||
|
||||
for (aCfgIter, CONFIG) {
|
||||
aRes = $$find(aCfgIter, "^HAVE_")
|
||||
count(aRes, 1) {
|
||||
DEFINES += $$aCfgIter
|
||||
}
|
||||
}
|
||||
|
||||
# Define the list of standard OCCT file extensions
|
||||
aHxxRegex = ^.*\.(hxx|h|lxx|gxx)$
|
||||
aPxxRegex = ^.*\.(pxx)$
|
||||
aCxxRegex = ^.*\.(cxx|c)$
|
||||
mac { aCxxRegex = ^.*\.(cxx|c|m|mm)$ }
|
||||
|
||||
# Auxiliary function for probing file extension
|
||||
defineTest (occCheckExtension) {
|
||||
aProbe = $$find(1, "$$2")
|
||||
count(aProbe, 1) { return(true) } else { return(false) }
|
||||
}
|
||||
|
||||
# Auxiliary function for probing compilable files
|
||||
defineTest (occIsCxxFile) { occCheckExtension ($$1, $$aCxxRegex) { return(true) } else { return(false) } }
|
||||
|
||||
# Auxiliary function for probing header files
|
||||
defineTest (occIsHxxFile) { occCheckExtension ($$1, $$aHxxRegex) { return(true) } else { return(false) } }
|
||||
|
||||
aTkFiles = $$cat($$aSrcRoot/$$OCC_TOOLKIT_NAME/FILES, lines)
|
||||
aTkFiles += CMakeLists.txt
|
||||
aPackages = $$cat($$aSrcRoot/$$OCC_TOOLKIT_NAME/PACKAGES, lines)
|
||||
anExternLibs = $$cat($$aSrcRoot/$$OCC_TOOLKIT_NAME/EXTERNLIB, lines)
|
||||
|
||||
for (aTkFileIter, aTkFiles) { OTHER_FILES += $$aSrcRoot/$$OCC_TOOLKIT_NAME/$$aTkFileIter }
|
||||
for (anExternLib, anExternLibs) {
|
||||
hasCsf = $$find(anExternLib, CSF_)
|
||||
count(hasCsf, 1) {
|
||||
aList = $$split($$anExternLib, "\n")
|
||||
LIBS += $$aList
|
||||
} else {
|
||||
LIBS += -l$$anExternLib
|
||||
}
|
||||
}
|
||||
|
||||
# Iterate over Packages and add compilable files into this project
|
||||
isEmpty (aPackages) { aPackages = $$OCC_TOOLKIT_NAME }
|
||||
for (aPackage, aPackages) {
|
||||
aPackageFolder = $$aSrcRoot/$$OCC_TOOLKIT_NAME/$$aPackage
|
||||
aPackageFiles = $$cat($$aSrcRoot/$$aPackage/FILES, lines)
|
||||
for (aFileIter, aPackageFiles) {
|
||||
occIsCxxFile($$aFileIter) {
|
||||
SOURCES += $$aSrcRoot/$$aPackage/$$aFileIter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# extend clean with versioned .so files
|
||||
!win32 {
|
||||
aVerList = $$split(VERSION, ".")
|
||||
aVerMaj = $$member(aVerList, 0)
|
||||
aVerMin = $$member(aVerList, 1)
|
||||
aVerMic = $$member(aVerList, 2)
|
||||
equals(TEMPLATE, app) {
|
||||
QMAKE_CLEAN += $$DESTDIR/$${TARGET}
|
||||
} else {
|
||||
mac {
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.dylib
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.dylib
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.dylib
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.$${aVerMic}.dylib
|
||||
} else {
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}.$${aVerMic}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,2 +0,0 @@
|
||||
OCC_TOOLKIT_NAME = \$\$TARGET
|
||||
include(../../OccToolkit.pri)
|
@@ -1,41 +0,0 @@
|
||||
# This is an experimental Solution project for building entire OCCT framework using qmake.
|
||||
# It can be also used for just source code navigation in Qt Creator without actually building OCCT.
|
||||
# Note, as this is an experimental project, compiler flags might differ from official builds - use it on your own risk!
|
||||
# Building OCCT using CMake is a preferred solution.
|
||||
#
|
||||
# This project GENERATES sub-projects (OCCT modules) dynamically, so to start using it:
|
||||
# - Launch genconf, select Project Format "Qt Project" and configure dependencies; this will also generate "custom.auto.pri".
|
||||
# - Launch genproj to fill in "inc" folder with links to header files.
|
||||
# - Open project in Qt Creator, and call "Run qmake".
|
||||
# - Close the project in Qt Creator, open it again so that you should see the sub-modules in Project tree; call "Run qmake" again.
|
||||
# - "Run qmake" and perform Build.
|
||||
TEMPLATE = subdirs
|
||||
exists(custom.auto.pri) { include(custom.auto.pri) }
|
||||
exists(custom.pri) { include(custom.pri) }
|
||||
|
||||
OTHER_FILES += OccModule.pro.in \
|
||||
OcctHeaderLink.hxx.in \
|
||||
OccToolkit.pro.in \
|
||||
OccCppConfig.pri \
|
||||
OccModule.pri \
|
||||
OccToolkit.pri \
|
||||
custom.pri.template
|
||||
|
||||
# Iterate over Modules and generate sub-projects
|
||||
aSolModuleList = $$cat(../MODULES, lines)
|
||||
for (aSolModuleIter, aSolModuleList) {
|
||||
aSolModule = $$first($$list($$aSolModuleIter))
|
||||
eval(occtkgen_$${aSolModule}.input = $$_PRO_FILE_PWD_/OccModule.pro.in)
|
||||
eval(occtkgen_$${aSolModule}.output = $$_PRO_FILE_PWD_/$${aSolModule}/$${aSolModule}.pro)
|
||||
eval(occtkgen_$${aSolModule}.config = verbatim)
|
||||
eval(QMAKE_SUBSTITUTES += occtkgen_$${aSolModule})
|
||||
SUBDIRS += $${aSolModule}
|
||||
}
|
||||
|
||||
# These dependencies are manually defined
|
||||
ModelingData.depends = FoundationClasses
|
||||
ModelingAlgorithms.depends = FoundationClasses ModelingData
|
||||
Visualization.depends = FoundationClasses ModelingData ModelingAlgorithms
|
||||
ApplicationFramework.depends = FoundationClasses ModelingData ModelingAlgorithms Visualization
|
||||
DataExchange.depends = FoundationClasses ModelingData ModelingAlgorithms ApplicationFramework
|
||||
Draw.depends = FoundationClasses ModelingData ModelingAlgorithms ApplicationFramework DataExchange Visualization
|
@@ -1 +0,0 @@
|
||||
#include \"../src/$${OCCT_PACKAGE}/$${OCCT_HEADER}\"
|
@@ -1,17 +0,0 @@
|
||||
PRODUCTS_PATH = c:/3rdparty/vc14
|
||||
|
||||
#CONFIG += HAVE_FREEIMAGE
|
||||
#CONFIG += HAVE_FFMPEG
|
||||
#CONFIG += HAVE_TBB
|
||||
#CONFIG += HAVE_GLES2
|
||||
#CONFIG += HAVE_D3D
|
||||
#CONFIG += HAVE_VTK
|
||||
|
||||
aFreeType = $$PRODUCTS_PATH/freetype-2.5.5-vc14-64
|
||||
aTclTk = $$PRODUCTS_PATH/tcltk-86-64
|
||||
|
||||
INCLUDEPATH += $$aFreeType/include
|
||||
LIBS += -L$$aFreeType/lib
|
||||
|
||||
INCLUDEPATH += $$aTclTk/include
|
||||
LIBS += -L$$aTclTk/lib
|
@@ -29,7 +29,6 @@ set "CSF_OPT_LIB32="
|
||||
set "CSF_OPT_LIB64="
|
||||
set "CSF_OPT_BIN32="
|
||||
set "CSF_OPT_BIN64="
|
||||
set "CSF_DEFINES=%CSF_DEFINES_EXTRA%"
|
||||
|
||||
if not ["%CASROOT%"] == [""] if exist "%SCRIPTROOT%\%CASROOT%" set "CASROOT=%SCRIPTROOT%\%CASROOT%"
|
||||
if ["%CASROOT%"] == [""] set "CASROOT=%SCRIPTROOT%"
|
||||
|
@@ -6,7 +6,7 @@ aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath
|
||||
# Reset values
|
||||
export CASROOT="__CASROOT__"
|
||||
export CASDEB=""
|
||||
export PRJFMT="";
|
||||
export TARGET="";
|
||||
export HAVE_TBB="false";
|
||||
export HAVE_OPENCL="false";
|
||||
export HAVE_FREEIMAGE="false";
|
||||
@@ -40,9 +40,9 @@ do
|
||||
elif [ "$i" == "i" ] || [ "$i" == "relwithdeb" ]; then
|
||||
export CASDEB="i"
|
||||
elif [ "$i" == "cbp" ]; then
|
||||
export PRJFMT="cbp";
|
||||
export TARGET="cbp";
|
||||
elif [ "$i" == "xcd" ] || [ "$i" == "xcode" ]; then
|
||||
export PRJFMT="xcd";
|
||||
export TARGET="xcd";
|
||||
fi
|
||||
done
|
||||
shopt -u nocasematch
|
||||
@@ -64,32 +64,28 @@ else
|
||||
fi
|
||||
|
||||
export CASBIN=""
|
||||
if [ "${PRJFMT}" == "xcd" ]; then
|
||||
if [ "${TARGET}" == "cbp" ]; then
|
||||
export CASBIN="${WOKSTATION}/cbp"
|
||||
elif [ "${TARGET}" == "xcd" ]; then
|
||||
export CASBIN="adm/mac/xcd/build"
|
||||
else
|
||||
if [ "$aSystem" == "Darwin" ]; then
|
||||
export CASBIN="${WOKSTATION}/clang"
|
||||
else
|
||||
export CASBIN="${WOKSTATION}/gcc"
|
||||
fi
|
||||
fi
|
||||
|
||||
export CSF_OPT_INC="${CSF_OPT_INC}:${CASROOT}/inc"
|
||||
|
||||
if [ "${PRJFMT}" == "xcd" ]; then
|
||||
export CSF_OPT_LIB32D="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/Debug"
|
||||
export CSF_OPT_LIB64D="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/Debug"
|
||||
export CSF_OPT_LIB32="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/Release"
|
||||
export CSF_OPT_LIB64="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/Release"
|
||||
export CSF_OPT_LIB32I="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/RelWithDebInfo"
|
||||
export CSF_OPT_LIB64I="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/RelWithDebInfo"
|
||||
else
|
||||
if [ "${TARGET}" == "cbp" ]; then
|
||||
export CSF_OPT_LIB32D="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/libd"
|
||||
export CSF_OPT_LIB64D="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/libd"
|
||||
export CSF_OPT_LIB32="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/lib"
|
||||
export CSF_OPT_LIB64="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/lib"
|
||||
export CSF_OPT_LIB32I="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/libi"
|
||||
export CSF_OPT_LIB64I="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/libi"
|
||||
elif [ "${TARGET}" == "xcd" ]; then
|
||||
export CSF_OPT_LIB32D="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/Debug"
|
||||
export CSF_OPT_LIB64D="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/Debug"
|
||||
export CSF_OPT_LIB32="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/Release"
|
||||
export CSF_OPT_LIB64="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/Release"
|
||||
export CSF_OPT_LIB32I="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/RelWithDebInfo"
|
||||
export CSF_OPT_LIB64I="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/RelWithDebInfo"
|
||||
fi
|
||||
|
||||
export CSF_OPT_CMPL=""
|
||||
@@ -178,7 +174,7 @@ export CSF_OCCTSamplesPath="${CSF_OCCTSamplesPath:-$CASROOT/samples}"
|
||||
export CSF_OCCTDataPath="${CSF_OCCTDataPath:-$CASROOT/data}"
|
||||
export CSF_OCCTTestsPath="${CSF_OCCTTestsPath:-$CASROOT/tests}"
|
||||
|
||||
if [ "${PRJFMT}" == "xcd" ]; then
|
||||
if [ "${TARGET}" == "xcd" ]; then
|
||||
if [ "${CASDEB}" == "d" ]; then
|
||||
export CSF_OCCTBinPath="${CSF_OCCTBinPath:-$CASROOT/$CASBIN/Debug}"
|
||||
else
|
||||
|
@@ -1679,67 +1679,9 @@ Some public methods of the class BRepFilletAPI_MakeChamfer are released from exc
|
||||
- method Add for symmetric chamfer now takes only 2 arguments: distance and edge;
|
||||
- method GetDistAngle now takes only 3 arguments: index of contour, distance and angle.
|
||||
|
||||
@subsection upgrade_740_aspects Aspects unification
|
||||
|
||||
Fill Area, Line and Marker aspects (classes *Graphic3d_AspectFillArea3d*, *Graphic3d_AspectLine3d*, *Graphic3d_AspectMarker3d* and *Graphic3d_AspectText3d*)
|
||||
have been merged into new class *Graphic3d_Aspects* providing a single state for rendering primitives of any type.
|
||||
The old per-primitive type aspect classes have been preserved as sub-classes of *Graphic3d_Aspects* with default values close to the previous behavior.
|
||||
All aspects except Graphic3d_AspectFillArea3d define Graphic3d_TOSM_UNLIT shading model.
|
||||
|
||||
The previous approach with dedicated aspects per primitive type was handy in simplified case, but lead to confusion otherwise.
|
||||
In fact, drawing points or lines with lighting applied is a valid use case, but only *Graphic3d_AspectFillArea3d* previously defined necessary material properties.
|
||||
|
||||
As aspects for different primitive types have been merged, Graphic3d_Group does no more provide per-type aspect properties.
|
||||
Existing code relying on old behavior and putting interleaved per-type aspects into single Graphic3d_Group should be updated.
|
||||
For example, the following pseudo-code will not work anymore, because all *SetGroupPrimitivesAspect* calls will setup the same property:
|
||||
~~~~
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< overrides previous aspect
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments (2);
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles (3);
|
||||
aGroup->AddPrimitiveArray (aLines); //!< both arrays will use the same aspect
|
||||
aGroup->AddPrimitiveArray (aTris);
|
||||
~~~~
|
||||
|
||||
To solve the problem, the code should be modified to either put primitives into dedicated groups (preferred approach), or using *SetPrimitivesAspect* in proper order:
|
||||
~~~~
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles (3);
|
||||
aGroup->AddPrimitiveArray (aTris);
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments (2);
|
||||
aGroup->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< next array will use the new aspect
|
||||
aGroup->AddPrimitiveArray (aLines);
|
||||
~~~~
|
||||
|
||||
@subsection upgrade_740_prsupdate Presentation invalidation
|
||||
|
||||
Historically AIS_InteractiveObject provided two independent mechanisms invalidating presentation (asking presentation manager to recompute specific display mode or all modes):
|
||||
|
||||
1. *AIS_InteractiveObject::SetToUpdate()*, marking existing presentation for update.
|
||||
This is main invalidation API, which is expected to be followed by *AIS_InteractiveContext::Update()* call.
|
||||
2. *AIS_InteractiveObject::myToRecomputeModes* + *myRecomputeEveryPrs*.
|
||||
This is auxiliary invalidation API, used internally by AIS_InteractiveContext::SetColor()/UnsetColor() and similar modification methods.
|
||||
|
||||
The latter one has been removed to avoid confusion and unexpected behavior.
|
||||
In addition, two methods *AIS_InteractiveObject::Update()* have been deprecated in favor of new *AIS_InteractiveObject::UpdatePresentations()* recomputing only invalidated presentations.
|
||||
|
||||
Custom presentations implementing interface methods *AIS_InteractiveObject::SetColor()* and others should be revised to use *AIS_InteractiveObject::SetToUpdate()*
|
||||
or updating presentation without recomputation (see *AIS_InteractiveObject::SynchronizeAspects()* and *AIS_InteractiveObject::replaceAspects()*).
|
||||
|
||||
@subsection upgrade_740_interiorstyles Interior styles
|
||||
|
||||
* *Aspect_IS_HOLLOW* is now an alias to *Aspect_IS_EMPTY* and does not implicitly enables drawing mesh edges anymore.
|
||||
Specify Graphic3d_AspectFillArea3d::SetDrawEdges(true) with Graphic3d_AspectFillArea3d::SetInteriorStyle(Aspect_IS_EMPTY) to get previous behavior of Aspect_IS_HOLLOW style.
|
||||
* *Aspect_IS_HIDDENLINE* does not implicitly enables drawing mesh edges anymore.
|
||||
Specify Graphic3d_AspectFillArea3d::SetDrawEdges(true) with Graphic3d_AspectFillArea3d::SetInteriorStyle(Aspect_IS_HIDDENLINE) to get previous behavior of Aspect_IS_HIDDENLINE style.
|
||||
|
||||
@subsection upgrade_740_geproj Custom defines within env.bat
|
||||
|
||||
*env.bat* produced by Visual Studio project generator *genproj.bat* has been modified so that *%CSF_DEFINES%* variable is reset to initial state.
|
||||
Custom building environment relying on old behavior and setting extra macros within *%CSF_DEFINES%* before env.bat should be updated
|
||||
to either modify custom.bat or setup new variable *%CSF_DEFINES_EXTRA%* instead.
|
||||
|
@@ -23,7 +23,7 @@ WARNINGS = NO
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = YES
|
||||
EXPAND_ONLY_PREDEF = YES
|
||||
PREDEFINED = Standard_EXPORT Standard_NODISCARD Standard_OVERRIDE:=override __Standard_API __Draw_API Handle(a):=Handle<a> DEFINE_STANDARD_ALLOC DEFINE_NCOLLECTION_ALLOC "Standard_DEPRECATED=//! @deprecated "
|
||||
PREDEFINED = Standard_EXPORT Standard_NODISCARD Standard_OVERRIDE:=override __Standard_API __Draw_API Handle(a):=Handle<a> DEFINE_STANDARD_ALLOC DEFINE_NCOLLECTION_ALLOC
|
||||
GENERATE_HTML = YES
|
||||
GENERATE_LATEX = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
|
10
genproj
10
genproj
@@ -19,6 +19,10 @@ 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"
|
||||
@@ -33,12 +37,6 @@ source "${aScriptPath}/custom.sh"
|
||||
|
||||
if [ -e "${aScriptPath}/env.sh" ]; then source "${aScriptPath}/env.sh"; fi
|
||||
|
||||
if [ "$aTarget" == "" ]; then aTarget=$PRJFMT; fi;
|
||||
if [ "$aTarget" == "" ]; then
|
||||
aTarget="cbp"
|
||||
if [ "$aSystem" == "Darwin" ]; then aTarget="xcd"; fi;
|
||||
fi
|
||||
|
||||
cd $aScriptPath
|
||||
tclsh "./adm/start.tcl" genproj ${aTarget} $anOpt2 $anOpt3 $anOpt4 $anOpt5
|
||||
|
||||
|
@@ -49,10 +49,6 @@ if "%aPlatform%" == "" (
|
||||
)
|
||||
)
|
||||
|
||||
set aPrjFmt=%PRJFMT%
|
||||
if "%aPrjFmt%" == "" ( set "aPrjFmt=vcxproj" )
|
||||
if "%aPrjFmt%" == "vcxproj" ( set "aPrjFmt=%VCFMT%" )
|
||||
|
||||
cd %~dp0
|
||||
%TCL_EXEC% %~dp0adm/start.tcl genproj %aPrjFmt% %aPlatform% %3 %4 %5
|
||||
%TCL_EXEC% %~dp0adm/start.tcl genproj %VCFMT% %aPlatform% %3 %4 %5
|
||||
SET "PATH=%OLD_PATH%"
|
||||
|
@@ -17,8 +17,7 @@ void ISession2D_Shape::Add(const TopoDS_Shape& aShape)
|
||||
myListOfShape.Append(aShape);
|
||||
myAlgo.Nullify();
|
||||
myPolyAlgo.Nullify();
|
||||
SetToUpdate();
|
||||
UpdatePresentations();
|
||||
Update(); // protected method used to specify that the presentation are not up to date
|
||||
}
|
||||
|
||||
void ISession2D_Shape::Remove (const TopoDS_Shape& theShape)
|
||||
@@ -43,17 +42,23 @@ void ISession2D_Shape::SetProjector (HLRAlgo_Projector& aProjector)
|
||||
myProjector= aProjector;
|
||||
myAlgo.Nullify();
|
||||
myPolyAlgo.Nullify();
|
||||
SetToUpdate();
|
||||
UpdatePresentations();
|
||||
Update(); // protected method used to specify that the presentation are not up to date
|
||||
};
|
||||
|
||||
|
||||
void ISession2D_Shape::SetNbIsos(Standard_Integer& aNbIsos)
|
||||
{
|
||||
myNbIsos= aNbIsos;
|
||||
myAlgo.Nullify();
|
||||
SetToUpdate();
|
||||
UpdatePresentations();
|
||||
{
|
||||
myNbIsos= aNbIsos;
|
||||
myAlgo.Nullify();
|
||||
|
||||
// declare the mode 100 to 110 as non valid
|
||||
for (int i=100;i<=110;i++)
|
||||
Update(i,Standard_False); // protected method used to specify that the presentation are not up to date
|
||||
|
||||
// declare the mode 1100 to 1110 as non valid
|
||||
for (int i=1100;i<=1110;i++)
|
||||
Update(i,Standard_False); // protected method used to specify that the presentation are not up to date
|
||||
|
||||
};
|
||||
|
||||
void ISession2D_Shape::BuildAlgo()
|
||||
|
@@ -51,7 +51,7 @@ proc drawObjects {theRow theColor} {
|
||||
uplevel #0 box $aBox $aCtr $aCtr $aCtr $aSize $aSize $aSize
|
||||
uplevel #0 ttranslate $aSph $x $y 0
|
||||
uplevel #0 ttranslate $aBox [expr $x + 10] $y 0
|
||||
uplevel #0 vdisplay -noredraw -dispMode 1 $aSph $aBox
|
||||
uplevel #0 vdisplay -noredraw $aSph $aBox
|
||||
uplevel #0 vsetmaterial -noredraw $aSph $aBox $aMatIter
|
||||
if {$theColor != ""} {
|
||||
uplevel #0 vsetcolor -noredraw $aSph $aBox $theColor
|
||||
@@ -64,19 +64,21 @@ proc drawObjects {theRow theColor} {
|
||||
# setup 3D viewer content
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
vclear
|
||||
vclose ALL
|
||||
catch { vclose View1 }
|
||||
vinit View1 w=768 h=768
|
||||
vclear
|
||||
vtop
|
||||
vglinfo
|
||||
vsetgradientbg 180 200 255 180 180 180 2
|
||||
|
||||
vlight -change 0 -dir 0.577 -0.577 -0.577
|
||||
vsetdispmode 1
|
||||
vrenderparams -msaa 8
|
||||
|
||||
# adjust scene bounding box
|
||||
box bnd 0 0 0 180 210 1
|
||||
vdisplay -noredraw -dispMode 0 bnd
|
||||
vdisplay -noredraw bnd
|
||||
vsetdispmode bnd 0
|
||||
vfit
|
||||
vremove -noredraw bnd
|
||||
|
||||
@@ -86,3 +88,5 @@ drawObjects 0 ""
|
||||
drawObjects 1 red
|
||||
drawObjects 2 green
|
||||
drawObjects 3 blue1
|
||||
#vfit
|
||||
vzfit
|
||||
|
@@ -168,7 +168,7 @@ void AIS_Animation::StartTimer (const Standard_Real theStartPts,
|
||||
{
|
||||
if (myTimer.IsNull())
|
||||
{
|
||||
myTimer = new Media_Timer();
|
||||
myTimer = new AIS_AnimationTimer();
|
||||
}
|
||||
myTimer->Stop();
|
||||
myTimer->Seek (theStartPts);
|
||||
|
@@ -191,7 +191,7 @@ protected:
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Media_Timer) myTimer;
|
||||
Handle(AIS_AnimationTimer) myTimer;
|
||||
|
||||
TCollection_AsciiString myName; //!< animation name
|
||||
NCollection_Sequence<Handle(AIS_Animation)>
|
||||
|
@@ -12,15 +12,15 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Media_Timer.hxx>
|
||||
#include <AIS_AnimationTimer.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Media_Timer, Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_AnimationTimer, Standard_Transient)
|
||||
|
||||
//=============================================================================
|
||||
//function : Pause
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void Media_Timer::Pause()
|
||||
void AIS_AnimationTimer::Pause()
|
||||
{
|
||||
myTimer.Stop();
|
||||
myTimerFrom += myTimer.ElapsedTime() * myTimerSpeed;
|
||||
@@ -31,7 +31,7 @@ void Media_Timer::Pause()
|
||||
//function : Stop
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void Media_Timer::Stop()
|
||||
void AIS_AnimationTimer::Stop()
|
||||
{
|
||||
myTimer.Stop();
|
||||
myTimer.Reset();
|
||||
@@ -42,7 +42,7 @@ void Media_Timer::Stop()
|
||||
//function : SetPlaybackSpeed
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void Media_Timer::SetPlaybackSpeed (const Standard_Real theSpeed)
|
||||
void AIS_AnimationTimer::SetPlaybackSpeed (const Standard_Real theSpeed)
|
||||
{
|
||||
if (!myTimer.IsStarted())
|
||||
{
|
||||
@@ -61,7 +61,7 @@ void Media_Timer::SetPlaybackSpeed (const Standard_Real theSpeed)
|
||||
//function : SetPlaybackSpeed
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void Media_Timer::Seek (const Standard_Real theTime)
|
||||
void AIS_AnimationTimer::Seek (const Standard_Real theTime)
|
||||
{
|
||||
const Standard_Boolean isStarted = myTimer.IsStarted();
|
||||
myTimer.Stop();
|
@@ -15,7 +15,60 @@
|
||||
#ifndef _AIS_AnimationTimer_HeaderFile
|
||||
#define _AIS_AnimationTimer_HeaderFile
|
||||
|
||||
#include <Media_Timer.hxx>
|
||||
typedef Media_Timer AIS_AnimationTimer;
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
//! Auxiliary class defining the animation timer.
|
||||
class AIS_AnimationTimer : public Standard_Transient
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_AnimationTimer, Standard_Transient)
|
||||
public:
|
||||
|
||||
//! Empty constructor.
|
||||
AIS_AnimationTimer() : myTimerFrom (0.0), myTimerSpeed (1.0) {}
|
||||
|
||||
//! Return elapsed time in seconds.
|
||||
Standard_Real ElapsedTime() const
|
||||
{
|
||||
return myTimerFrom + myTimer.ElapsedTime() * myTimerSpeed;
|
||||
}
|
||||
|
||||
//! Return playback speed coefficient (1.0 means normal speed).
|
||||
Standard_Real PlaybackSpeed() const { return myTimerSpeed; }
|
||||
|
||||
//! Setup playback speed coefficient.
|
||||
Standard_EXPORT void SetPlaybackSpeed (const Standard_Real theSpeed);
|
||||
|
||||
//! Return true if timer has been started.
|
||||
Standard_Boolean IsStarted() const
|
||||
{
|
||||
return myTimer.IsStarted();
|
||||
}
|
||||
|
||||
//! Start the timer.
|
||||
void Start()
|
||||
{
|
||||
myTimer.Start();
|
||||
}
|
||||
|
||||
//! Pause the timer.
|
||||
Standard_EXPORT void Pause();
|
||||
|
||||
//! Stop the timer.
|
||||
Standard_EXPORT void Stop();
|
||||
|
||||
//! Seek the timer to specified position.
|
||||
Standard_EXPORT void Seek (const Standard_Real theTime);
|
||||
|
||||
protected:
|
||||
|
||||
OSD_Timer myTimer;
|
||||
Standard_Real myTimerFrom;
|
||||
Standard_Real myTimerSpeed;
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_AnimationTimer, Standard_Transient)
|
||||
|
||||
#endif // _AIS_AnimationTimer_HeaderFile
|
||||
|
@@ -81,7 +81,7 @@ myIsXYZAxis(Standard_True)
|
||||
Standard_Real aLength;
|
||||
try {
|
||||
aLength = UnitsAPI::AnyToLS(100. ,"mm");
|
||||
} catch (Standard_Failure const&) {
|
||||
} catch (Standard_Failure) {
|
||||
aLength = 0.1;
|
||||
}
|
||||
DA->SetAxisLength(aLength,aLength,aLength);
|
||||
@@ -221,7 +221,7 @@ void AIS_Axis::SetColor(const Quantity_Color &aCol)
|
||||
DA->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol);
|
||||
DA->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol);
|
||||
DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(aCol);
|
||||
SynchronizeAspects();
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -230,6 +230,7 @@ void AIS_Axis::SetColor(const Quantity_Color &aCol)
|
||||
//=======================================================================
|
||||
void AIS_Axis::SetWidth(const Standard_Real aValue)
|
||||
{
|
||||
|
||||
if(aValue<0.0) return;
|
||||
if(aValue==0) UnsetWidth();
|
||||
|
||||
@@ -239,7 +240,6 @@ void AIS_Axis::SetWidth(const Standard_Real aValue)
|
||||
DA->LineAspect(Prs3d_DP_XAxis)->SetWidth(aValue);
|
||||
DA->LineAspect(Prs3d_DP_YAxis)->SetWidth(aValue);
|
||||
DA->LineAspect(Prs3d_DP_ZAxis)->SetWidth(aValue);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
|
||||
@@ -324,13 +324,14 @@ AcceptDisplayMode(const Standard_Integer aMode) const
|
||||
//=======================================================================
|
||||
void AIS_Axis::UnsetColor()
|
||||
{
|
||||
|
||||
myDrawer->LineAspect()->SetColor(Quantity_NOC_RED);
|
||||
hasOwnColor = Standard_False;
|
||||
|
||||
hasOwnColor=Standard_False;
|
||||
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(Quantity_NOC_TURQUOISE);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(Quantity_NOC_TURQUOISE);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetColor(Quantity_NOC_TURQUOISE);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : UnsetWidth
|
||||
@@ -339,10 +340,10 @@ void AIS_Axis::UnsetColor()
|
||||
|
||||
void AIS_Axis::UnsetWidth()
|
||||
{
|
||||
myOwnWidth = 0.0f;
|
||||
myOwnWidth = 0.0;
|
||||
myDrawer->LineAspect()->SetWidth(1.);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetWidth(1.);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetWidth(1.);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetWidth(1.);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
|
@@ -90,7 +90,6 @@ void AIS_CameraFrustum::SetColor (const Quantity_Color& theColor)
|
||||
AIS_InteractiveObject::SetColor (theColor);
|
||||
myDrawer->ShadingAspect()->SetColor (theColor);
|
||||
myDrawer->LineAspect()->SetColor (theColor);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -108,7 +107,6 @@ void AIS_CameraFrustum::UnsetColor()
|
||||
|
||||
myDrawer->ShadingAspect()->SetColor (THE_DEFAULT_COLOR);
|
||||
myDrawer->LineAspect()->SetColor (THE_DEFAULT_COLOR);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -119,7 +117,6 @@ void AIS_CameraFrustum::UnsetTransparency()
|
||||
{
|
||||
myDrawer->ShadingAspect()->SetTransparency (0.0f);
|
||||
myDrawer->SetTransparency (0.0f);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -239,18 +236,17 @@ void AIS_CameraFrustum::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
switch (theMode)
|
||||
{
|
||||
case AIS_Shaded:
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (myTriangles);
|
||||
}
|
||||
Standard_FALLTHROUGH
|
||||
case AIS_WireFrame:
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (myBorders);
|
||||
break;
|
||||
|
@@ -112,29 +112,6 @@ void AIS_Circle::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : replaceWithNewLineAspect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Circle::replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
|
||||
{
|
||||
if (!myDrawer->HasLink())
|
||||
{
|
||||
myDrawer->SetLineAspect (theAspect);
|
||||
return;
|
||||
}
|
||||
|
||||
const Handle(Graphic3d_AspectLine3d) anAspectOld = myDrawer->LineAspect()->Aspect();
|
||||
const Handle(Graphic3d_AspectLine3d) anAspectNew = !theAspect.IsNull() ? theAspect->Aspect() : myDrawer->Link()->LineAspect()->Aspect();
|
||||
if (anAspectNew != anAspectOld)
|
||||
{
|
||||
myDrawer->SetLineAspect (theAspect);
|
||||
Graphic3d_MapOfAspectsToAspects aReplaceMap;
|
||||
aReplaceMap.Bind (anAspectOld, anAspectNew);
|
||||
replaceAspects (aReplaceMap);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetColor
|
||||
//purpose :
|
||||
@@ -145,41 +122,34 @@ void AIS_Circle::SetColor(const Quantity_Color &aCol)
|
||||
hasOwnColor=Standard_True;
|
||||
myDrawer->SetColor (aCol);
|
||||
|
||||
if (!myDrawer->HasOwnLineAspect())
|
||||
{
|
||||
Standard_Real WW = HasWidth() ? myOwnWidth :
|
||||
myDrawer->HasLink() ?
|
||||
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) :
|
||||
1.;
|
||||
replaceWithNewLineAspect (new Prs3d_LineAspect (aCol, Aspect_TOL_SOLID, WW));
|
||||
}
|
||||
Standard_Real WW = HasWidth() ? myOwnWidth :
|
||||
myDrawer->HasLink() ?
|
||||
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) :
|
||||
1.;
|
||||
|
||||
if (!myDrawer->HasOwnLineAspect ())
|
||||
myDrawer->SetLineAspect (new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
|
||||
else
|
||||
{
|
||||
myDrawer->LineAspect()->SetColor(aCol);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetWidth
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Circle::SetWidth(const Standard_Real aValue)
|
||||
{
|
||||
myOwnWidth = (Standard_ShortReal )aValue;
|
||||
myOwnWidth=aValue;
|
||||
|
||||
if (!myDrawer->HasOwnLineAspect())
|
||||
{
|
||||
if (!myDrawer->HasOwnLineAspect ()) {
|
||||
Quantity_Color CC = Quantity_NOC_YELLOW;
|
||||
if( HasColor() ) CC = myDrawer->Color();
|
||||
else if(myDrawer->HasLink()) AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, CC);
|
||||
replaceWithNewLineAspect (new Prs3d_LineAspect (CC, Aspect_TOL_SOLID, aValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
myDrawer->SetLineAspect (new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,aValue));
|
||||
} else
|
||||
myDrawer->LineAspect()->SetWidth(aValue);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -191,18 +161,15 @@ void AIS_Circle::UnsetColor()
|
||||
{
|
||||
hasOwnColor = Standard_False;
|
||||
|
||||
if (!HasWidth())
|
||||
{
|
||||
replaceWithNewLineAspect (Handle(Prs3d_LineAspect)());
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(Prs3d_LineAspect) NullAsp;
|
||||
|
||||
if (!HasWidth()) myDrawer->SetLineAspect(NullAsp);
|
||||
else{
|
||||
Quantity_Color CC = Quantity_NOC_YELLOW;;
|
||||
if( HasColor() ) CC = myDrawer->Color();
|
||||
else if (myDrawer->HasLink()) AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
|
||||
myDrawer->LineAspect()->SetColor(CC);
|
||||
myDrawer->SetColor (CC);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,13 +179,11 @@ void AIS_Circle::UnsetColor()
|
||||
//=======================================================================
|
||||
void AIS_Circle::UnsetWidth()
|
||||
{
|
||||
if (!HasColor())
|
||||
{
|
||||
replaceWithNewLineAspect (Handle(Prs3d_LineAspect)());
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_ShortReal WW = myDrawer->HasLink() ? (Standard_ShortReal )AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line) : 1.0f;
|
||||
Handle(Prs3d_LineAspect) NullAsp;
|
||||
|
||||
if (!HasColor()) myDrawer->SetLineAspect(NullAsp);
|
||||
else{
|
||||
Standard_Real WW = myDrawer->HasLink() ? AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line) : 1.;
|
||||
myDrawer->LineAspect()->SetWidth(WW);
|
||||
myOwnWidth = WW;
|
||||
}
|
||||
|
@@ -115,9 +115,6 @@ private:
|
||||
|
||||
Standard_EXPORT void ComputeArcSelection (const Handle(SelectMgr_Selection)& aSelection);
|
||||
|
||||
//! Replace aspects of already computed groups with the new value.
|
||||
void replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
|
||||
|
||||
private:
|
||||
|
||||
Handle(Geom_Circle) myComponent;
|
||||
|
@@ -124,7 +124,8 @@ Handle(AIS_ColoredDrawer) AIS_ColoredShape::CustomAspects (const TopoDS_Shape& t
|
||||
{
|
||||
aDrawer = new AIS_ColoredDrawer (myDrawer);
|
||||
myShapeColors.Bind (theShape, aDrawer);
|
||||
SetToUpdate();
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
}
|
||||
return aDrawer;
|
||||
}
|
||||
@@ -140,7 +141,8 @@ void AIS_ColoredShape::ClearCustomAspects()
|
||||
return;
|
||||
}
|
||||
myShapeColors.Clear();
|
||||
SetToUpdate();
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -155,7 +157,8 @@ void AIS_ColoredShape::UnsetCustomAspects (const TopoDS_Shape& theShape,
|
||||
return;
|
||||
}
|
||||
|
||||
SetToUpdate();
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
if (theToUnregister)
|
||||
{
|
||||
myShapeColors.UnBind (theShape);
|
||||
@@ -180,6 +183,8 @@ void AIS_ColoredShape::SetCustomColor (const TopoDS_Shape& theShape,
|
||||
const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
|
||||
setColor (aDrawer, theColor);
|
||||
aDrawer->SetOwnColor (theColor);
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -197,6 +202,8 @@ void AIS_ColoredShape::SetCustomTransparency (const TopoDS_Shape& theShape,
|
||||
const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
|
||||
setTransparency (aDrawer, theTransparency);
|
||||
aDrawer->SetOwnTransparency (theTransparency);
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -214,6 +221,8 @@ void AIS_ColoredShape::SetCustomWidth (const TopoDS_Shape& theShape,
|
||||
const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
|
||||
setWidth (aDrawer, theLineWidth);
|
||||
aDrawer->SetOwnWidth (theLineWidth);
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -223,6 +232,11 @@ void AIS_ColoredShape::SetCustomWidth (const TopoDS_Shape& theShape,
|
||||
|
||||
void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
|
||||
{
|
||||
setColor (myDrawer, theColor);
|
||||
myDrawer->SetColor (theColor);
|
||||
hasOwnColor = Standard_True;
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
|
||||
@@ -248,7 +262,6 @@ void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
|
||||
aDrawer->FaceBoundaryAspect()->SetColor (theColor);
|
||||
}
|
||||
}
|
||||
AIS_Shape::SetColor (theColor);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -258,6 +271,10 @@ void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
|
||||
|
||||
void AIS_ColoredShape::SetWidth (const Standard_Real theLineWidth)
|
||||
{
|
||||
setWidth (myDrawer, theLineWidth);
|
||||
myOwnWidth = theLineWidth;
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
|
||||
@@ -279,16 +296,6 @@ void AIS_ColoredShape::SetWidth (const Standard_Real theLineWidth)
|
||||
aDrawer->FaceBoundaryAspect()->SetWidth (theLineWidth);
|
||||
}
|
||||
}
|
||||
AIS_Shape::SetWidth (theLineWidth);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UnsetWidth
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ColoredShape::UnsetWidth()
|
||||
{
|
||||
SetWidth (1.0f);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -298,6 +305,10 @@ void AIS_ColoredShape::UnsetWidth()
|
||||
|
||||
void AIS_ColoredShape::SetTransparency (const Standard_Real theValue)
|
||||
{
|
||||
setTransparency (myDrawer, theValue);
|
||||
myDrawer->SetTransparency ((Standard_ShortReal )theValue);
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
|
||||
@@ -311,7 +322,6 @@ void AIS_ColoredShape::SetTransparency (const Standard_Real theValue)
|
||||
aDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
|
||||
}
|
||||
}
|
||||
AIS_Shape::SetTransparency (theValue);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -320,7 +330,27 @@ void AIS_ColoredShape::SetTransparency (const Standard_Real theValue)
|
||||
//=======================================================================
|
||||
void AIS_ColoredShape::UnsetTransparency()
|
||||
{
|
||||
SetTransparency (0.0f);
|
||||
myDrawer->SetTransparency (0.0f);
|
||||
if (myDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
|
||||
if (!HasColor()
|
||||
&& !HasMaterial()
|
||||
&& !myDrawer->ShadingAspect()->Aspect()->ToMapTexture())
|
||||
{
|
||||
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
|
||||
}
|
||||
}
|
||||
|
||||
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(Prs3d_Drawer)& aDrawer = anIter.Value();
|
||||
if (aDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
aDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
|
||||
}
|
||||
}
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -330,6 +360,10 @@ void AIS_ColoredShape::UnsetTransparency()
|
||||
|
||||
void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
|
||||
{
|
||||
setMaterial (myDrawer, theMaterial, HasColor(), IsTransparent());
|
||||
//myOwnMaterial = theMaterial;
|
||||
hasOwnMaterial = Standard_True;
|
||||
LoadRecomputable (AIS_Shaded);
|
||||
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
|
||||
@@ -339,7 +373,6 @@ void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
|
||||
setMaterial (aDrawer, theMaterial, aDrawer->HasOwnColor(), aDrawer->HasOwnTransparency());
|
||||
}
|
||||
}
|
||||
AIS_Shape::SetMaterial (theMaterial);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -81,16 +81,11 @@ public: //! @name global aspects
|
||||
//! Sets transparency value.
|
||||
Standard_EXPORT virtual void SetTransparency (const Standard_Real theValue) Standard_OVERRIDE;
|
||||
|
||||
//! Sets the material aspect.
|
||||
Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& theAspect) Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
//! Removes the setting for transparency in the reconstructed compound shape.
|
||||
Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE;
|
||||
|
||||
//! Setup line width of entire shape.
|
||||
Standard_EXPORT virtual void UnsetWidth() Standard_OVERRIDE;
|
||||
//! Sets the material aspect.
|
||||
Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& theAspect) Standard_OVERRIDE;
|
||||
|
||||
protected: //! @name override presentation computation
|
||||
|
||||
|
@@ -352,7 +352,7 @@ TCollection_ExtendedString AIS_Dimension::GetValueString (Standard_Real& theWidt
|
||||
Handle(Font_FTFont) aFont = new Font_FTFont();
|
||||
aFont->Init (aTextAspect->Aspect()->Font().ToCString(),
|
||||
aTextAspect->Aspect()->GetTextFontAspect(),
|
||||
(unsigned int )aTextAspect->Height(),
|
||||
(const unsigned int)aTextAspect->Height(),
|
||||
THE_2D_TEXT_RESOLUTION);
|
||||
|
||||
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
|
||||
@@ -431,7 +431,6 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const TCollection_ExtendedString& theText,
|
||||
const Standard_Integer theLabelPosition)
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
if (myDrawer->DimensionAspect()->IsText3d())
|
||||
{
|
||||
// getting font parameters
|
||||
@@ -518,7 +517,7 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
aCenterOfLabel.Transform (aTextPlaneTrsf);
|
||||
|
||||
gp_Ax2 aFlippingAxes (aCenterOfLabel, GetPlane().Axis().Direction(), aTextDir);
|
||||
aGroup->SetFlippingOptions (Standard_True, aFlippingAxes);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetFlippingOptions (Standard_True, aFlippingAxes);
|
||||
|
||||
// draw text
|
||||
if (myDrawer->DimensionAspect()->IsTextShaded())
|
||||
@@ -547,14 +546,11 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
{
|
||||
myDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (aColor, Aspect_TOL_SOLID, 1.0));
|
||||
}
|
||||
|
||||
myDrawer->FreeBoundaryAspect()->Aspect()->SetColor (aColor);
|
||||
|
||||
// drawing text
|
||||
if (Handle(Graphic3d_ArrayOfPrimitives) anEdges = StdPrs_WFShape::AddAllEdges (aTextShape, myDrawer))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->FreeBoundaryAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (anEdges);
|
||||
}
|
||||
StdPrs_WFShape::Add (thePresentation, aTextShape, myDrawer);
|
||||
}
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetFlippingOptions (Standard_False, gp_Ax2());
|
||||
|
||||
@@ -569,7 +565,7 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
// generate primitives for 2D text
|
||||
myDrawer->DimensionAspect()->TextAspect()->Aspect()->SetDisplayType (Aspect_TODT_DIMENSION);
|
||||
|
||||
Prs3d_Text::Draw (aGroup,
|
||||
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (thePresentation),
|
||||
myDrawer->DimensionAspect()->TextAspect(),
|
||||
theText,
|
||||
theTextPos);
|
||||
@@ -603,7 +599,6 @@ void AIS_Dimension::DrawExtension (const Handle(Prs3d_Presentation)& thePresenta
|
||||
gp_Pnt aTextPos = ElCLib::Value (theExtensionSize, anExtensionLine);
|
||||
gp_Dir aTextDir = theExtensionDir;
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
drawText (thePresentation,
|
||||
aTextPos,
|
||||
aTextDir,
|
||||
@@ -635,17 +630,16 @@ void AIS_Dimension::DrawExtension (const Handle(Prs3d_Presentation)& thePresenta
|
||||
aSensitiveCurve.Append (anExtStart);
|
||||
aSensitiveCurve.Append (anExtEnd);
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
if (!myDrawer->DimensionAspect()->IsText3d() && theMode == ComputeMode_All)
|
||||
{
|
||||
aGroup->SetStencilTestOptions (Standard_True);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetStencilTestOptions (Standard_True);
|
||||
}
|
||||
Handle(Graphic3d_AspectLine3d) aDimensionLineStyle = myDrawer->DimensionAspect()->LineAspect()->Aspect();
|
||||
aGroup->SetPrimitivesAspect (aDimensionLineStyle);
|
||||
aGroup->AddPrimitiveArray (anExtPrimitive);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionLineStyle);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (anExtPrimitive);
|
||||
if (!myDrawer->DimensionAspect()->IsText3d() && theMode == ComputeMode_All)
|
||||
{
|
||||
aGroup->SetStencilTestOptions (Standard_False);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetStencilTestOptions (Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -739,6 +733,8 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
case LabelPosition_HCenter:
|
||||
{
|
||||
// add label on dimension or extension line to presentation
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
gp_Pnt aTextPos = IsTextPositionCustom() ? myFixedTextPosition
|
||||
: (aCenterLineBegin.XYZ() + aCenterLineEnd.XYZ()) * 0.5;
|
||||
gp_Dir aTextDir = aDimensionLine.Direction();
|
||||
@@ -746,7 +742,6 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
// add text primitives
|
||||
if (theMode == ComputeMode_All || theMode == ComputeMode_Text)
|
||||
{
|
||||
thePresentation->NewGroup();
|
||||
drawText (thePresentation,
|
||||
aTextPos,
|
||||
aTextDir,
|
||||
@@ -804,28 +799,24 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
aDimensionAspect->TextAspect()->SetVerticalJustification (aTextJustificaton);
|
||||
|
||||
// main dimension line, short extension
|
||||
if (!aDimensionAspect->IsText3d() && theMode == ComputeMode_All)
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
if (!aDimensionAspect->IsText3d() && theMode == ComputeMode_All)
|
||||
{
|
||||
aGroup->SetStencilTestOptions (Standard_True);
|
||||
}
|
||||
aGroup->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (aPrimSegments);
|
||||
if (!aDimensionAspect->IsText3d() && theMode == ComputeMode_All)
|
||||
{
|
||||
aGroup->SetStencilTestOptions (Standard_False);
|
||||
}
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetStencilTestOptions (Standard_True);
|
||||
}
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
||||
if (!aDimensionAspect->IsText3d() && theMode == ComputeMode_All)
|
||||
{
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetStencilTestOptions (Standard_False);
|
||||
}
|
||||
|
||||
// add arrows to presentation
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
|
||||
}
|
||||
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
|
||||
}
|
||||
|
||||
if (!isArrowsExternal)
|
||||
@@ -834,18 +825,19 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
}
|
||||
|
||||
// add arrow extension lines to presentation
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
|
||||
aFirstArrowEnd, aFirstExtensionDir,
|
||||
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
|
||||
aFirstArrowEnd, aFirstExtensionDir,
|
||||
aSecondArrowEnd, aSecondExtensionDir,
|
||||
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
|
||||
aSecondArrowEnd, aSecondExtensionDir,
|
||||
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// ------------------------------------------------------------------------ //
|
||||
@@ -855,48 +847,45 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
case LabelPosition_Left:
|
||||
{
|
||||
// add label on dimension or extension line to presentation
|
||||
{
|
||||
// Left extension with the text
|
||||
DrawExtension (thePresentation, anExtensionSize,
|
||||
isArrowsExternal
|
||||
? aFirstArrowEnd
|
||||
: aFirstArrowBegin,
|
||||
aFirstExtensionDir,
|
||||
aLabelString,
|
||||
aLabelWidth,
|
||||
theMode,
|
||||
aLabelPosition);
|
||||
}
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
// Left extension with the text
|
||||
DrawExtension (thePresentation, anExtensionSize,
|
||||
isArrowsExternal
|
||||
? aFirstArrowEnd
|
||||
: aFirstArrowBegin,
|
||||
aFirstExtensionDir,
|
||||
aLabelString,
|
||||
aLabelWidth,
|
||||
theMode,
|
||||
aLabelPosition);
|
||||
|
||||
// add dimension line primitives
|
||||
if (theMode == ComputeMode_All || theMode == ComputeMode_Line)
|
||||
{
|
||||
// add central dimension line
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
// add graphical primitives
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments (2);
|
||||
aPrimSegments->AddVertex (aCenterLineBegin);
|
||||
aPrimSegments->AddVertex (aCenterLineEnd);
|
||||
// add graphical primitives
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments (2);
|
||||
aPrimSegments->AddVertex (aCenterLineBegin);
|
||||
aPrimSegments->AddVertex (aCenterLineEnd);
|
||||
|
||||
aGroup->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (aPrimSegments);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
||||
|
||||
// add selection primitives
|
||||
SelectionGeometry::Curve& aSensitiveCurve = mySelectionGeom.NewCurve();
|
||||
aSensitiveCurve.Append (aCenterLineBegin);
|
||||
aSensitiveCurve.Append (aCenterLineEnd);
|
||||
}
|
||||
// add selection primitives
|
||||
SelectionGeometry::Curve& aSensitiveCurve = mySelectionGeom.NewCurve();
|
||||
aSensitiveCurve.Append (aCenterLineBegin);
|
||||
aSensitiveCurve.Append (aCenterLineEnd);
|
||||
|
||||
// add arrows to presentation
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
|
||||
}
|
||||
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
|
||||
}
|
||||
|
||||
if (!isArrowsExternal || theIsOneSide)
|
||||
@@ -905,11 +894,11 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
}
|
||||
|
||||
// add extension lines for external arrows
|
||||
{
|
||||
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
|
||||
aSecondArrowEnd, aSecondExtensionDir,
|
||||
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
|
||||
}
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
|
||||
aSecondArrowEnd, aSecondExtensionDir,
|
||||
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -921,6 +910,7 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
case LabelPosition_Right:
|
||||
{
|
||||
// add label on dimension or extension line to presentation
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
// Right extension with text
|
||||
DrawExtension (thePresentation, anExtensionSize,
|
||||
@@ -935,30 +925,27 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
if (theMode == ComputeMode_All || theMode == ComputeMode_Line)
|
||||
{
|
||||
// add central dimension line
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
// add graphical primitives
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments (2);
|
||||
aPrimSegments->AddVertex (aCenterLineBegin);
|
||||
aPrimSegments->AddVertex (aCenterLineEnd);
|
||||
aGroup->SetGroupPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (aPrimSegments);
|
||||
// add graphical primitives
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments (2);
|
||||
aPrimSegments->AddVertex (aCenterLineBegin);
|
||||
aPrimSegments->AddVertex (aCenterLineEnd);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
||||
|
||||
// add selection primitives
|
||||
SelectionGeometry::Curve& aSensitiveCurve = mySelectionGeom.NewCurve();
|
||||
aSensitiveCurve.Append (aCenterLineBegin);
|
||||
aSensitiveCurve.Append (aCenterLineEnd);
|
||||
}
|
||||
// add selection primitives
|
||||
SelectionGeometry::Curve& aSensitiveCurve = mySelectionGeom.NewCurve();
|
||||
aSensitiveCurve.Append (aCenterLineBegin);
|
||||
aSensitiveCurve.Append (aCenterLineEnd);
|
||||
|
||||
// add arrows to presentation
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
thePresentation->NewGroup();
|
||||
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
|
||||
if (!theIsOneSide)
|
||||
{
|
||||
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
|
||||
}
|
||||
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
|
||||
}
|
||||
|
||||
if (!isArrowsExternal || theIsOneSide)
|
||||
@@ -967,11 +954,11 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
}
|
||||
|
||||
// add extension lines for external arrows
|
||||
{
|
||||
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
|
||||
aFirstArrowEnd, aFirstExtensionDir,
|
||||
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
|
||||
}
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
|
||||
aFirstArrowEnd, aFirstExtensionDir,
|
||||
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -981,7 +968,7 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
// add flyout lines to presentation
|
||||
if (theMode == ComputeMode_All)
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments(4);
|
||||
aPrimSegments->AddVertex (theFirstPoint);
|
||||
@@ -990,8 +977,8 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
aPrimSegments->AddVertex (theSecondPoint);
|
||||
aPrimSegments->AddVertex (aLineEndPoint);
|
||||
|
||||
aGroup->SetGroupPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (aPrimSegments);
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
||||
}
|
||||
|
||||
mySelectionGeom.IsComputed = Standard_True;
|
||||
|
@@ -952,8 +952,7 @@ void AIS_InteractiveContext::RecomputePrsOnly (const Handle(AIS_InteractiveObjec
|
||||
return;
|
||||
}
|
||||
|
||||
theIObj->SetToUpdate();
|
||||
theIObj->UpdatePresentations (theAllModes);
|
||||
theIObj->Update (theAllModes);
|
||||
if (!theToUpdateViewer)
|
||||
{
|
||||
return;
|
||||
@@ -1007,7 +1006,13 @@ void AIS_InteractiveContext::Update (const Handle(AIS_InteractiveObject)& theIOb
|
||||
return;
|
||||
}
|
||||
|
||||
theIObj->UpdatePresentations();
|
||||
TColStd_ListOfInteger aPrsModes;
|
||||
theIObj->ToBeUpdated (aPrsModes);
|
||||
for (TColStd_ListIteratorOfListOfInteger aPrsModesIt (aPrsModes); aPrsModesIt.More(); aPrsModesIt.Next())
|
||||
{
|
||||
theIObj->Update (aPrsModesIt.Value(), Standard_False);
|
||||
}
|
||||
|
||||
mgrSelector->Update(theIObj);
|
||||
|
||||
if (theUpdateViewer)
|
||||
@@ -1364,6 +1369,63 @@ void AIS_InteractiveContext::SetCurrentFacingModel (const Handle(AIS_Interactive
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : redisplayPrsRecModes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const Standard_Boolean theToUpdateViewer)
|
||||
{
|
||||
if (theIObj->RecomputeEveryPrs())
|
||||
{
|
||||
theIObj->Update (Standard_True);
|
||||
theIObj->UpdateSelection();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (TColStd_ListIteratorOfListOfInteger aModes (theIObj->ListOfRecomputeModes()); aModes.More(); aModes.Next())
|
||||
{
|
||||
theIObj->Update (aModes.Value(), Standard_False);
|
||||
}
|
||||
theIObj->UpdateSelection();
|
||||
theIObj->SetRecomputeOk();
|
||||
}
|
||||
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : redisplayPrsModes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const Standard_Boolean theToUpdateViewer)
|
||||
{
|
||||
if (theIObj->RecomputeEveryPrs())
|
||||
{
|
||||
theIObj->Update (Standard_True);
|
||||
theIObj->UpdateSelection();
|
||||
}
|
||||
else
|
||||
{
|
||||
TColStd_ListOfInteger aModes;
|
||||
theIObj->ToBeUpdated (aModes);
|
||||
for (TColStd_ListIteratorOfListOfInteger aModeIter (aModes); aModeIter.More(); aModeIter.Next())
|
||||
{
|
||||
theIObj->Update (aModeIter.Value(), Standard_False);
|
||||
}
|
||||
theIObj->SetRecomputeOk();
|
||||
}
|
||||
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetColor
|
||||
//purpose :
|
||||
@@ -1379,11 +1441,7 @@ void AIS_InteractiveContext::SetColor (const Handle(AIS_InteractiveObject)& theI
|
||||
|
||||
setContextToObject (theIObj);
|
||||
theIObj->SetColor (theColor);
|
||||
theIObj->UpdatePresentations();
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1428,11 +1486,7 @@ void AIS_InteractiveContext::SetDeviationCoefficient (const Handle(AIS_Interacti
|
||||
|
||||
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
|
||||
aShape->SetOwnDeviationCoefficient (theCoefficient);
|
||||
aShape->UpdatePresentations();
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
redisplayPrsModes (theIObj, theToUpdateViewer);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1462,11 +1516,7 @@ void AIS_InteractiveContext::SetHLRDeviationCoefficient (const Handle(AIS_Intera
|
||||
|
||||
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
|
||||
aShape->SetOwnHLRDeviationCoefficient (theCoefficient);
|
||||
aShape->UpdatePresentations();
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
redisplayPrsModes (theIObj, theToUpdateViewer);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1495,11 +1545,7 @@ void AIS_InteractiveContext::SetDeviationAngle (const Handle(AIS_InteractiveObje
|
||||
|
||||
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
|
||||
aShape->SetOwnDeviationAngle (theAngle);
|
||||
aShape->UpdatePresentations();
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
redisplayPrsModes (theIObj, theToUpdateViewer);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1528,10 +1574,15 @@ void AIS_InteractiveContext::SetAngleAndDeviation (const Handle(AIS_InteractiveO
|
||||
|
||||
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
|
||||
aShape->SetAngleAndDeviation (theAngle);
|
||||
aShape->UpdatePresentations();
|
||||
if (theToUpdateViewer)
|
||||
|
||||
if (theIObj->RecomputeEveryPrs())
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
theIObj->Update (Standard_True);
|
||||
theIObj->UpdateSelection();
|
||||
}
|
||||
else
|
||||
{
|
||||
Update (theIObj, theToUpdateViewer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1560,11 +1611,7 @@ void AIS_InteractiveContext::SetHLRAngleAndDeviation (const Handle(AIS_Interacti
|
||||
}
|
||||
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
|
||||
aShape->SetHLRAngleAndDeviation (theAngle);
|
||||
aShape->UpdatePresentations();
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
redisplayPrsModes (theIObj, theToUpdateViewer);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1592,11 +1639,7 @@ void AIS_InteractiveContext::SetHLRDeviationAngle (const Handle(AIS_InteractiveO
|
||||
}
|
||||
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
|
||||
aShape->SetOwnHLRDeviationAngle (theAngle);
|
||||
aShape->UpdatePresentations();
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
redisplayPrsModes (theIObj, theToUpdateViewer);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1612,11 +1655,7 @@ void AIS_InteractiveContext::UnsetColor (const Handle(AIS_InteractiveObject)& th
|
||||
}
|
||||
|
||||
theIObj->UnsetColor();
|
||||
theIObj->UpdatePresentations();
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1662,7 +1701,7 @@ void AIS_InteractiveContext::SetWidth (const Handle(AIS_InteractiveObject)& theI
|
||||
|
||||
setContextToObject (theIObj);
|
||||
theIObj->SetWidth (theWidth);
|
||||
theIObj->UpdatePresentations();
|
||||
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
||||
if (!myLastinMain.IsNull() && myLastinMain->IsSameSelectable (theIObj))
|
||||
{
|
||||
if (myLastinMain->IsAutoHilight())
|
||||
@@ -1679,10 +1718,6 @@ void AIS_InteractiveContext::SetWidth (const Handle(AIS_InteractiveObject)& theI
|
||||
myLastinMain);
|
||||
}
|
||||
}
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1698,11 +1733,7 @@ void AIS_InteractiveContext::UnsetWidth (const Handle(AIS_InteractiveObject)& th
|
||||
}
|
||||
|
||||
theIObj->UnsetWidth();
|
||||
theIObj->UpdatePresentations();
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1720,11 +1751,7 @@ void AIS_InteractiveContext::SetMaterial (const Handle(AIS_InteractiveObject)& t
|
||||
|
||||
setContextToObject (theIObj);
|
||||
theIObj->SetMaterial (theMaterial);
|
||||
theIObj->UpdatePresentations();
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1739,11 +1766,7 @@ void AIS_InteractiveContext::UnsetMaterial (const Handle(AIS_InteractiveObject)&
|
||||
return;
|
||||
}
|
||||
theIObj->UnsetMaterial();
|
||||
theIObj->UpdatePresentations();
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1773,11 +1796,7 @@ void AIS_InteractiveContext::SetTransparency (const Handle(AIS_InteractiveObject
|
||||
}
|
||||
|
||||
theIObj->SetTransparency (theValue);
|
||||
theIObj->UpdatePresentations();
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1793,11 +1812,7 @@ void AIS_InteractiveContext::UnsetTransparency (const Handle(AIS_InteractiveObje
|
||||
}
|
||||
|
||||
theIObj->UnsetTransparency();
|
||||
theIObj->UpdatePresentations();
|
||||
if (theToUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -198,21 +198,6 @@ public: //! @name highlighting management
|
||||
const Handle(Prs3d_Drawer)& HighlightStyle (const Prs3d_TypeOfHighlight theStyleType) const { return myStyles[theStyleType]; }
|
||||
|
||||
//! Setup highlight style settings.
|
||||
//! It is preferred modifying existing style returned by method HighlightStyle()
|
||||
//! instead of creating a new drawer.
|
||||
//!
|
||||
//! If a new highlight style is created, its presentation Zlayer should be checked,
|
||||
//! otherwise highlighting might not work as expected.
|
||||
//! Default values are:
|
||||
//! - Prs3d_TypeOfHighlight_Dynamic: Graphic3d_ZLayerId_Top,
|
||||
//! object highlighting is drawn on top of main scene within Immediate Layers,
|
||||
//! so that V3d_View::RedrawImmediate() will be enough to see update;
|
||||
//! - Prs3d_TypeOfHighlight_LocalDynamic: Graphic3d_ZLayerId_Topmost,
|
||||
//! object parts highlighting is drawn on top of main scene within Immediate Layers
|
||||
//! with depth cleared (even overlapped geometry will be revealed);
|
||||
//! - Prs3d_TypeOfHighlight_Selected: Graphic3d_ZLayerId_UNKNOWN,
|
||||
//! object highlighting is drawn on top of main scene within the same layer
|
||||
//! as object itself (e.g. Graphic3d_ZLayerId_Default by default) and increased priority.
|
||||
void SetHighlightStyle (const Prs3d_TypeOfHighlight theStyleType,
|
||||
const Handle(Prs3d_Drawer)& theStyle) { myStyles[theStyleType] = theStyle; }
|
||||
|
||||
@@ -227,14 +212,6 @@ public: //! @name highlighting management
|
||||
}
|
||||
|
||||
//! Setup the style of dynamic highlighting.
|
||||
//! It is preferred modifying existing style returned by method HighlightStyle()
|
||||
//! instead of creating a new drawer.
|
||||
//!
|
||||
//! If a new highlight style is created, its presentation Zlayer should be checked,
|
||||
//! otherwise highlighting might not work as expected.
|
||||
//! Default value is Graphic3d_ZLayerId_Top,
|
||||
//! object highlighting is drawn on top of main scene within Immediate Layers,
|
||||
//! so that V3d_View::RedrawImmediate() will be enough to see update;
|
||||
void SetHighlightStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Dynamic] = theStyle; }
|
||||
|
||||
//! Returns current selection style settings.
|
||||
@@ -1082,7 +1059,6 @@ public: //! @name iso-line display attributes
|
||||
//! Returns true if drawing isolines on triangulation algorithm is enabled.
|
||||
Standard_EXPORT Standard_Boolean IsoOnTriangulation() const;
|
||||
|
||||
//! @name obsolete methods
|
||||
public:
|
||||
|
||||
//! Updates the view of the current object in open context.
|
||||
@@ -1208,6 +1184,14 @@ protected: //! @name internal methods
|
||||
Standard_EXPORT void InitAttributes();
|
||||
|
||||
Standard_EXPORT Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr);
|
||||
|
||||
//! UNKNOWN
|
||||
Standard_EXPORT void redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const Standard_Boolean theToUpdateViewer);
|
||||
|
||||
//! UNKNOWN
|
||||
Standard_EXPORT void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const Standard_Boolean theToUpdateViewer);
|
||||
|
||||
//! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
|
||||
Standard_EXPORT void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
|
||||
@@ -1278,10 +1262,6 @@ protected: //! @name internal methods
|
||||
return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalDynamic : Prs3d_TypeOfHighlight_Dynamic];
|
||||
}
|
||||
|
||||
//! Return TRUE if highlight style of owner requires full viewer redraw.
|
||||
Standard_EXPORT Standard_Boolean isSlowHiStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(V3d_Viewer)& theViewer) const;
|
||||
|
||||
//! Helper function that returns correct selection style for the object:
|
||||
//! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
|
||||
//! selection style of interactive context will be returned.
|
||||
|
@@ -293,22 +293,6 @@ void AIS_InteractiveContext::highlightWithSubintensity (const Handle(SelectMgr_E
|
||||
theOwner->HilightWithColor (myMainPM, myStyles[Prs3d_TypeOfHighlight_SubIntensity], theMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : isSlowHiStyle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_InteractiveContext::isSlowHiStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(V3d_Viewer)& theViewer) const
|
||||
{
|
||||
if (const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()))
|
||||
{
|
||||
const Handle(Prs3d_Drawer)& aHiStyle = getHiStyle (anObj, myLastPicked);
|
||||
return aHiStyle->ZLayer() == Graphic3d_ZLayerId_UNKNOWN
|
||||
|| !theViewer->ZLayerSettings (aHiStyle->ZLayer()).IsImmediate();
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MoveTo
|
||||
//purpose :
|
||||
@@ -388,11 +372,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
// method call. As result it is necessary to rehighligt it with mySelectionColor.
|
||||
if (!myLastPicked.IsNull() && myLastPicked->HasSelectable())
|
||||
{
|
||||
if (isSlowHiStyle (myLastPicked, theView->Viewer()))
|
||||
{
|
||||
theView->Viewer()->Invalidate();
|
||||
}
|
||||
|
||||
clearDynamicHighlight();
|
||||
toUpdateViewer = Standard_True;
|
||||
}
|
||||
@@ -408,11 +387,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
&& (!myLastPicked->IsSelected()
|
||||
|| myToHilightSelected))
|
||||
{
|
||||
if (isSlowHiStyle (myLastPicked, theView->Viewer()))
|
||||
{
|
||||
theView->Viewer()->Invalidate();
|
||||
}
|
||||
|
||||
highlightWithColor (myLastPicked, theView->Viewer());
|
||||
toUpdateViewer = Standard_True;
|
||||
}
|
||||
@@ -431,11 +405,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
&& !myLastPicked.IsNull()
|
||||
&& myLastPicked->HasSelectable())
|
||||
{
|
||||
if (isSlowHiStyle (myLastPicked, theView->Viewer()))
|
||||
{
|
||||
theView->Viewer()->Invalidate();
|
||||
}
|
||||
|
||||
clearDynamicHighlight();
|
||||
toUpdateViewer = Standard_True;
|
||||
}
|
||||
@@ -453,14 +422,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
}
|
||||
else
|
||||
{
|
||||
if (theView->IsInvalidated())
|
||||
{
|
||||
theView->Viewer()->Redraw();
|
||||
}
|
||||
else
|
||||
{
|
||||
theView->Viewer()->RedrawImmediate();
|
||||
}
|
||||
theView->Viewer()->RedrawImmediate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -52,11 +52,12 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_InteractiveObject,SelectMgr_SelectableObject)
|
||||
AIS_InteractiveObject::AIS_InteractiveObject (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
|
||||
: SelectMgr_SelectableObject (aTypeOfPresentation3d),
|
||||
myCTXPtr (NULL),
|
||||
myOwnWidth (0.0f),
|
||||
myOwnWidth (0.0),
|
||||
myCurrentFacingModel (Aspect_TOFM_BOTH_SIDE),
|
||||
myInfiniteState (Standard_False),
|
||||
hasOwnColor (Standard_False),
|
||||
hasOwnMaterial (Standard_False)
|
||||
hasOwnMaterial (Standard_False),
|
||||
myRecomputeEveryPrs (Standard_True)
|
||||
{
|
||||
SetCurrentFacingModel();
|
||||
}
|
||||
@@ -89,6 +90,14 @@ AIS_KindOfInteractive AIS_InteractiveObject::Type() const
|
||||
Standard_Integer AIS_InteractiveObject::Signature() const
|
||||
{return -1;}
|
||||
|
||||
//=======================================================================
|
||||
//function : RecomputeEveryPrs
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean AIS_InteractiveObject::RecomputeEveryPrs() const
|
||||
{return myRecomputeEveryPrs;}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
@@ -191,7 +200,7 @@ void AIS_InteractiveObject::UnsetColor()
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetWidth(const Standard_Real aValue)
|
||||
{
|
||||
myOwnWidth = (Standard_ShortReal )aValue;
|
||||
myOwnWidth = aValue;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -200,7 +209,7 @@ void AIS_InteractiveObject::SetWidth(const Standard_Real aValue)
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::UnsetWidth()
|
||||
{
|
||||
myOwnWidth = 0.0f;
|
||||
myOwnWidth = 0.;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -324,10 +333,32 @@ void AIS_InteractiveObject::UnsetAttributes()
|
||||
|
||||
hasOwnColor = Standard_False;
|
||||
hasOwnMaterial = Standard_False;
|
||||
myOwnWidth = 0.0f;
|
||||
myOwnWidth = 0.0;
|
||||
myDrawer->SetTransparency (0.0f);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::MustRecomputePrs(const Standard_Integer ) const
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TColStd_ListOfInteger& AIS_InteractiveObject::ListOfRecomputeModes() const
|
||||
{return myToRecomputeModes;}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetRecomputeOk()
|
||||
{myToRecomputeModes.Clear();}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AcceptDisplayMode
|
||||
//purpose :
|
||||
@@ -441,7 +472,33 @@ void AIS_InteractiveObject::SetPolygonOffsets(const Standard_Integer aMode,
|
||||
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
|
||||
|
||||
myDrawer->ShadingAspect()->Aspect()->SetPolygonOffsets( aMode, aFactor, aUnits );
|
||||
SynchronizeAspects();
|
||||
|
||||
// Modify existing presentations
|
||||
for (Standard_Integer aPrsIter = 1, n = myPresentations.Length(); aPrsIter <= n; ++aPrsIter)
|
||||
{
|
||||
const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation();
|
||||
if ( !aPrs3d.IsNull() ) {
|
||||
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
|
||||
if( !aStruct.IsNull() ) {
|
||||
// Workaround for issue 23115: Need to update also groups, because their
|
||||
// face aspect ALWAYS overrides the structure's.
|
||||
const Graphic3d_SequenceOfGroup& aGroups = aStruct->Groups();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
Handle(Graphic3d_Group)& aGrp = aGroupIter.ChangeValue();
|
||||
if (aGrp.IsNull()
|
||||
|| !aGrp->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) aFaceAsp = aGrp->FillAreaAspect();
|
||||
aFaceAsp->SetPolygonOffsets(aMode, aFactor, aUnits);
|
||||
aGrp->SetGroupPrimitivesAspect(aFaceAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -565,33 +622,3 @@ void AIS_InteractiveObject::SynchronizeAspects()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : replaceAspects
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::replaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap)
|
||||
{
|
||||
if (theMap.IsEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
|
||||
{
|
||||
const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue().Presentation();
|
||||
if (aPrs3d.IsNull()
|
||||
|| aPrs3d->Presentation().IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPrs3d->Presentation()->Groups()); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
if (!aGroupIter.Value().IsNull())
|
||||
{
|
||||
aGroupIter.ChangeValue()->ReplaceAspects (theMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -283,7 +283,7 @@ public:
|
||||
virtual void Color (Quantity_Color& theColor) const { theColor = myDrawer->Color(); }
|
||||
|
||||
//! Returns true if the Interactive Object has width.
|
||||
Standard_Boolean HasWidth() const { return myOwnWidth != 0.0f; }
|
||||
Standard_Boolean HasWidth() const { return myOwnWidth != 0.0; }
|
||||
|
||||
//! Returns the width setting of the Interactive Object.
|
||||
Standard_Real Width() const { return myOwnWidth; }
|
||||
@@ -386,28 +386,36 @@ public:
|
||||
//! so that modifications will take effect on already computed presentation groups (thus avoiding re-displaying the object).
|
||||
Standard_EXPORT void SynchronizeAspects();
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
||||
//! Replace aspects of existing (computed) presentation groups,
|
||||
//! so that the new aspects can be applied without recomputing presentation.
|
||||
//! It is NOT recommended approach, because user has to fill such map and then search for each occurrence in computed groups.
|
||||
//! The recommended approach is computing presentation with necessary customized aspects,
|
||||
//! and then modify them directly followed by SynchronizeAspects() call.
|
||||
Standard_EXPORT void replaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap);
|
||||
Standard_EXPORT virtual Standard_Boolean RecomputeEveryPrs() const;
|
||||
|
||||
Standard_EXPORT void MustRecomputePrs (const Standard_Integer aMode) const;
|
||||
|
||||
Standard_EXPORT const TColStd_ListOfInteger& ListOfRecomputeModes() const;
|
||||
|
||||
Standard_EXPORT void SetRecomputeOk();
|
||||
|
||||
protected:
|
||||
|
||||
//! The TypeOfPresention3d means that the interactive object
|
||||
//! may have a presentation dependant of the view of Display.
|
||||
Standard_EXPORT AIS_InteractiveObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
||||
AIS_InteractiveContext* myCTXPtr;
|
||||
Handle(Standard_Transient) myOwner;
|
||||
Standard_ShortReal myOwnWidth;
|
||||
|
||||
protected:
|
||||
|
||||
TColStd_ListOfInteger myToRecomputeModes;
|
||||
Standard_Real myOwnWidth;
|
||||
Aspect_TypeOfFacingModel myCurrentFacingModel;
|
||||
Standard_Boolean myInfiniteState;
|
||||
Standard_Boolean hasOwnColor;
|
||||
Standard_Boolean hasOwnMaterial;
|
||||
Standard_Boolean myRecomputeEveryPrs;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -41,6 +41,52 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_Line,AIS_InteractiveObject)
|
||||
|
||||
//==================================================================
|
||||
// function: FindLimits
|
||||
// purpose:
|
||||
//==================================================================
|
||||
//unused
|
||||
/*#ifdef OCCT_DEBUG
|
||||
static void FindLimits(const Adaptor3d_Curve& aCurve,
|
||||
const Standard_Real aLimit,
|
||||
gp_Pnt& P1,
|
||||
gp_Pnt& P2)
|
||||
{
|
||||
Standard_Real First = aCurve.FirstParameter();
|
||||
Standard_Real Last = aCurve.LastParameter();
|
||||
Standard_Boolean firstInf = Precision::IsNegativeInfinite(First);
|
||||
Standard_Boolean lastInf = Precision::IsPositiveInfinite(Last);
|
||||
if (firstInf || lastInf) {
|
||||
Standard_Real delta = 1;
|
||||
if (firstInf && lastInf) {
|
||||
do {
|
||||
delta *= 2;
|
||||
First = - delta;
|
||||
Last = delta;
|
||||
aCurve.D0(First,P1);
|
||||
aCurve.D0(Last,P2);
|
||||
} while (P1.Distance(P2) < aLimit);
|
||||
}
|
||||
else if (firstInf) {
|
||||
aCurve.D0(Last,P2);
|
||||
do {
|
||||
delta *= 2;
|
||||
First = Last - delta;
|
||||
aCurve.D0(First,P1);
|
||||
} while (P1.Distance(P2) < aLimit);
|
||||
}
|
||||
else if (lastInf) {
|
||||
aCurve.D0(First,P1);
|
||||
do {
|
||||
delta *= 2;
|
||||
Last = First + delta;
|
||||
aCurve.D0(Last,P2);
|
||||
} while (P1.Distance(P2) < aLimit);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
//=======================================================================
|
||||
//function : AIS_Line
|
||||
//purpose :
|
||||
@@ -80,7 +126,8 @@ void AIS_Line::Compute(const Handle(PrsMgr_PresentationManager3d)&,
|
||||
|
||||
void AIS_Line::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTransformation, const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation) ;
|
||||
// throw Standard_NotImplemented("AIS_Line::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
|
||||
PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation) ;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -105,29 +152,6 @@ void AIS_Line::ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : replaceWithNewLineAspect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Line::replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
|
||||
{
|
||||
if (!myDrawer->HasLink())
|
||||
{
|
||||
myDrawer->SetLineAspect (theAspect);
|
||||
return;
|
||||
}
|
||||
|
||||
const Handle(Graphic3d_Aspects)& anAspectOld = myDrawer->LineAspect()->Aspect();
|
||||
const Handle(Graphic3d_Aspects)& anAspectNew = !theAspect.IsNull() ? theAspect->Aspect() : myDrawer->Link()->LineAspect()->Aspect();
|
||||
if (anAspectNew != anAspectOld)
|
||||
{
|
||||
myDrawer->SetLineAspect (theAspect);
|
||||
Graphic3d_MapOfAspectsToAspects aReplaceMap;
|
||||
aReplaceMap.Bind (anAspectOld, anAspectNew);
|
||||
replaceAspects (aReplaceMap);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetColor
|
||||
//purpose :
|
||||
@@ -141,15 +165,10 @@ void AIS_Line::SetColor(const Quantity_Color &aCol)
|
||||
myDrawer->HasLink() ?
|
||||
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) : 1.;
|
||||
|
||||
if (!myDrawer->HasOwnLineAspect())
|
||||
{
|
||||
replaceWithNewLineAspect (new Prs3d_LineAspect (aCol, Aspect_TOL_SOLID, WW));
|
||||
}
|
||||
if (!myDrawer->HasOwnLineAspect ())
|
||||
myDrawer->SetLineAspect (new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
|
||||
else
|
||||
{
|
||||
myDrawer->LineAspect()->SetColor (aCol);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
myDrawer->LineAspect()->SetColor(aCol);
|
||||
}
|
||||
|
||||
|
||||
@@ -161,19 +180,16 @@ void AIS_Line::UnsetColor()
|
||||
{
|
||||
hasOwnColor = Standard_False;
|
||||
|
||||
if (!HasWidth())
|
||||
{
|
||||
replaceWithNewLineAspect (Handle(Prs3d_LineAspect)());
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(Prs3d_LineAspect) NullAsp;
|
||||
|
||||
if (!HasWidth()) myDrawer->SetLineAspect(NullAsp);
|
||||
else{
|
||||
Quantity_Color CC = Quantity_NOC_YELLOW;
|
||||
if( HasColor() ) CC = myDrawer->Color();
|
||||
else if (myDrawer->HasLink()) AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, CC);
|
||||
myDrawer->LineAspect()->SetColor(CC);
|
||||
myDrawer->SetColor (CC);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -182,20 +198,15 @@ void AIS_Line::UnsetColor()
|
||||
//=======================================================================
|
||||
void AIS_Line::SetWidth(const Standard_Real aValue)
|
||||
{
|
||||
myOwnWidth = (Standard_ShortReal )aValue;
|
||||
myOwnWidth=aValue;
|
||||
|
||||
if (!myDrawer->HasOwnLineAspect())
|
||||
{
|
||||
if (!myDrawer->HasOwnLineAspect ()) {
|
||||
Quantity_Color CC = Quantity_NOC_YELLOW;
|
||||
if( HasColor() ) CC = myDrawer->Color();
|
||||
else if(myDrawer->HasLink()) AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, CC);
|
||||
replaceWithNewLineAspect (new Prs3d_LineAspect (CC, Aspect_TOL_SOLID, aValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
myDrawer->LineAspect()->SetWidth (aValue);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
myDrawer->SetLineAspect (new Prs3d_LineAspect (CC, Aspect_TOL_SOLID, aValue));
|
||||
} else
|
||||
myDrawer->LineAspect()->SetWidth(aValue);
|
||||
}
|
||||
|
||||
|
||||
@@ -205,16 +216,14 @@ void AIS_Line::SetWidth(const Standard_Real aValue)
|
||||
//=======================================================================
|
||||
void AIS_Line::UnsetWidth()
|
||||
{
|
||||
if (!HasColor())
|
||||
{
|
||||
replaceWithNewLineAspect (Handle(Prs3d_LineAspect)());
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_ShortReal WW = myDrawer->HasLink() ? (Standard_ShortReal )AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) : 1.0f;
|
||||
myDrawer->LineAspect()->SetWidth (WW);
|
||||
Handle(Prs3d_LineAspect) NullAsp;
|
||||
|
||||
if (!HasColor()) myDrawer->SetLineAspect(NullAsp);
|
||||
else{
|
||||
Standard_Real WW = myDrawer->HasLink() ?
|
||||
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) : 1.;
|
||||
myDrawer->LineAspect()->SetWidth(WW);
|
||||
myOwnWidth = WW;
|
||||
SynchronizeAspects();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -107,9 +107,6 @@ private:
|
||||
|
||||
Standard_EXPORT void ComputeSegmentLineSelection (const Handle(SelectMgr_Selection)& aSelection);
|
||||
|
||||
//! Replace aspects of already computed groups with the new value.
|
||||
void replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
|
||||
|
||||
private:
|
||||
|
||||
Handle(Geom_Line) myComponent;
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_ToolDisk.hxx>
|
||||
#include <Prs3d_ToolSector.hxx>
|
||||
#include <Prs3d_ToolSphere.hxx>
|
||||
#include <Select3D_SensitiveCircle.hxx>
|
||||
#include <Select3D_SensitivePoint.hxx>
|
||||
@@ -152,19 +151,6 @@ void AIS_Manipulator::init()
|
||||
myHighlightAspect->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
|
||||
myHighlightAspect->SetMaterial (aHilightMaterial);
|
||||
|
||||
Graphic3d_MaterialAspect aDraggerMaterial;
|
||||
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
|
||||
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
|
||||
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
|
||||
aDraggerMaterial.SetMaterialType(Graphic3d_MATERIAL_ASPECT);
|
||||
aDraggerMaterial.SetAmbient(1.0);
|
||||
|
||||
myDraggerHighlight = new Prs3d_ShadingAspect();
|
||||
myDraggerHighlight->Aspect()->SetInteriorStyle(Aspect_IS_SOLID);
|
||||
myDraggerHighlight->SetMaterial(aDraggerMaterial);
|
||||
|
||||
myDraggerHighlight->SetTransparency(0.5);
|
||||
|
||||
SetSize (100);
|
||||
SetZLayer (Graphic3d_ZLayerId_Topmost);
|
||||
}
|
||||
@@ -184,11 +170,10 @@ Handle(Prs3d_Presentation) AIS_Manipulator::getHighlightPresentation (const Hand
|
||||
|
||||
switch (anOwner->Mode())
|
||||
{
|
||||
case AIS_MM_Translation : return myAxes[anOwner->Index()].TranslatorHighlightPrs();
|
||||
case AIS_MM_Rotation : return myAxes[anOwner->Index()].RotatorHighlightPrs();
|
||||
case AIS_MM_Scaling : return myAxes[anOwner->Index()].ScalerHighlightPrs();
|
||||
case AIS_MM_TranslationPlane: return myAxes[anOwner->Index()].DraggerHighlightPrs();
|
||||
case AIS_MM_None : break;
|
||||
case AIS_MM_Translation: return myAxes[anOwner->Index()].TranslatorHighlightPrs();
|
||||
case AIS_MM_Rotation : return myAxes[anOwner->Index()].RotatorHighlightPrs();
|
||||
case AIS_MM_Scaling : return myAxes[anOwner->Index()].ScalerHighlightPrs();
|
||||
case AIS_MM_None : break;
|
||||
}
|
||||
|
||||
return aDummyPrs;
|
||||
@@ -209,11 +194,10 @@ Handle(Graphic3d_Group) AIS_Manipulator::getGroup (const Standard_Integer theInd
|
||||
|
||||
switch (theMode)
|
||||
{
|
||||
case AIS_MM_Translation : return myAxes[theIndex].TranslatorGroup();
|
||||
case AIS_MM_Rotation : return myAxes[theIndex].RotatorGroup();
|
||||
case AIS_MM_Scaling : return myAxes[theIndex].ScalerGroup();
|
||||
case AIS_MM_TranslationPlane: return myAxes[theIndex].DraggerGroup();
|
||||
case AIS_MM_None : break;
|
||||
case AIS_MM_Translation: return myAxes[theIndex].TranslatorGroup();
|
||||
case AIS_MM_Rotation : return myAxes[theIndex].RotatorGroup();
|
||||
case AIS_MM_Scaling : return myAxes[theIndex].ScalerGroup();
|
||||
case AIS_MM_None : break;
|
||||
}
|
||||
|
||||
return aDummyGroup;
|
||||
@@ -282,10 +266,6 @@ void AIS_Manipulator::SetPart (const Standard_Integer theAxisIndex, const AIS_Ma
|
||||
myAxes[theAxisIndex].SetScaling (theIsEnabled);
|
||||
break;
|
||||
|
||||
case AIS_MM_TranslationPlane:
|
||||
myAxes[theAxisIndex].SetDragging(theIsEnabled);
|
||||
break;
|
||||
|
||||
case AIS_MM_None:
|
||||
break;
|
||||
}
|
||||
@@ -420,7 +400,6 @@ void AIS_Manipulator::Attach (const Handle(AIS_ManipulatorObjectSequence)& theOb
|
||||
EnableMode (AIS_MM_Rotation);
|
||||
EnableMode (AIS_MM_Translation);
|
||||
EnableMode (AIS_MM_Scaling);
|
||||
EnableMode (AIS_MM_TranslationPlane);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,34 +586,6 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
|
||||
myPrevState = anAngle;
|
||||
return Standard_True;
|
||||
}
|
||||
case AIS_MM_TranslationPlane:
|
||||
{
|
||||
const gp_Pnt aPosLoc = myStartPosition.Location();
|
||||
const gp_Ax1 aCurrAxis = getAx1FromAx2Dir(myStartPosition, myCurrentIndex);
|
||||
IntAna_IntConicQuad aIntersector(anInputLine, gp_Pln(aPosLoc, aCurrAxis.Direction()), Precision::Angular(), Precision::Intersection());
|
||||
if (!aIntersector.IsDone() || aIntersector.NbPoints() < 1)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const gp_Pnt aNewPosition = aIntersector.Point(1);
|
||||
if (!myHasStartedTransformation)
|
||||
{
|
||||
myStartPick = aNewPosition;
|
||||
myHasStartedTransformation = Standard_True;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (aNewPosition.Distance(myStartPick) < Precision::Confusion())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
gp_Trsf aNewTrsf;
|
||||
aNewTrsf.SetTranslation(gp_Vec(myStartPick, aNewPosition));
|
||||
theTrsf *= aNewTrsf;
|
||||
return Standard_True;
|
||||
}
|
||||
case AIS_MM_None:
|
||||
{
|
||||
return Standard_False;
|
||||
@@ -706,9 +657,8 @@ void AIS_Manipulator::Transform (const gp_Trsf& theTrsf)
|
||||
}
|
||||
}
|
||||
|
||||
if ((myCurrentMode == AIS_MM_Translation && myBehaviorOnTransform.FollowTranslation)
|
||||
|| (myCurrentMode == AIS_MM_Rotation && myBehaviorOnTransform.FollowRotation)
|
||||
|| (myCurrentMode == AIS_MM_TranslationPlane && myBehaviorOnTransform.FollowDragging))
|
||||
if ((myCurrentMode == AIS_MM_Translation && myBehaviorOnTransform.FollowTranslation)
|
||||
|| (myCurrentMode == AIS_MM_Rotation && myBehaviorOnTransform.FollowRotation))
|
||||
{
|
||||
gp_Pnt aPos = myStartPosition.Location().Transformed (theTrsf);
|
||||
gp_Dir aVDir = myStartPosition.Direction().Transformed (theTrsf);
|
||||
@@ -836,13 +786,8 @@ void AIS_Manipulator::DeactivateCurrentMode()
|
||||
Handle(Prs3d_ShadingAspect) anAspect = new Prs3d_ShadingAspect();
|
||||
anAspect->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
|
||||
anAspect->SetMaterial (myDrawer->ShadingAspect()->Material());
|
||||
if (myCurrentMode == AIS_MM_TranslationPlane)
|
||||
anAspect->SetTransparency(1.0);
|
||||
else
|
||||
{
|
||||
anAspect->SetTransparency(myDrawer->ShadingAspect()->Transparency());
|
||||
anAspect->SetColor(myAxes[myCurrentIndex].Color());
|
||||
}
|
||||
anAspect->SetTransparency (myDrawer->ShadingAspect()->Transparency());
|
||||
anAspect->SetColor (myAxes[myCurrentIndex].Color());
|
||||
|
||||
aGroup->SetGroupPrimitivesAspect (anAspect->Aspect());
|
||||
}
|
||||
@@ -937,14 +882,14 @@ void AIS_Manipulator::Compute (const Handle(PrsMgr_PresentationManager3d)& thePr
|
||||
|
||||
// Display center
|
||||
myCenter.Init (myAxes[0].AxisRadius() * 2.0f, gp::Origin());
|
||||
aGroup = thePrs->NewGroup ();
|
||||
aGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
aGroup->SetPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (myCenter.Array());
|
||||
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
// Display axes
|
||||
aGroup = thePrs->NewGroup ();
|
||||
aGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
|
||||
Handle(Prs3d_ShadingAspect) anAspectAx = new Prs3d_ShadingAspect (new Graphic3d_AspectFillArea3d(*anAspect->Aspect()));
|
||||
anAspectAx->SetColor (myAxes[anIt].Color());
|
||||
@@ -987,13 +932,7 @@ void AIS_Manipulator::HilightSelected (const Handle(PrsMgr_PresentationManager3d
|
||||
return;
|
||||
}
|
||||
|
||||
if (anOwner->Mode() == AIS_MM_TranslationPlane)
|
||||
{
|
||||
myDraggerHighlight->SetColor(myAxes[anOwner->Index()].Color());
|
||||
aGroup->SetGroupPrimitivesAspect(myDraggerHighlight->Aspect());
|
||||
}
|
||||
else
|
||||
aGroup->SetGroupPrimitivesAspect(myHighlightAspect->Aspect());
|
||||
aGroup->SetGroupPrimitivesAspect (myHighlightAspect->Aspect());
|
||||
|
||||
myCurrentIndex = anOwner->Index();
|
||||
myCurrentMode = anOwner->Mode();
|
||||
@@ -1022,20 +961,13 @@ void AIS_Manipulator::HilightOwnerWithColor (const Handle(PrsMgr_PresentationMan
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (anOwner->Mode() == AIS_MM_TranslationPlane)
|
||||
{
|
||||
Handle(Prs3d_Drawer) aStyle = new Prs3d_Drawer();
|
||||
aStyle->SetColor(myAxes[anOwner->Index()].Color());
|
||||
aStyle->SetTransparency(0.5);
|
||||
aPresentation->Highlight(aStyle);
|
||||
}
|
||||
else
|
||||
aPresentation->Highlight(theStyle);
|
||||
aPresentation->Highlight (theStyle);
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPresentation->Groups());
|
||||
aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
Handle(Graphic3d_Group)& aGrp = aGroupIter.ChangeValue();
|
||||
if (!aGrp.IsNull())
|
||||
if (!aGrp.IsNull()
|
||||
&& aGrp->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGrp->SetGroupPrimitivesAspect (myHighlightAspect->Aspect());
|
||||
}
|
||||
@@ -1144,38 +1076,6 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_TranslationPlane || aMode == AIS_MM_None)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
if (!myAxes[anIt].HasDragging())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (aMode != AIS_MM_None)
|
||||
{
|
||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_TranslationPlane, 9);
|
||||
}
|
||||
|
||||
// define sensitivity by two crossed lines
|
||||
gp_Pnt aP1, aP2;
|
||||
aP1 = myAxes[((anIt + 1) % 3)].TranslatorTipPosition();
|
||||
aP2 = myAxes[((anIt + 2) % 3)].TranslatorTipPosition();
|
||||
gp_XYZ aMidP = (aP1.XYZ() + aP2.XYZ()) / 2.0;
|
||||
|
||||
Handle(Select3D_SensitiveSegment) aLine1 = new Select3D_SensitiveSegment(anOwner, aP1, aP2);
|
||||
aLine1->SetSensitivityFactor(10);
|
||||
theSelection->Add(aLine1);
|
||||
Handle(Select3D_SensitiveSegment) aLine2 = new Select3D_SensitiveSegment(anOwner, gp::Origin(), aMidP);
|
||||
aLine2->SetSensitivityFactor(10);
|
||||
theSelection->Add(aLine2);
|
||||
|
||||
// enlarge sensitivity by triangulation
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation(anOwner, myAxes[anIt].DraggerSector().Triangulation(), TopLoc_Location(), Standard_True);
|
||||
theSelection->Add(aTri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1291,24 +1191,6 @@ void AIS_Manipulator::Cube::addTriangle (const Standard_Integer theIndex,
|
||||
myArray->AddVertex (theP3, theNormal);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//class : Sector
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Manipulator::Sector::Init (const Standard_ShortReal theRadius,
|
||||
const gp_Ax1& thePosition,
|
||||
const gp_Dir& theXDirection,
|
||||
const Standard_Integer theSlicesNb,
|
||||
const Standard_Integer theStacksNb)
|
||||
{
|
||||
Prs3d_ToolSector aTool(theRadius, theSlicesNb, theStacksNb);
|
||||
gp_Ax3 aSystem(thePosition.Location(), thePosition.Direction(), theXDirection);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation(aSystem, gp_Ax3());
|
||||
aTool.FillArray(myArray, myTriangulation, aTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//class : Axis
|
||||
//function : Constructor
|
||||
@@ -1329,7 +1211,6 @@ AIS_Manipulator::Axis::Axis (const gp_Ax1& theAxis,
|
||||
myInnerRadius (myLength + myBoxSize),
|
||||
myDiskThickness (myBoxSize * 0.5f),
|
||||
myIndent (0.2f),
|
||||
myHasDragging(Standard_True),
|
||||
myFacettesNumber (20),
|
||||
myCircleRadius (myLength + myBoxSize + myBoxSize * 0.5f * 0.5f)
|
||||
{
|
||||
@@ -1358,7 +1239,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
myAxisRadius * 1.5,
|
||||
anArrowLength,
|
||||
myFacettesNumber);
|
||||
myTranslatorGroup = thePrs->NewGroup ();
|
||||
myTranslatorGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
myTranslatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
|
||||
myTranslatorGroup->AddPrimitiveArray (myTriangleArray);
|
||||
|
||||
@@ -1382,7 +1263,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
myCubePos = myReferenceAxis.Direction().XYZ() * (myLength + myIndent);
|
||||
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), myBoxSize);
|
||||
|
||||
myScalerGroup = thePrs->NewGroup ();
|
||||
myScalerGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
myScalerGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
|
||||
myScalerGroup->AddPrimitiveArray (myCube.Array());
|
||||
|
||||
@@ -1405,7 +1286,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
{
|
||||
myCircleRadius = myInnerRadius + myIndent * 2 + myDiskThickness * 0.5f;
|
||||
myCircle.Init (myInnerRadius + myIndent * 2, myInnerRadius + myDiskThickness + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), myFacettesNumber * 2);
|
||||
myRotatorGroup = thePrs->NewGroup ();
|
||||
myRotatorGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
myRotatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
|
||||
myRotatorGroup->AddPrimitiveArray (myCircle.Array());
|
||||
|
||||
@@ -1423,36 +1304,4 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
|
||||
aGroup->AddPrimitiveArray (myCircle.Array());
|
||||
}
|
||||
}
|
||||
|
||||
if (myHasDragging)
|
||||
{
|
||||
gp_Dir aXDirection;
|
||||
if (myReferenceAxis.Direction().X() > 0)
|
||||
aXDirection = gp::DY();
|
||||
else if (myReferenceAxis.Direction().Y() > 0)
|
||||
aXDirection = gp::DZ();
|
||||
else
|
||||
aXDirection = gp::DX();
|
||||
|
||||
mySector.Init(myInnerRadius + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), aXDirection, myFacettesNumber * 2);
|
||||
myDraggerGroup = thePrs->NewGroup();
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) aFillArea = new Graphic3d_AspectFillArea3d();
|
||||
myDraggerGroup->SetGroupPrimitivesAspect(aFillArea);
|
||||
myDraggerGroup->AddPrimitiveArray(mySector.Array());
|
||||
|
||||
if (myHighlightDragger.IsNull())
|
||||
{
|
||||
myHighlightDragger = new Prs3d_Presentation(thePrsMgr->StructureManager());
|
||||
}
|
||||
else
|
||||
{
|
||||
myHighlightDragger->Clear();
|
||||
}
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(myHighlightDragger);
|
||||
aGroup->SetGroupPrimitivesAspect(aFillArea);
|
||||
aGroup->AddPrimitiveArray(mySector.Array());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -280,14 +280,12 @@ public:
|
||||
//! - FollowRotation - whether the manipulator will be rotated together with an object.
|
||||
struct BehaviorOnTransform {
|
||||
|
||||
BehaviorOnTransform() : FollowTranslation (Standard_True), FollowRotation (Standard_True), FollowDragging (Standard_True) {}
|
||||
BehaviorOnTransform() : FollowTranslation (Standard_True), FollowRotation (Standard_True) {}
|
||||
BehaviorOnTransform& SetFollowTranslation (const Standard_Boolean theApply) { FollowTranslation = theApply; return *this; }
|
||||
BehaviorOnTransform& SetFollowRotation (const Standard_Boolean theApply) { FollowRotation = theApply; return *this; }
|
||||
BehaviorOnTransform& SetFollowDragging (const Standard_Boolean theApply) { FollowDragging = theApply; return *this; }
|
||||
|
||||
Standard_Boolean FollowTranslation;
|
||||
Standard_Boolean FollowRotation;
|
||||
Standard_Boolean FollowDragging;
|
||||
};
|
||||
|
||||
//! Sets behavior settings for transformation action carried on the manipulator,
|
||||
@@ -448,29 +446,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
Handle(Graphic3d_ArrayOfTriangles) myArray;
|
||||
};
|
||||
|
||||
class Sector : public Quadric
|
||||
{
|
||||
public:
|
||||
|
||||
Sector()
|
||||
: Quadric(),
|
||||
myRadius(0.0f)
|
||||
{ }
|
||||
|
||||
~Sector() { }
|
||||
|
||||
void Init(const Standard_ShortReal theRadius,
|
||||
const gp_Ax1& thePosition,
|
||||
const gp_Dir& theXDirection,
|
||||
const Standard_Integer theSlicesNb = 5,
|
||||
const Standard_Integer theStacksNb = 5);
|
||||
|
||||
protected:
|
||||
|
||||
gp_Ax1 myPosition;
|
||||
Standard_ShortReal myRadius;
|
||||
};
|
||||
|
||||
//! The class describes on axis sub-object.
|
||||
//! It includes sub-objects itself:
|
||||
//! -rotator
|
||||
@@ -510,11 +485,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
{
|
||||
myHighlightRotator->SetTransformPersistence (theTrsfPers);
|
||||
}
|
||||
|
||||
if (!myHighlightDragger.IsNull())
|
||||
{
|
||||
myHighlightDragger->SetTransformPersistence(theTrsfPers);
|
||||
}
|
||||
}
|
||||
|
||||
void Transform (const Handle(Geom_Transformation)& theTransformation)
|
||||
@@ -533,11 +503,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
{
|
||||
myHighlightRotator->SetTransformation (theTransformation);
|
||||
}
|
||||
|
||||
if (!myHighlightDragger.IsNull())
|
||||
{
|
||||
myHighlightDragger->SetTransformation(theTransformation);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean HasTranslation() const { return myHasTranslation; }
|
||||
@@ -546,16 +511,12 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
|
||||
Standard_Boolean HasScaling() const { return myHasScaling; }
|
||||
|
||||
Standard_Boolean HasDragging() const { return myHasDragging; }
|
||||
|
||||
void SetTranslation (const Standard_Boolean theIsEnabled) { myHasTranslation = theIsEnabled; }
|
||||
|
||||
void SetRotation (const Standard_Boolean theIsEnabled) { myHasRotation = theIsEnabled; }
|
||||
|
||||
void SetScaling (const Standard_Boolean theIsEnabled) { myHasScaling = theIsEnabled; }
|
||||
|
||||
void SetDragging(const Standard_Boolean theIsEnabled) { myHasDragging = theIsEnabled; }
|
||||
|
||||
Quantity_Color Color() const { return myColor; }
|
||||
|
||||
Standard_ShortReal AxisLength() const { return myLength; }
|
||||
@@ -570,16 +531,12 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
|
||||
const Handle(Prs3d_Presentation)& ScalerHighlightPrs() const { return myHighlightScaler; }
|
||||
|
||||
const Handle(Prs3d_Presentation)& DraggerHighlightPrs() const { return myHighlightDragger; }
|
||||
|
||||
const Handle(Graphic3d_Group)& TranslatorGroup() const { return myTranslatorGroup; }
|
||||
|
||||
const Handle(Graphic3d_Group)& RotatorGroup() const { return myRotatorGroup; }
|
||||
|
||||
const Handle(Graphic3d_Group)& ScalerGroup() const { return myScalerGroup; }
|
||||
|
||||
const Handle(Graphic3d_Group)& DraggerGroup() const { return myDraggerGroup; }
|
||||
|
||||
const Handle(Graphic3d_ArrayOfTriangles)& TriangleArray() const { return myTriangleArray; }
|
||||
|
||||
void SetIndent (const Standard_ShortReal theValue) { myIndent = theValue; }
|
||||
@@ -613,7 +570,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
public:
|
||||
|
||||
const gp_Pnt& TranslatorTipPosition() const { return myArrowTipPos; }
|
||||
const Sector& DraggerSector() const { return mySector; }
|
||||
const Disk& RotatorDisk() const { return myCircle; }
|
||||
float RotatorDiskRadius() const { return myCircleRadius; }
|
||||
const Cube& ScalerCube() const { return myCube; }
|
||||
@@ -637,14 +593,11 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
Standard_ShortReal myDiskThickness;
|
||||
Standard_ShortReal myIndent; //!< Gap between visual part of the manipulator.
|
||||
|
||||
Standard_Boolean myHasDragging;
|
||||
|
||||
protected:
|
||||
|
||||
Standard_Integer myFacettesNumber;
|
||||
|
||||
gp_Pnt myArrowTipPos;
|
||||
Sector mySector;
|
||||
Disk myCircle;
|
||||
float myCircleRadius;
|
||||
Cube myCube;
|
||||
@@ -653,12 +606,10 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
|
||||
Handle(Graphic3d_Group) myTranslatorGroup;
|
||||
Handle(Graphic3d_Group) myScalerGroup;
|
||||
Handle(Graphic3d_Group) myRotatorGroup;
|
||||
Handle(Graphic3d_Group) myDraggerGroup;
|
||||
|
||||
Handle(Prs3d_Presentation) myHighlightTranslator;
|
||||
Handle(Prs3d_Presentation) myHighlightScaler;
|
||||
Handle(Prs3d_Presentation) myHighlightRotator;
|
||||
Handle(Prs3d_Presentation) myHighlightDragger;
|
||||
|
||||
Handle(Graphic3d_ArrayOfTriangles) myTriangleArray;
|
||||
|
||||
@@ -687,9 +638,6 @@ protected: //! @name Fields for interactive transformation. Fields only for inte
|
||||
|
||||
//! Aspect used to color current detected part and current selected part.
|
||||
Handle(Prs3d_ShadingAspect) myHighlightAspect;
|
||||
|
||||
//! Aspect used to color sector part when it's selected.
|
||||
Handle(Prs3d_ShadingAspect) myDraggerHighlight;
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_Manipulator, AIS_InteractiveObject)
|
||||
|
@@ -22,8 +22,7 @@ enum AIS_ManipulatorMode
|
||||
AIS_MM_None = 0,
|
||||
AIS_MM_Translation = 1,
|
||||
AIS_MM_Rotation,
|
||||
AIS_MM_Scaling,
|
||||
AIS_MM_TranslationPlane
|
||||
AIS_MM_Scaling
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,250 +0,0 @@
|
||||
// Created by: Kirill GAVRILOV
|
||||
// Copyright (c) 2019 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 <AIS_MediaPlayer.hxx>
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Media_PlayerContext.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_MediaTexture.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_MediaPlayer, AIS_InteractiveObject)
|
||||
|
||||
//! Create an array of triangles defining a rectangle.
|
||||
static Handle(Graphic3d_ArrayOfTriangles) createRectangleArray (const Graphic3d_Vec2i& theLower,
|
||||
const Graphic3d_Vec2i& theUpper,
|
||||
Graphic3d_ArrayFlags theFlags)
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfTriangles) aRectTris = new Graphic3d_ArrayOfTriangles (4, 6, theFlags);
|
||||
aRectTris->AddVertex (gp_Pnt (theLower.x(), theLower.y(), 0.0), gp_Pnt2d (0.0, 1.0));
|
||||
aRectTris->AddVertex (gp_Pnt (theLower.x(), theUpper.y(), 0.0), gp_Pnt2d (0.0, 0.0));
|
||||
aRectTris->AddVertex (gp_Pnt (theUpper.x(), theUpper.y(), 0.0), gp_Pnt2d (1.0, 0.0));
|
||||
aRectTris->AddVertex (gp_Pnt (theUpper.x(), theLower.y(), 0.0), gp_Pnt2d (1.0, 1.0));
|
||||
aRectTris->AddEdges (1, 2, 3);
|
||||
aRectTris->AddEdges (1, 3, 4);
|
||||
return aRectTris;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : AIS_MediaPlayer
|
||||
// Purpose :
|
||||
//================================================================
|
||||
AIS_MediaPlayer::AIS_MediaPlayer()
|
||||
: myFramePair (new Graphic3d_MediaTextureSet()),
|
||||
myFrameSize (1, 1),
|
||||
myToClosePlayer (false)
|
||||
{
|
||||
SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
|
||||
SetZLayer (Graphic3d_ZLayerId_TopOSD);
|
||||
SetInfiniteState (true);
|
||||
|
||||
Graphic3d_MaterialAspect aMat;
|
||||
myFrameAspect = new Graphic3d_AspectFillArea3d (Aspect_IS_SOLID, Quantity_NOC_WHITE, Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0f, aMat, aMat);
|
||||
myFrameAspect->SetShadingModel (Graphic3d_TOSM_UNLIT);
|
||||
myFrameAspect->SetTextureMapOn (true);
|
||||
myFrameAspect->SetTextureSet (myFramePair);
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : ~AIS_MediaPlayer
|
||||
// Purpose :
|
||||
//================================================================
|
||||
AIS_MediaPlayer::~AIS_MediaPlayer()
|
||||
{
|
||||
// stop threads
|
||||
myFramePair.Nullify();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenInput
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_MediaPlayer::OpenInput (const TCollection_AsciiString& thePath,
|
||||
Standard_Boolean theToWait)
|
||||
{
|
||||
if (myFramePair->PlayerContext().IsNull()
|
||||
&& thePath.IsEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myFramePair->OpenInput (thePath, theToWait);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : PresentFrame
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool AIS_MediaPlayer::PresentFrame (const Graphic3d_Vec2i& theLeftCorner,
|
||||
const Graphic3d_Vec2i& theMaxSize)
|
||||
{
|
||||
if (myToClosePlayer)
|
||||
{
|
||||
myToClosePlayer = false;
|
||||
if (!HasInteractiveContext())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!myFramePair->PlayerContext().IsNull())
|
||||
{
|
||||
myFramePair->PlayerContext()->Pause();
|
||||
}
|
||||
|
||||
Handle(AIS_InteractiveContext) aCtx = GetContext();
|
||||
Handle(AIS_InteractiveObject) aThis = this;
|
||||
aCtx->Remove (aThis, false);
|
||||
aCtx->CurrentViewer()->Invalidate();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (myFramePair->PlayerContext().IsNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool toRedraw = myFramePair->SwapFrames();
|
||||
toRedraw = updateSize (theLeftCorner, theMaxSize) || toRedraw;
|
||||
if (toRedraw)
|
||||
{
|
||||
myFrameAspect->SetShaderProgram (myFramePair->ShaderProgram());
|
||||
SynchronizeAspects();
|
||||
}
|
||||
return toRedraw;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : updateSize
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool AIS_MediaPlayer::updateSize (const Graphic3d_Vec2i& theLeftCorner,
|
||||
const Graphic3d_Vec2i& theMaxSize)
|
||||
{
|
||||
const Graphic3d_Vec2i aFrameSize = myFramePair->FrameSize();
|
||||
Graphic3d_Vec2i aNewPos = theLeftCorner;
|
||||
Graphic3d_Vec2i aNewSize = myFrameSize;
|
||||
if (aFrameSize.x() > 0
|
||||
&& aFrameSize.y() > 0)
|
||||
{
|
||||
const double anAspect = double(theMaxSize.x()) / double(theMaxSize.y());
|
||||
const double aFitAspect = double(aFrameSize.x()) / double(aFrameSize.y());
|
||||
aNewSize = aFrameSize;
|
||||
if (aFitAspect >= anAspect)
|
||||
{
|
||||
aNewSize.y() = int(double(aFrameSize.x()) / aFitAspect);
|
||||
}
|
||||
else
|
||||
{
|
||||
aNewSize.x() = int(double(aFrameSize.y()) * aFitAspect);
|
||||
}
|
||||
|
||||
for (int aCoord = 0; aCoord < 2; ++aCoord)
|
||||
{
|
||||
if (aNewSize[aCoord] > theMaxSize[aCoord])
|
||||
{
|
||||
const double aScale = double(theMaxSize[aCoord]) / double(aNewSize[aCoord]);
|
||||
aNewSize.x() = int(double(aNewSize.x()) * aScale);
|
||||
aNewSize.y() = int(double(aNewSize.y()) * aScale);
|
||||
}
|
||||
}
|
||||
|
||||
aNewPos = theLeftCorner + theMaxSize / 2 - aNewSize / 2;
|
||||
}
|
||||
else if (myFrameSize.x() < 2
|
||||
|| myFrameSize.y() < 2)
|
||||
{
|
||||
aNewSize = theMaxSize;
|
||||
}
|
||||
|
||||
if (myFrameSize == aNewSize
|
||||
&& myFrameBottomLeft == aNewPos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
myFrameSize = aNewSize;
|
||||
myFrameBottomLeft = aNewPos;
|
||||
if (HasInteractiveContext())
|
||||
{
|
||||
SetToUpdate();
|
||||
GetContext()->Redisplay (this, false);
|
||||
GetContext()->CurrentViewer()->Invalidate();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : PlayPause
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_MediaPlayer::PlayPause()
|
||||
{
|
||||
if (myFramePair->PlayerContext().IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Real aProgress = 0.0, aDuration = 0.0;
|
||||
bool isPaused = false;
|
||||
myFramePair->PlayerContext()->PlayPause (isPaused, aProgress, aDuration);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Compute
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_MediaPlayer::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
thePrs->SetInfiniteState (IsInfinite());
|
||||
if (theMode != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// main frame
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris = createRectangleArray (myFrameBottomLeft, myFrameBottomLeft + myFrameSize, Graphic3d_ArrayFlags_VertexTexel);
|
||||
Handle(Graphic3d_Group) aMainGroup = thePrs->NewGroup();
|
||||
aMainGroup->SetGroupPrimitivesAspect (myFrameAspect);
|
||||
aMainGroup->AddPrimitiveArray (aTris);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ComputeSelection
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_MediaPlayer::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (theMode != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris = createRectangleArray (myFrameBottomLeft, myFrameBottomLeft + myFrameSize, Graphic3d_ArrayFlags_None);
|
||||
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this, 5);
|
||||
Handle(Select3D_SensitivePrimitiveArray) aSens = new Select3D_SensitivePrimitiveArray (anOwner);
|
||||
aSens->InitTriangulation (aTris->Attributes(), aTris->Indices(), TopLoc_Location());
|
||||
theSel->Add (aSens);
|
||||
}
|
@@ -1,96 +0,0 @@
|
||||
// Created by: Kirill GAVRILOV
|
||||
// Copyright (c) 2019 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 _AIS_MediaPlayer_HeaderFile
|
||||
#define _AIS_MediaPlayer_HeaderFile
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Graphic3d_MediaTextureSet.hxx>
|
||||
|
||||
class Media_PlayerContext;
|
||||
|
||||
//! Presentation for video playback.
|
||||
class AIS_MediaPlayer : public AIS_InteractiveObject
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_MediaPlayer, AIS_InteractiveObject)
|
||||
public:
|
||||
|
||||
//! Empty constructor.
|
||||
Standard_EXPORT AIS_MediaPlayer();
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~AIS_MediaPlayer();
|
||||
|
||||
//! Setup callback to be called on queue progress (e.g. when new frame should be displayed).
|
||||
void SetCallback (Graphic3d_MediaTextureSet::CallbackOnUpdate_t theCallbackFunction, void* theCallbackUserPtr)
|
||||
{
|
||||
myFramePair->SetCallback (theCallbackFunction, theCallbackUserPtr);
|
||||
}
|
||||
|
||||
//! Open specified file.
|
||||
Standard_EXPORT void OpenInput (const TCollection_AsciiString& thePath,
|
||||
Standard_Boolean theToWait);
|
||||
|
||||
//! Display new frame.
|
||||
Standard_EXPORT bool PresentFrame (const Graphic3d_Vec2i& theLeftCorner,
|
||||
const Graphic3d_Vec2i& theMaxSize);
|
||||
|
||||
//! Return player context.
|
||||
const Handle(Media_PlayerContext)& PlayerContext() const { return myFramePair->PlayerContext(); }
|
||||
|
||||
//! Switch playback state.
|
||||
Standard_EXPORT void PlayPause();
|
||||
|
||||
//! Schedule player to be closed.
|
||||
void SetClosePlayer()
|
||||
{
|
||||
myToClosePlayer = true;
|
||||
myFramePair->Notify();
|
||||
}
|
||||
|
||||
//! Return duration.
|
||||
double Duration() const { return myFramePair->Duration(); }
|
||||
|
||||
//! @name AIS_InteractiveObject interface
|
||||
protected:
|
||||
|
||||
//! Accept only display mode 0.
|
||||
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
|
||||
|
||||
//! Compute presentation.
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Compute selection
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Update frame size.
|
||||
Standard_EXPORT bool updateSize (const Graphic3d_Vec2i& theLeftCorner,
|
||||
const Graphic3d_Vec2i& theMaxSize);
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_MediaTextureSet) myFramePair;
|
||||
Handle(Graphic3d_AspectFillArea3d) myFrameAspect;
|
||||
Graphic3d_Vec2i myFrameBottomLeft;
|
||||
Graphic3d_Vec2i myFrameSize;
|
||||
bool myToClosePlayer;
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_MediaPlayer_HeaderFile
|
@@ -387,8 +387,7 @@ void AIS_Plane::SetSize(const Standard_Real aXLength,
|
||||
|
||||
|
||||
myHasOwnSize = Standard_True;
|
||||
SetToUpdate();
|
||||
UpdatePresentations();
|
||||
Update();
|
||||
UpdateSelection();
|
||||
}
|
||||
|
||||
@@ -419,8 +418,7 @@ void AIS_Plane::UnsetSize()
|
||||
}
|
||||
|
||||
myHasOwnSize = Standard_False;
|
||||
SetToUpdate();
|
||||
UpdatePresentations();
|
||||
Update();
|
||||
UpdateSelection();
|
||||
|
||||
}
|
||||
|
@@ -248,7 +248,6 @@ void AIS_PlaneTrihedron::SetColor(const Quantity_Color &aCol)
|
||||
myDrawer->SetColor (aCol);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol);
|
||||
myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -89,7 +89,7 @@ public:
|
||||
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
|
||||
|
||||
//! Allows you to provide settings for the color aColor.
|
||||
Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
|
||||
Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
|
||||
|
||||
void SetXLabel (const TCollection_AsciiString& theLabel) { myXLabel = theLabel; }
|
||||
|
||||
|
@@ -205,29 +205,6 @@ void AIS_Point::UnsetMarker()
|
||||
|| theMode == -99;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : replaceWithNewPointAspect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Point::replaceWithNewPointAspect (const Handle(Prs3d_PointAspect)& theAspect)
|
||||
{
|
||||
if (!myDrawer->HasLink())
|
||||
{
|
||||
myDrawer->SetPointAspect (theAspect);
|
||||
return;
|
||||
}
|
||||
|
||||
const Handle(Graphic3d_AspectMarker3d) anAspectOld = myDrawer->PointAspect()->Aspect();
|
||||
const Handle(Graphic3d_AspectMarker3d) anAspectNew = !theAspect.IsNull() ? theAspect->Aspect() : myDrawer->Link()->PointAspect()->Aspect();
|
||||
if (anAspectNew != anAspectOld)
|
||||
{
|
||||
myDrawer->SetPointAspect (theAspect);
|
||||
Graphic3d_MapOfAspectsToAspects aReplaceMap;
|
||||
aReplaceMap.Bind (anAspectOld, anAspectNew);
|
||||
replaceAspects (aReplaceMap);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdatePointValues
|
||||
//purpose :
|
||||
@@ -235,14 +212,12 @@ void AIS_Point::replaceWithNewPointAspect (const Handle(Prs3d_PointAspect)& theA
|
||||
|
||||
void AIS_Point::UpdatePointValues()
|
||||
{
|
||||
if (!hasOwnColor
|
||||
&& myOwnWidth == 0.0f
|
||||
&& !myHasTOM)
|
||||
|
||||
if(!hasOwnColor && myOwnWidth==0.0 && !myHasTOM)
|
||||
{
|
||||
replaceWithNewPointAspect (Handle(Prs3d_PointAspect)());
|
||||
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
|
||||
return;
|
||||
}
|
||||
|
||||
Quantity_Color aCol (Quantity_NOC_YELLOW);
|
||||
Aspect_TypeOfMarker aTOM = Aspect_TOM_PLUS;
|
||||
Standard_Real aScale = 1.0;
|
||||
@@ -254,20 +229,20 @@ void AIS_Point::UpdatePointValues()
|
||||
}
|
||||
|
||||
if(hasOwnColor) aCol = myDrawer->Color();
|
||||
if(myOwnWidth != 0.0f) aScale = myOwnWidth;
|
||||
if(myOwnWidth!=0.0) aScale = myOwnWidth;
|
||||
if(myHasTOM) aTOM = myTOM;
|
||||
|
||||
if(myDrawer->HasOwnPointAspect())
|
||||
{
|
||||
|
||||
|
||||
if(myDrawer->HasOwnPointAspect()){
|
||||
// CLE
|
||||
// const Handle(Prs3d_PointAspect) PA = myDrawer->PointAspect();
|
||||
Handle(Prs3d_PointAspect) PA = myDrawer->PointAspect();
|
||||
// ENDCLE
|
||||
PA->SetColor(aCol);
|
||||
PA->SetTypeOfMarker(aTOM);
|
||||
PA->SetScale(aScale);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
else
|
||||
{
|
||||
replaceWithNewPointAspect (new Prs3d_PointAspect (aTOM, aCol, aScale));
|
||||
}
|
||||
myDrawer->SetPointAspect(new Prs3d_PointAspect(aTOM,aCol,aScale));
|
||||
}
|
||||
|
||||
|
@@ -59,10 +59,10 @@ public:
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
//! Allows you to provide settings for the Color.
|
||||
Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
|
||||
Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
|
||||
|
||||
//! Allows you to remove color settings.
|
||||
Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
|
||||
Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
|
||||
|
||||
//! Allows you to provide settings for a marker. These include
|
||||
//! - type of marker,
|
||||
@@ -91,9 +91,6 @@ private:
|
||||
|
||||
Standard_EXPORT void UpdatePointValues();
|
||||
|
||||
//! Replace aspects of already computed groups with the new value.
|
||||
void replaceWithNewPointAspect (const Handle(Prs3d_PointAspect)& theAspect);
|
||||
|
||||
private:
|
||||
|
||||
Handle(Geom_Point) myComponent;
|
||||
|
@@ -173,8 +173,8 @@ void AIS_PointCloudOwner::Clear (const Handle(PrsMgr_PresentationManager)& thePr
|
||||
//==================================================
|
||||
AIS_PointCloud::AIS_PointCloud()
|
||||
{
|
||||
myDrawer->SetupOwnShadingAspect();
|
||||
myDrawer->ShadingAspect()->Aspect()->SetMarkerType (Aspect_TOM_POINT);
|
||||
// override default point style to Aspect_TOM_POINT
|
||||
myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_YELLOW, 1.0));
|
||||
|
||||
SetDisplayMode (AIS_PointCloud::DM_Points);
|
||||
SetHilightMode (AIS_PointCloud::DM_BndBox);
|
||||
@@ -282,8 +282,52 @@ void AIS_PointCloud::SetColor (const Quantity_Color& theColor)
|
||||
{
|
||||
AIS_InteractiveObject::SetColor(theColor);
|
||||
|
||||
if (!myDrawer->HasOwnPointAspect())
|
||||
{
|
||||
myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, theColor, 1.0));
|
||||
if (myDrawer->HasLink())
|
||||
{
|
||||
*myDrawer->PointAspect()->Aspect() = *myDrawer->Link()->PointAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
if (!myDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
if (myDrawer->HasLink())
|
||||
{
|
||||
*myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
|
||||
// Override color
|
||||
myDrawer->ShadingAspect()->SetColor (theColor);
|
||||
SynchronizeAspects();
|
||||
myDrawer->PointAspect() ->SetColor (theColor);
|
||||
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectMarker3d) aPointAspect = myDrawer->PointAspect()->Aspect();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAspect = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_PointCloud::DM_Points)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_MARKER))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (aPointAspect);
|
||||
}
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAspect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -298,20 +342,34 @@ void AIS_PointCloud::UnsetColor()
|
||||
}
|
||||
|
||||
AIS_InteractiveObject::UnsetColor();
|
||||
|
||||
if (!HasWidth())
|
||||
{
|
||||
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
|
||||
}
|
||||
else
|
||||
{
|
||||
myDrawer->PointAspect()->SetColor (myDrawer->HasLink()
|
||||
? myDrawer->Link()->PointAspect()->Aspect()->Color()
|
||||
: Quantity_Color (Quantity_NOC_YELLOW));
|
||||
}
|
||||
|
||||
if (HasMaterial()
|
||||
|| IsTransparent())
|
||||
{
|
||||
Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS);
|
||||
Graphic3d_MaterialAspect aMat = aDefaultMat;
|
||||
Quantity_Color aColor = aDefaultMat.Color();
|
||||
if (myDrawer->HasLink())
|
||||
{
|
||||
aColor = myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel);
|
||||
}
|
||||
if (HasMaterial() || myDrawer->HasLink())
|
||||
{
|
||||
aMat = AIS_GraphicTool::GetMaterial (HasMaterial() ? myDrawer : myDrawer->Link());
|
||||
}
|
||||
if (HasMaterial())
|
||||
{
|
||||
Quantity_Color aColor = aDefaultMat.AmbientColor();
|
||||
if (myDrawer->HasLink())
|
||||
{
|
||||
aColor = myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel);
|
||||
}
|
||||
aMat.SetColor (aColor);
|
||||
}
|
||||
if (IsTransparent())
|
||||
@@ -320,10 +378,43 @@ void AIS_PointCloud::UnsetColor()
|
||||
aMat.SetTransparency (Standard_ShortReal(aTransp));
|
||||
}
|
||||
myDrawer->ShadingAspect()->SetMaterial (aMat, myCurrentFacingModel);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetInteriorColor (aColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
|
||||
}
|
||||
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
|
||||
|
||||
SynchronizeAspects();
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->Link()->ShadingAspect()->Aspect();
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAsp = myDrawer->Link()->PointAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_PointCloud::DM_Points)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
|
||||
// Check if aspect of given type is set for the group,
|
||||
// because setting aspect for group with no already set aspect
|
||||
// can lead to loss of presentation data
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_MARKER))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (aMarkerAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -332,6 +423,14 @@ void AIS_PointCloud::UnsetColor()
|
||||
//=======================================================================
|
||||
void AIS_PointCloud::SetMaterial (const Graphic3d_MaterialAspect& theMat)
|
||||
{
|
||||
if (!myDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
if (myDrawer->HasLink())
|
||||
{
|
||||
*myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
hasOwnMaterial = Standard_True;
|
||||
|
||||
myDrawer->ShadingAspect()->SetMaterial (theMat, myCurrentFacingModel);
|
||||
@@ -340,7 +439,28 @@ void AIS_PointCloud::SetMaterial (const Graphic3d_MaterialAspect& theMat)
|
||||
myDrawer->ShadingAspect()->SetColor (myDrawer->Color(), myCurrentFacingModel);
|
||||
}
|
||||
myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
|
||||
SynchronizeAspects();
|
||||
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_PointCloud::DM_Points)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -354,6 +474,8 @@ void AIS_PointCloud::UnsetMaterial()
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasColor()
|
||||
|| IsTransparent())
|
||||
{
|
||||
Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS);
|
||||
myDrawer->ShadingAspect()->SetMaterial (myDrawer->HasLink() ?
|
||||
@@ -366,8 +488,33 @@ void AIS_PointCloud::UnsetMaterial()
|
||||
myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
|
||||
}
|
||||
hasOwnMaterial = Standard_False;
|
||||
SynchronizeAspects();
|
||||
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_PointCloud::DM_Points)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -388,7 +535,8 @@ void AIS_PointCloud::Compute (const Handle(PrsMgr_PresentationManager3d)& /*theP
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePrs);
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->PointAspect()->Aspect());
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (aPoints);
|
||||
break;
|
||||
|
@@ -28,7 +28,6 @@
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
@@ -185,13 +184,8 @@ void AIS_Relation::ComputeProjVertexPresentation(const Handle(Prs3d_Presentation
|
||||
pa->SetTypeOfMarker(aProjTOM);
|
||||
}
|
||||
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = aPrs->NewGroup();
|
||||
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
|
||||
anArrayOfPoints->AddVertex (ProjPoint);
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->PointAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (anArrayOfPoints);
|
||||
}
|
||||
// calcul du projete
|
||||
StdPrs_Point::Add(aPrs, new Geom_CartesianPoint(ProjPoint), myDrawer);
|
||||
|
||||
if (!myDrawer->HasOwnWireAspect()){
|
||||
myDrawer->SetWireAspect(new Prs3d_LineAspect(aColor,aCallTOL,2.));}
|
||||
@@ -203,14 +197,10 @@ void AIS_Relation::ComputeProjVertexPresentation(const Handle(Prs3d_Presentation
|
||||
}
|
||||
|
||||
// Si les points ne sont pas confondus...
|
||||
if (!ProjPoint.IsEqual (BRep_Tool::Pnt(aVertex),Precision::Confusion()))
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = aPrs->NewGroup();
|
||||
Handle(Graphic3d_ArrayOfSegments) anArrayOfLines = new Graphic3d_ArrayOfSegments (2);
|
||||
anArrayOfLines->AddVertex (ProjPoint);
|
||||
anArrayOfLines->AddVertex (BRep_Tool::Pnt(aVertex));
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->WireAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (anArrayOfLines);
|
||||
if (!ProjPoint.IsEqual (BRep_Tool::Pnt(aVertex),Precision::Confusion())) {
|
||||
// calcul des lignes de rappel
|
||||
BRepBuilderAPI_MakeEdge MakEd (ProjPoint,BRep_Tool::Pnt(aVertex));
|
||||
StdPrs_WFShape::Add (aPrs, MakEd.Edge(), myDrawer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -392,12 +392,13 @@ void AIS_RubberBand::Compute (const Handle(PrsMgr_PresentationManager3d)& /*theP
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePresentation);
|
||||
|
||||
// Draw filling
|
||||
if (IsFilling() && fillTriangles())
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup1 = thePresentation->NewGroup();
|
||||
aGroup1->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroup1->AddPrimitiveArray (myTriangles);
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (myTriangles);
|
||||
}
|
||||
|
||||
// Draw frame
|
||||
@@ -432,7 +433,6 @@ void AIS_RubberBand::Compute (const Handle(PrsMgr_PresentationManager3d)& /*theP
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (myBorders);
|
||||
}
|
||||
|
@@ -68,38 +68,13 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_Shape,AIS_InteractiveObject)
|
||||
|
||||
// Auxiliary macros
|
||||
#define replaceAspectWithDef(theMap, theAspect) \
|
||||
if (myDrawer->Link()->theAspect()->Aspect() != myDrawer->theAspect()->Aspect()) \
|
||||
{ \
|
||||
theMap.Bind (myDrawer->theAspect()->Aspect(), myDrawer->Link()->theAspect()->Aspect()); \
|
||||
}
|
||||
|
||||
// Auxiliary macros for replaceWithNewOwnAspects()
|
||||
#define replaceAspectWithOwn(theMap, theAspect) \
|
||||
if (myDrawer->Link()->theAspect()->Aspect() != myDrawer->theAspect()->Aspect()) \
|
||||
{ \
|
||||
theMap.Bind (myDrawer->Link()->theAspect()->Aspect(), myDrawer->theAspect()->Aspect()); \
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : replaceWithNewOwnAspects
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Shape::replaceWithNewOwnAspects()
|
||||
static Standard_Boolean IsInList(const TColStd_ListOfInteger& LL, const Standard_Integer aMode)
|
||||
{
|
||||
Graphic3d_MapOfAspectsToAspects aReplaceMap;
|
||||
|
||||
replaceAspectWithOwn (aReplaceMap, ShadingAspect);
|
||||
replaceAspectWithOwn (aReplaceMap, LineAspect);
|
||||
replaceAspectWithOwn (aReplaceMap, WireAspect);
|
||||
replaceAspectWithOwn (aReplaceMap, FreeBoundaryAspect);
|
||||
replaceAspectWithOwn (aReplaceMap, UnFreeBoundaryAspect);
|
||||
replaceAspectWithOwn (aReplaceMap, SeenLineAspect);
|
||||
replaceAspectWithOwn (aReplaceMap, FaceBoundaryAspect);
|
||||
replaceAspectWithOwn (aReplaceMap, PointAspect);
|
||||
|
||||
replaceAspects (aReplaceMap);
|
||||
TColStd_ListIteratorOfListOfInteger It(LL);
|
||||
for(;It.More();It.Next()){
|
||||
if(It.Value()==aMode)
|
||||
return Standard_True;}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//==================================================
|
||||
@@ -377,7 +352,11 @@ bool AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
|
||||
bool toRecompute = false;
|
||||
toRecompute = theDrawer->SetupOwnShadingAspect() || toRecompute;
|
||||
toRecompute = theDrawer->SetOwnLineAspects() || toRecompute;
|
||||
toRecompute = theDrawer->SetupOwnPointAspect() || toRecompute;
|
||||
|
||||
if (theDrawer->SetupOwnPointAspect())
|
||||
{
|
||||
toRecompute = true;
|
||||
}
|
||||
|
||||
// override color
|
||||
theDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
|
||||
@@ -401,17 +380,52 @@ void AIS_Shape::SetColor (const Quantity_Color& theColor)
|
||||
const bool toRecompute = setColor (myDrawer, theColor);
|
||||
myDrawer->SetColor (theColor);
|
||||
hasOwnColor = Standard_True;
|
||||
|
||||
if (!toRecompute
|
||||
|| !myDrawer->HasLink())
|
||||
if (!toRecompute)
|
||||
{
|
||||
myToRecomputeModes.Clear();
|
||||
myRecomputeEveryPrs = false;
|
||||
SynchronizeAspects();
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAspect = myDrawer->ShadingAspect()->Aspect();
|
||||
Handle(Graphic3d_AspectLine3d) aLineAspect = myDrawer->LineAspect()->Aspect();
|
||||
Handle(Graphic3d_AspectMarker3d) aPointAspect = myDrawer->PointAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
replaceWithNewOwnAspects();
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_Shaded)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
|
||||
// Check if aspect of given type is set for the group,
|
||||
// because setting aspect for group with no already set aspect
|
||||
// can lead to loss of presentation data
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAspect);
|
||||
}
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (aLineAspect);
|
||||
}
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_MARKER))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (aPointAspect);
|
||||
}
|
||||
}
|
||||
}
|
||||
recomputeComputed();
|
||||
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
LoadRecomputable (2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -423,27 +437,23 @@ void AIS_Shape::UnsetColor()
|
||||
{
|
||||
if (!HasColor())
|
||||
{
|
||||
myToRecomputeModes.Clear();
|
||||
myRecomputeEveryPrs = false;
|
||||
return;
|
||||
}
|
||||
|
||||
hasOwnColor = Standard_False;
|
||||
myDrawer->SetColor (myDrawer->HasLink() ? myDrawer->Link()->Color() : Quantity_Color (Quantity_NOC_WHITE));
|
||||
|
||||
Graphic3d_MapOfAspectsToAspects aReplaceMap;
|
||||
if (!HasWidth())
|
||||
{
|
||||
replaceAspectWithDef (aReplaceMap, LineAspect);
|
||||
replaceAspectWithDef (aReplaceMap, WireAspect);
|
||||
replaceAspectWithDef (aReplaceMap, FreeBoundaryAspect);
|
||||
replaceAspectWithDef (aReplaceMap, UnFreeBoundaryAspect);
|
||||
replaceAspectWithDef (aReplaceMap, SeenLineAspect);
|
||||
replaceAspectWithDef (aReplaceMap, FaceBoundaryAspect);
|
||||
myDrawer->SetLineAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetWireAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetFreeBoundaryAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetUnFreeBoundaryAspect(Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetSeenLineAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetFaceBoundaryAspect (Handle(Prs3d_LineAspect)());
|
||||
Handle(Prs3d_LineAspect) anEmptyAsp;
|
||||
myDrawer->SetLineAspect (anEmptyAsp);
|
||||
myDrawer->SetWireAspect (anEmptyAsp);
|
||||
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
|
||||
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
|
||||
myDrawer->SetSeenLineAspect (anEmptyAsp);
|
||||
myDrawer->SetFaceBoundaryAspect (anEmptyAsp);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -525,17 +535,10 @@ void AIS_Shape::UnsetColor()
|
||||
}
|
||||
else
|
||||
{
|
||||
replaceAspectWithDef (aReplaceMap, ShadingAspect);
|
||||
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
|
||||
}
|
||||
if (myDrawer->HasOwnPointAspect())
|
||||
{
|
||||
replaceAspectWithDef (aReplaceMap, PointAspect);
|
||||
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
|
||||
}
|
||||
replaceAspects (aReplaceMap);
|
||||
SynchronizeAspects();
|
||||
recomputeComputed();
|
||||
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
|
||||
myRecomputeEveryPrs = true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -565,18 +568,17 @@ bool AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
|
||||
|
||||
void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
|
||||
{
|
||||
myOwnWidth = (Standard_ShortReal )theLineWidth;
|
||||
|
||||
if (!setWidth (myDrawer, theLineWidth)
|
||||
|| !myDrawer->HasLink())
|
||||
myOwnWidth = theLineWidth;
|
||||
if (setWidth (myDrawer, theLineWidth))
|
||||
{
|
||||
SynchronizeAspects();
|
||||
myRecomputeEveryPrs = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
replaceWithNewOwnAspects();
|
||||
myRecomputeEveryPrs = false;
|
||||
myToRecomputeModes.Clear();
|
||||
SynchronizeAspects();
|
||||
}
|
||||
recomputeComputed();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -586,28 +588,24 @@ void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
|
||||
|
||||
void AIS_Shape::UnsetWidth()
|
||||
{
|
||||
if (myOwnWidth == 0.0f)
|
||||
if (myOwnWidth == 0.0)
|
||||
{
|
||||
myToRecomputeModes.Clear();
|
||||
myRecomputeEveryPrs = false;
|
||||
return;
|
||||
}
|
||||
|
||||
myOwnWidth = 0.0f;
|
||||
myOwnWidth = 0.0;
|
||||
if (!HasColor())
|
||||
{
|
||||
Graphic3d_MapOfAspectsToAspects aReplaceMap;
|
||||
replaceAspectWithDef (aReplaceMap, LineAspect);
|
||||
replaceAspectWithDef (aReplaceMap, WireAspect);
|
||||
replaceAspectWithDef (aReplaceMap, FreeBoundaryAspect);
|
||||
replaceAspectWithDef (aReplaceMap, UnFreeBoundaryAspect);
|
||||
replaceAspectWithDef (aReplaceMap, SeenLineAspect);
|
||||
replaceAspectWithDef (aReplaceMap, FaceBoundaryAspect);
|
||||
myDrawer->SetLineAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetWireAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetFreeBoundaryAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetUnFreeBoundaryAspect(Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetSeenLineAspect (Handle(Prs3d_LineAspect)());
|
||||
myDrawer->SetFaceBoundaryAspect (Handle(Prs3d_LineAspect)());
|
||||
replaceAspects (aReplaceMap);
|
||||
const Handle(Prs3d_LineAspect) anEmptyAsp;
|
||||
myDrawer->SetLineAspect (anEmptyAsp);
|
||||
myDrawer->SetWireAspect (anEmptyAsp);
|
||||
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
|
||||
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
|
||||
myDrawer->SetSeenLineAspect (anEmptyAsp);
|
||||
myDrawer->SetFaceBoundaryAspect (anEmptyAsp);
|
||||
myRecomputeEveryPrs = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -624,8 +622,9 @@ void AIS_Shape::UnsetWidth()
|
||||
myDrawer->FaceBoundaryAspect() ->SetWidth (myDrawer->HasLink() ?
|
||||
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_FaceBoundary) : 1.);
|
||||
SynchronizeAspects();
|
||||
myToRecomputeModes.Clear();
|
||||
myRecomputeEveryPrs = false;
|
||||
}
|
||||
recomputeComputed();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -660,19 +659,37 @@ void AIS_Shape::setMaterial (const Handle(Prs3d_Drawer)& theDrawer,
|
||||
|
||||
void AIS_Shape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
|
||||
{
|
||||
const bool toRecompute = !myDrawer->HasOwnShadingAspect();
|
||||
setMaterial (myDrawer, theMat, HasColor(), IsTransparent());
|
||||
hasOwnMaterial = Standard_True;
|
||||
|
||||
if (!toRecompute
|
||||
|| !myDrawer->HasLink())
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
SynchronizeAspects();
|
||||
}
|
||||
else
|
||||
{
|
||||
replaceWithNewOwnAspects();
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_Shaded)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
|
||||
// Check if aspect of given type is set for the group,
|
||||
// because setting aspect for group with no already set aspect
|
||||
// can lead to loss of presentation data
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -705,15 +722,37 @@ void AIS_Shape::UnsetMaterial()
|
||||
myDrawer->ShadingAspect()->SetColor (myDrawer->Color(), myCurrentFacingModel);
|
||||
myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
|
||||
}
|
||||
SynchronizeAspects();
|
||||
}
|
||||
else
|
||||
{
|
||||
Graphic3d_MapOfAspectsToAspects aReplaceMap;
|
||||
replaceAspectWithDef (aReplaceMap, ShadingAspect);
|
||||
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
|
||||
replaceAspects (aReplaceMap);
|
||||
}
|
||||
hasOwnMaterial = Standard_False;
|
||||
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_Shaded)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -736,19 +775,33 @@ void AIS_Shape::setTransparency (const Handle(Prs3d_Drawer)& theDrawer,
|
||||
|
||||
void AIS_Shape::SetTransparency (const Standard_Real theValue)
|
||||
{
|
||||
const bool toRecompute = !myDrawer->HasOwnShadingAspect();
|
||||
setTransparency (myDrawer, theValue);
|
||||
myDrawer->SetTransparency ((Standard_ShortReal )theValue);
|
||||
|
||||
if (!toRecompute
|
||||
|| !myDrawer->HasLink())
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
SynchronizeAspects();
|
||||
}
|
||||
else
|
||||
{
|
||||
replaceWithNewOwnAspects();
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_Shaded)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myRecomputeEveryPrs = Standard_False; // no mode to recalculate - only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -768,15 +821,48 @@ void AIS_Shape::UnsetTransparency()
|
||||
|| myDrawer->ShadingAspect()->Aspect()->ToMapTexture())
|
||||
{
|
||||
myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
else
|
||||
{
|
||||
Graphic3d_MapOfAspectsToAspects aReplaceMap;
|
||||
replaceAspectWithDef (aReplaceMap, ShadingAspect);
|
||||
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
|
||||
replaceAspects (aReplaceMap);
|
||||
}
|
||||
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_Shaded)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LoadRecomputable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_Shape::LoadRecomputable(const Standard_Integer TheMode)
|
||||
{
|
||||
myRecomputeEveryPrs = Standard_False;
|
||||
if(!IsInList(myToRecomputeModes,TheMode))
|
||||
myToRecomputeModes.Append(TheMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -865,7 +951,8 @@ Standard_Boolean AIS_Shape::SetOwnHLRDeviationAngle ()
|
||||
void AIS_Shape::SetOwnDeviationCoefficient ( const Standard_Real aCoefficient )
|
||||
{
|
||||
myDrawer->SetDeviationCoefficient( aCoefficient );
|
||||
SetToUpdate();
|
||||
SetToUpdate(0) ; // WireFrame
|
||||
SetToUpdate(1) ; // Shadding
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -884,10 +971,11 @@ void AIS_Shape::SetOwnHLRDeviationCoefficient ( const Standard_Real aCoefficien
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_Shape::SetOwnDeviationAngle (const Standard_Real theAngle)
|
||||
void AIS_Shape::SetOwnDeviationAngle ( const Standard_Real anAngle )
|
||||
{
|
||||
myDrawer->SetDeviationAngle (theAngle);
|
||||
SetToUpdate (AIS_WireFrame);
|
||||
|
||||
myDrawer->SetDeviationAngle(anAngle );
|
||||
SetToUpdate(0) ; // WireFrame
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetOwnDeviationAngle
|
||||
@@ -901,7 +989,8 @@ void AIS_Shape::SetAngleAndDeviation ( const Standard_Real anAngle )
|
||||
SetOwnDeviationAngle(anAngle) ;
|
||||
SetOwnDeviationCoefficient(OutDefl) ;
|
||||
myInitAng = anAngle;
|
||||
SetToUpdate();
|
||||
SetToUpdate(0);
|
||||
SetToUpdate(1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -302,6 +302,8 @@ protected:
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void LoadRecomputable (const Standard_Integer TheMode);
|
||||
|
||||
//! Create own aspects (if they do not exist) and set color to them.
|
||||
//! @return TRUE if new aspects have been created
|
||||
Standard_EXPORT bool setColor (const Handle(Prs3d_Drawer)& theDrawer, const Quantity_Color& theColor) const;
|
||||
@@ -314,9 +316,6 @@ protected:
|
||||
|
||||
Standard_EXPORT void setMaterial (const Handle(Prs3d_Drawer)& theDrawer, const Graphic3d_MaterialAspect& theMaterial, const Standard_Boolean theToKeepColor, const Standard_Boolean theToKeepTransp) const;
|
||||
|
||||
//! Replace aspects of already computed groups from drawer link by the new own value.
|
||||
Standard_EXPORT void replaceWithNewOwnAspects();
|
||||
|
||||
public:
|
||||
|
||||
//! Compute HLR presentation for specified shape.
|
||||
|
@@ -57,7 +57,6 @@ void AIS_TextLabel::SetColor (const Quantity_Color& theColor)
|
||||
hasOwnColor = Standard_True;
|
||||
myDrawer->SetColor (theColor);
|
||||
myDrawer->TextAspect()->SetColor (theColor);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -75,7 +74,6 @@ void AIS_TextLabel::SetTransparency (const Standard_Real theValue)
|
||||
myDrawer->TextAspect()->Aspect()->SetColor (aTextColor);
|
||||
myDrawer->TextAspect()->Aspect()->SetColorSubTitle (aSubColor);
|
||||
myDrawer->SetTransparency (Standard_ShortReal(theValue));
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -218,6 +218,36 @@ void AIS_TexturedShape::SetColor (const Quantity_Color& theColor)
|
||||
void AIS_TexturedShape::UnsetColor()
|
||||
{
|
||||
AIS_Shape::UnsetColor();
|
||||
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= Presentations().Length(); ++aPrsIt)
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = Presentations().Value (aPrsIt);
|
||||
|
||||
if (aPrsModed.Mode() != 3)
|
||||
continue;
|
||||
|
||||
Handle(Prs3d_Presentation) aPrs = aPrsModed.Presentation()->Presentation();
|
||||
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs);
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->Link()->ShadingAspect()->Aspect();
|
||||
Handle(Graphic3d_AspectLine3d) aLineAsp = myDrawer->Link()->LineAspect()->Aspect();
|
||||
Quantity_Color aColor;
|
||||
AIS_GraphicTool::GetInteriorColor (myDrawer->Link(), aColor);
|
||||
anAreaAsp->SetInteriorColor (aColor);
|
||||
// Check if aspect of given type is set for the group,
|
||||
// because setting aspect for group with no already set aspect
|
||||
// can lead to loss of presentation data
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (aLineAsp);
|
||||
}
|
||||
|
||||
updateAttributes (aPrs);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -347,6 +377,10 @@ void AIS_TexturedShape::updateAttributes (const Handle(Prs3d_Presentation)& theP
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (thePrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
if (!aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
aGroup->SetGroupPrimitivesAspect (myAspect);
|
||||
}
|
||||
}
|
||||
@@ -425,7 +459,7 @@ void AIS_TexturedShape::Compute (const Handle(PrsMgr_PresentationManager3d)& /*t
|
||||
updateAttributes (thePrs);
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout << "AIS_TexturedShape::Compute() in ShadingMode failed \n";
|
||||
|
@@ -108,9 +108,15 @@ void AIS_Triangulation::updatePresentation()
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myRecomputeEveryPrs = Standard_False; // no mode to recalculate - only viewer update
|
||||
myToRecomputeModes.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -85,7 +85,7 @@ AIS_Trihedron::AIS_Trihedron (const Handle(Geom_Axis2Placement)& theComponent)
|
||||
void AIS_Trihedron::SetComponent (const Handle(Geom_Axis2Placement)& theComponent)
|
||||
{
|
||||
myComponent = theComponent;
|
||||
SetToUpdate();
|
||||
LoadRecomputable (AIS_WireFrame);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -135,8 +135,7 @@ void AIS_Trihedron::SetSize(const Standard_Real aValue)
|
||||
setOwnDatumAspect();
|
||||
myDrawer->DatumAspect()->SetAxisLength(aValue, aValue, aValue);
|
||||
|
||||
SetToUpdate();
|
||||
UpdatePresentations();
|
||||
Update();
|
||||
UpdateSelection();
|
||||
}
|
||||
|
||||
@@ -163,8 +162,7 @@ void AIS_Trihedron::UnsetSize()
|
||||
}
|
||||
else
|
||||
{
|
||||
SetToUpdate();
|
||||
UpdatePresentations();
|
||||
Update();
|
||||
}
|
||||
UpdateSelection();
|
||||
}
|
||||
@@ -562,6 +560,19 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LoadRecomputable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Trihedron::LoadRecomputable (const Standard_Integer theMode)
|
||||
{
|
||||
myRecomputeEveryPrs = Standard_False;
|
||||
if (!myToRecomputeModes.Contains (theMode))
|
||||
{
|
||||
myToRecomputeModes.Append (theMode);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetColor
|
||||
//purpose :
|
||||
|
@@ -224,6 +224,8 @@ protected:
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT void LoadRecomputable (const Standard_Integer theMode);
|
||||
|
||||
//! Creates a sensitive entity for the datum part that will be used in selection owner creation.
|
||||
Standard_EXPORT Handle(SelectBasics_SensitiveEntity) createSensitiveEntity (const Prs3d_DatumParts thePart,
|
||||
const Handle(SelectBasics_EntityOwner)& theOwner) const;
|
||||
|
@@ -2,6 +2,7 @@ AIS.cxx
|
||||
AIS.hxx
|
||||
AIS_Animation.cxx
|
||||
AIS_Animation.hxx
|
||||
AIS_AnimationTimer.cxx
|
||||
AIS_AnimationTimer.hxx
|
||||
AIS_AnimationCamera.cxx
|
||||
AIS_AnimationCamera.hxx
|
||||
@@ -104,8 +105,6 @@ AIS_MapIteratorOfMapOfInteractive.hxx
|
||||
AIS_MapOfInteractive.hxx
|
||||
AIS_MaxRadiusDimension.cxx
|
||||
AIS_MaxRadiusDimension.hxx
|
||||
AIS_MediaPlayer.cxx
|
||||
AIS_MediaPlayer.hxx
|
||||
AIS_MidPointRelation.cxx
|
||||
AIS_MidPointRelation.hxx
|
||||
AIS_MidPointRelation.lxx
|
||||
|
@@ -487,7 +487,7 @@ void AppBlend_AppSurf::InternalPerform(const Handle(TheLine)& Lin,
|
||||
try {
|
||||
Variation.Approximate();
|
||||
}
|
||||
catch (Standard_Failure const&) {
|
||||
catch (Standard_Failure) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -34,14 +34,14 @@
|
||||
//=======================================================================
|
||||
|
||||
Approx_ComputeCLine::Approx_ComputeCLine
|
||||
(const MultiLine& Line,
|
||||
const Standard_Integer degreemin,
|
||||
const Standard_Integer degreemax,
|
||||
const Standard_Real Tolerance3d,
|
||||
const Standard_Real Tolerance2d,
|
||||
const Standard_Boolean cutting,
|
||||
const AppParCurves_Constraint FirstC,
|
||||
const AppParCurves_Constraint LastC)
|
||||
(const MultiLine& Line,
|
||||
const Standard_Integer degreemin,
|
||||
const Standard_Integer degreemax,
|
||||
const Standard_Real Tolerance3d,
|
||||
const Standard_Real Tolerance2d,
|
||||
const Standard_Boolean cutting,
|
||||
const AppParCurves_Constraint FirstC,
|
||||
const AppParCurves_Constraint LastC)
|
||||
{
|
||||
mydegremin = degreemin;
|
||||
mydegremax = degreemax;
|
||||
@@ -61,13 +61,13 @@ const AppParCurves_Constraint LastC)
|
||||
//=======================================================================
|
||||
|
||||
Approx_ComputeCLine::Approx_ComputeCLine
|
||||
(const Standard_Integer degreemin,
|
||||
const Standard_Integer degreemax,
|
||||
const Standard_Real Tolerance3d,
|
||||
const Standard_Real Tolerance2d,
|
||||
const Standard_Boolean cutting,
|
||||
const AppParCurves_Constraint FirstC,
|
||||
const AppParCurves_Constraint LastC)
|
||||
(const Standard_Integer degreemin,
|
||||
const Standard_Integer degreemax,
|
||||
const Standard_Real Tolerance3d,
|
||||
const Standard_Real Tolerance2d,
|
||||
const Standard_Boolean cutting,
|
||||
const AppParCurves_Constraint FirstC,
|
||||
const AppParCurves_Constraint LastC)
|
||||
{
|
||||
alldone = Standard_False;
|
||||
mydegremin = degreemin;
|
||||
@@ -88,22 +88,21 @@ const AppParCurves_Constraint LastC)
|
||||
void Approx_ComputeCLine::Perform(const MultiLine& Line)
|
||||
{
|
||||
Standard_Real UFirst, ULast;
|
||||
Standard_Boolean Finish = Standard_False,
|
||||
begin = Standard_True, Ok = Standard_False;
|
||||
Standard_Boolean Finish = Standard_False,
|
||||
begin = Standard_True, Ok = Standard_False;
|
||||
Standard_Real thetol3d = Precision::Confusion(), thetol2d = Precision::Confusion();
|
||||
UFirst = Line.FirstParameter();
|
||||
ULast = Line.LastParameter();
|
||||
Standard_Real TolU = Max((ULast - UFirst)*1.e-03, Precision::Confusion());
|
||||
Standard_Real myfirstU = UFirst;
|
||||
ULast = Line.LastParameter();
|
||||
Standard_Real TolU = Max((ULast-UFirst)*1.e-05, Precision::PApproximation());
|
||||
Standard_Real myfirstU = UFirst;
|
||||
Standard_Real mylastU = ULast;
|
||||
Standard_Integer aMaxSegments = 0;
|
||||
Standard_Integer aMaxSegments1 = myMaxSegments - 1;
|
||||
Standard_Integer aNbCut = 0, aNbImp = 0, aNbComp = 5;
|
||||
|
||||
if (!mycut)
|
||||
{
|
||||
alldone = Compute(Line, UFirst, ULast, thetol3d, thetol2d);
|
||||
if (!alldone)
|
||||
if (!alldone)
|
||||
{
|
||||
tolreached = Standard_False;
|
||||
myfirstparam.Append(UFirst);
|
||||
@@ -113,27 +112,25 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
|
||||
Tolers2d.Append(currenttol2d);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
|
||||
// previous decision to be taken if we get worse with next cut (eap)
|
||||
AppParCurves_MultiCurve KeptMultiCurve;
|
||||
Standard_Real KeptUfirst = 0., KeptUlast = 0., KeptT3d = RealLast(), KeptT2d = 0.;
|
||||
|
||||
while (!Finish)
|
||||
while (!Finish)
|
||||
{
|
||||
|
||||
|
||||
// Gestion du decoupage de la multiline pour approximer:
|
||||
if (!begin)
|
||||
if (!begin)
|
||||
{
|
||||
if (Ok)
|
||||
if (Ok)
|
||||
{
|
||||
// Calcul de la partie a approximer.
|
||||
myfirstU = mylastU;
|
||||
mylastU = ULast;
|
||||
aNbCut = 0;
|
||||
aNbImp = 0;
|
||||
if (Abs(ULast - myfirstU) <= RealEpsilon()
|
||||
mylastU = ULast;
|
||||
if (Abs(ULast-myfirstU) <= RealEpsilon()
|
||||
|| aMaxSegments >= myMaxSegments)
|
||||
{
|
||||
Finish = Standard_True;
|
||||
@@ -150,60 +147,51 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
|
||||
if ((thetol3d + thetol2d) < (KeptT3d + KeptT2d))
|
||||
{
|
||||
KeptMultiCurve = TheMultiCurve;
|
||||
KeptUfirst = myfirstU;
|
||||
KeptUlast = mylastU;
|
||||
KeptT3d = thetol3d;
|
||||
KeptT2d = thetol2d;
|
||||
aNbImp++;
|
||||
KeptUfirst = myfirstU;
|
||||
KeptUlast = mylastU;
|
||||
KeptT3d = thetol3d;
|
||||
KeptT2d = thetol2d;
|
||||
}
|
||||
|
||||
// cut an interval
|
||||
mylastU = (myfirstU + mylastU) / 2;
|
||||
aNbCut++;
|
||||
mylastU = (myfirstU + mylastU)/2;
|
||||
}
|
||||
}
|
||||
|
||||
// Calcul des parametres sur ce nouvel intervalle.
|
||||
Ok = Compute(Line, myfirstU, mylastU, thetol3d, thetol2d);
|
||||
if (Ok)
|
||||
if(Ok)
|
||||
{
|
||||
aMaxSegments++;
|
||||
}
|
||||
|
||||
//cout << myfirstU << " - " << mylastU << " tol : " << thetol3d << " " << thetol2d << endl;
|
||||
Standard_Boolean aStopCutting = Standard_False;
|
||||
if (aNbCut >= aNbComp)
|
||||
{
|
||||
if (aNbCut > aNbImp)
|
||||
{
|
||||
aStopCutting = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
// is new decision better?
|
||||
if (!Ok && (Abs(myfirstU - mylastU) <= TolU || aMaxSegments >= aMaxSegments1 || aStopCutting ))
|
||||
if (!Ok && (Abs(myfirstU-mylastU) <= TolU || aMaxSegments >= aMaxSegments1))
|
||||
{
|
||||
Ok = Standard_True; // stop interval cutting, approx the rest part
|
||||
Ok = Standard_True; // stop interval cutting, approx the rest part
|
||||
|
||||
if ((thetol3d + thetol2d) < (KeptT3d + KeptT2d))
|
||||
{
|
||||
KeptMultiCurve = TheMultiCurve;
|
||||
KeptUfirst = myfirstU;
|
||||
KeptUlast = mylastU;
|
||||
KeptT3d = thetol3d;
|
||||
KeptT2d = thetol2d;
|
||||
if ((thetol3d + thetol2d) < (KeptT3d + KeptT2d))
|
||||
{
|
||||
KeptMultiCurve = TheMultiCurve;
|
||||
KeptUfirst = myfirstU;
|
||||
KeptUlast = mylastU;
|
||||
KeptT3d = thetol3d;
|
||||
KeptT2d = thetol2d;
|
||||
}
|
||||
|
||||
mylastU = KeptUlast;
|
||||
|
||||
tolreached = Standard_False; // helas
|
||||
myMultiCurves.Append(KeptMultiCurve);
|
||||
aMaxSegments++;
|
||||
Tolers3d.Append (KeptT3d);
|
||||
Tolers2d.Append (KeptT2d);
|
||||
myfirstparam.Append (KeptUfirst);
|
||||
mylastparam.Append (KeptUlast);
|
||||
}
|
||||
|
||||
mylastU = KeptUlast;
|
||||
|
||||
tolreached = Standard_False; // helas
|
||||
myMultiCurves.Append(KeptMultiCurve);
|
||||
aMaxSegments++;
|
||||
Tolers3d.Append(KeptT3d);
|
||||
Tolers2d.Append(KeptT2d);
|
||||
myfirstparam.Append(KeptUfirst);
|
||||
mylastparam.Append(KeptUlast);
|
||||
}
|
||||
|
||||
begin = Standard_False;
|
||||
} // while (!Finish)
|
||||
}
|
||||
@@ -237,10 +225,10 @@ const
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Approx_ComputeCLine::Compute(const MultiLine& Line,
|
||||
const Standard_Real Ufirst,
|
||||
const Standard_Real Ulast,
|
||||
Standard_Real& TheTol3d,
|
||||
Standard_Real& TheTol2d)
|
||||
const Standard_Real Ufirst,
|
||||
const Standard_Real Ulast,
|
||||
Standard_Real& TheTol3d,
|
||||
Standard_Real& TheTol2d)
|
||||
{
|
||||
|
||||
|
||||
@@ -255,14 +243,14 @@ Standard_Boolean Approx_ComputeCLine::Compute(const MultiLine& Line,
|
||||
if (mydone) {
|
||||
LSquare.Error(Fv, TheTol3d, TheTol2d);
|
||||
if (TheTol3d <= mytol3d && TheTol2d <= mytol2d) {
|
||||
// Stockage de la multicurve approximee.
|
||||
tolreached = Standard_True;
|
||||
// Stockage de la multicurve approximee.
|
||||
tolreached = Standard_True;
|
||||
myMultiCurves.Append(LSquare.Value());
|
||||
myfirstparam.Append(Ufirst);
|
||||
mylastparam.Append(Ulast);
|
||||
Tolers3d.Append(TheTol3d);
|
||||
Tolers2d.Append(TheTol2d);
|
||||
return Standard_True;
|
||||
myfirstparam.Append(Ufirst);
|
||||
mylastparam.Append(Ulast);
|
||||
Tolers3d.Append(TheTol3d);
|
||||
Tolers2d.Append(TheTol2d);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
if (deg == mydegremax) {
|
||||
@@ -270,7 +258,7 @@ Standard_Boolean Approx_ComputeCLine::Compute(const MultiLine& Line,
|
||||
currenttol3d = TheTol3d;
|
||||
currenttol2d = TheTol2d;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -282,11 +270,11 @@ Standard_Boolean Approx_ComputeCLine::Compute(const MultiLine& Line,
|
||||
//=======================================================================
|
||||
|
||||
void Approx_ComputeCLine::Parameters(const Standard_Integer Index,
|
||||
Standard_Real& firstpar,
|
||||
Standard_Real& lastpar) const
|
||||
Standard_Real& firstpar,
|
||||
Standard_Real& lastpar) const
|
||||
{
|
||||
firstpar = myfirstparam.Value(Index);
|
||||
lastpar = mylastparam.Value(Index);
|
||||
lastpar = mylastparam.Value(Index);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -295,7 +283,7 @@ void Approx_ComputeCLine::Parameters(const Standard_Integer Index,
|
||||
//=======================================================================
|
||||
|
||||
void Approx_ComputeCLine::SetDegrees(const Standard_Integer degreemin,
|
||||
const Standard_Integer degreemax)
|
||||
const Standard_Integer degreemax)
|
||||
{
|
||||
mydegremin = degreemin;
|
||||
mydegremax = degreemax;
|
||||
@@ -307,7 +295,7 @@ void Approx_ComputeCLine::SetDegrees(const Standard_Integer degreemin,
|
||||
//=======================================================================
|
||||
|
||||
void Approx_ComputeCLine::SetTolerances(const Standard_Real Tolerance3d,
|
||||
const Standard_Real Tolerance2d)
|
||||
const Standard_Real Tolerance2d)
|
||||
{
|
||||
mytol3d = Tolerance3d;
|
||||
mytol2d = Tolerance2d;
|
||||
@@ -319,10 +307,10 @@ void Approx_ComputeCLine::SetTolerances(const Standard_Real Tolerance3d,
|
||||
//=======================================================================
|
||||
|
||||
void Approx_ComputeCLine::SetConstraints(const AppParCurves_Constraint FirstC,
|
||||
const AppParCurves_Constraint LastC)
|
||||
const AppParCurves_Constraint LastC)
|
||||
{
|
||||
myfirstC = FirstC;
|
||||
mylastC = LastC;
|
||||
mylastC = LastC;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -330,7 +318,7 @@ void Approx_ComputeCLine::SetConstraints(const AppParCurves_Constraint FirstC,
|
||||
//purpose : Changes the max number of segments, which is allowed for cutting.
|
||||
//=======================================================================
|
||||
|
||||
void Approx_ComputeCLine::SetMaxSegments(const Standard_Integer theMaxSegments)
|
||||
void Approx_ComputeCLine:: SetMaxSegments(const Standard_Integer theMaxSegments)
|
||||
{
|
||||
myMaxSegments = theMaxSegments;
|
||||
}
|
||||
@@ -363,8 +351,8 @@ const {
|
||||
//=======================================================================
|
||||
|
||||
void Approx_ComputeCLine::Error(const Standard_Integer Index,
|
||||
Standard_Real& tol3d,
|
||||
Standard_Real& tol2d) const
|
||||
Standard_Real& tol3d,
|
||||
Standard_Real& tol2d) const
|
||||
{
|
||||
tol3d = Tolers3d.Value(Index);
|
||||
tol2d = Tolers2d.Value(Index);
|
||||
|
@@ -163,21 +163,12 @@ void Approx_SweepApproximation::Perform(const Standard_Real First,
|
||||
myDWeigths = new (TColStd_HArray1OfReal)(1, Num3DSS);
|
||||
myD2Weigths = new (TColStd_HArray1OfReal)(1, Num3DSS);
|
||||
|
||||
if (Num2DSS>0)
|
||||
{
|
||||
if (Num2DSS>0) {
|
||||
myPoles2d = new (TColgp_HArray1OfPnt2d)(1, Num2DSS);
|
||||
myDPoles2d = new (TColgp_HArray1OfVec2d)(1, Num2DSS);
|
||||
myD2Poles2d = new (TColgp_HArray1OfVec2d)(1, Num2DSS);
|
||||
COnSurfErr = new (TColStd_HArray1OfReal)(1, Num2DSS);
|
||||
}
|
||||
else
|
||||
{
|
||||
myPoles2d = new TColgp_HArray1OfPnt2d();
|
||||
myDPoles2d = new TColgp_HArray1OfVec2d();
|
||||
myD2Poles2d = new TColgp_HArray1OfVec2d();
|
||||
COnSurfErr = new TColStd_HArray1OfReal();
|
||||
}
|
||||
|
||||
// Checks if myFunc->D2 is implemented
|
||||
if (continuity >= GeomAbs_C2) {
|
||||
Standard_Boolean B;
|
||||
|
@@ -30,8 +30,6 @@
|
||||
#include <Aspect_TypeOfResize.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Aspect_Drawable.hxx>
|
||||
|
||||
class Aspect_DisplayConnection;
|
||||
class Aspect_WindowDefinitionError;
|
||||
class Aspect_WindowError;
|
||||
class Aspect_Background;
|
||||
@@ -45,80 +43,70 @@ class Aspect_Window : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Modifies the window background.
|
||||
Standard_EXPORT void SetBackground (const Aspect_Background& ABack);
|
||||
|
||||
//! Modifies the window background.
|
||||
Standard_EXPORT void SetBackground (const Quantity_Color& color);
|
||||
|
||||
|
||||
//! Modifies the window gradient background.
|
||||
Standard_EXPORT void SetBackground (const Aspect_GradientBackground& ABackground);
|
||||
|
||||
|
||||
//! Modifies the window gradient background.
|
||||
Standard_EXPORT void SetBackground (const Quantity_Color& theFirstColor, const Quantity_Color& theSecondColor, const Aspect_GradientFillMethod theFillMethod);
|
||||
|
||||
|
||||
//! Opens the window <me>.
|
||||
Standard_EXPORT virtual void Map() const = 0;
|
||||
|
||||
|
||||
//! Closes the window <me>.
|
||||
Standard_EXPORT virtual void Unmap() const = 0;
|
||||
|
||||
|
||||
//! Apply the resizing to the window <me>.
|
||||
Standard_EXPORT virtual Aspect_TypeOfResize DoResize() const = 0;
|
||||
|
||||
|
||||
//! Apply the mapping change to the window <me>.
|
||||
//! and returns TRUE if the window is mapped at screen.
|
||||
Standard_EXPORT virtual Standard_Boolean DoMapping() const = 0;
|
||||
|
||||
|
||||
//! Returns the window background.
|
||||
Standard_EXPORT Aspect_Background Background() const;
|
||||
|
||||
|
||||
//! Returns the current image background fill mode.
|
||||
Standard_EXPORT Aspect_FillMethod BackgroundFillMethod() const;
|
||||
|
||||
|
||||
//! Returns the window gradient background.
|
||||
Standard_EXPORT Aspect_GradientBackground GradientBackground() const;
|
||||
|
||||
|
||||
//! Returns True if the window <me> is opened
|
||||
//! and False if the window is closed.
|
||||
Standard_EXPORT virtual Standard_Boolean IsMapped() const = 0;
|
||||
|
||||
|
||||
//! Returns True if the window <me> is virtual
|
||||
Standard_EXPORT Standard_Boolean IsVirtual() const;
|
||||
|
||||
|
||||
//! Setup the virtual state
|
||||
Standard_EXPORT void SetVirtual (const Standard_Boolean theVirtual);
|
||||
|
||||
|
||||
//! Returns The Window RATIO equal to the physical
|
||||
//! WIDTH/HEIGHT dimensions
|
||||
Standard_EXPORT virtual Standard_Real Ratio() const = 0;
|
||||
|
||||
|
||||
//! Returns The Window POSITION in PIXEL
|
||||
Standard_EXPORT virtual void Position (Standard_Integer& X1, Standard_Integer& Y1, Standard_Integer& X2, Standard_Integer& Y2) const = 0;
|
||||
|
||||
|
||||
//! Returns The Window SIZE in PIXEL
|
||||
Standard_EXPORT virtual void Size (Standard_Integer& Width, Standard_Integer& Height) const = 0;
|
||||
|
||||
|
||||
//! Returns native Window handle (HWND on Windows, Window with Xlib, and so on)
|
||||
Standard_EXPORT virtual Aspect_Drawable NativeHandle() const = 0;
|
||||
|
||||
|
||||
//! Returns parent of native Window handle (HWND on Windows, Window with Xlib, and so on)
|
||||
Standard_EXPORT virtual Aspect_Drawable NativeParentHandle() const = 0;
|
||||
|
||||
//! Returns native Window FB config (GLXFBConfig on Xlib)
|
||||
Standard_EXPORT virtual Aspect_FBConfig NativeFBConfig() const = 0;
|
||||
|
||||
//! Invalidate entire window content.
|
||||
//!
|
||||
//! Implementation is expected to allow calling this method from non-GUI thread,
|
||||
//! e.g. by queuing exposure event into window message queue or in other thread-safe manner.
|
||||
//!
|
||||
//! Optional display argument should be passed when called from non-GUI thread
|
||||
//! on platforms implementing thread-unsafe connections to display.
|
||||
//! NULL can be passed instead otherwise.
|
||||
virtual void InvalidateContent (const Handle(Aspect_DisplayConnection)& theDisp) { (void )theDisp; }
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Aspect_Window,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
@@ -232,7 +232,7 @@ void BOPAlgo_ArgumentAnalyzer::Perform()
|
||||
TestCurveOnSurface();
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure const&) {
|
||||
catch(Standard_Failure) {
|
||||
BOPAlgo_CheckResult aResult;
|
||||
aResult.SetCheckStatus(BOPAlgo_CheckUnknown);
|
||||
myResult.Append(aResult);
|
||||
|
@@ -233,7 +233,7 @@ void BOPAlgo_Builder::PerformInternal(const BOPAlgo_PaveFiller& theFiller)
|
||||
PerformInternal1(theFiller);
|
||||
}
|
||||
//
|
||||
catch (Standard_Failure const&) {
|
||||
catch (Standard_Failure) {
|
||||
AddError (new BOPAlgo_AlertBuilderFailed);
|
||||
}
|
||||
}
|
||||
|
@@ -116,13 +116,33 @@ class BOPAlgo_PairOfShapeBoolean : public BOPAlgo_Algo {
|
||||
Handle(IntTools_Context) myContext;
|
||||
};
|
||||
//
|
||||
typedef NCollection_Vector<BOPAlgo_PairOfShapeBoolean> BOPAlgo_VectorOfPairOfShapeBoolean;
|
||||
|
||||
typedef NCollection_Vector<BOPAlgo_PairOfShapeBoolean> \
|
||||
BOPAlgo_VectorOfPairOfShapeBoolean;
|
||||
//
|
||||
typedef BOPTools_ContextFunctor
|
||||
<BOPAlgo_PairOfShapeBoolean,
|
||||
BOPAlgo_VectorOfPairOfShapeBoolean,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_BuilderSDFaceFunctor;
|
||||
//
|
||||
typedef BOPTools_ContextCnt
|
||||
<BOPAlgo_BuilderSDFaceFunctor,
|
||||
BOPAlgo_VectorOfPairOfShapeBoolean,
|
||||
Handle(IntTools_Context)> BOPAlgo_BuilderSDFaceCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
// BuilderFace
|
||||
//
|
||||
typedef NCollection_Vector<BOPAlgo_BuilderFace> BOPAlgo_VectorOfBuilderFace;
|
||||
|
||||
//
|
||||
typedef BOPTools_Functor
|
||||
<BOPAlgo_BuilderFace,
|
||||
BOPAlgo_VectorOfBuilderFace> BOPAlgo_BuilderFaceFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt
|
||||
<BOPAlgo_BuilderFaceFunctor,
|
||||
BOPAlgo_VectorOfBuilderFace> BOPAlgo_BuilderFaceCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_VFI
|
||||
//purpose :
|
||||
@@ -185,7 +205,18 @@ class BOPAlgo_VFI : public BOPAlgo_Algo {
|
||||
};
|
||||
//
|
||||
typedef NCollection_Vector<BOPAlgo_VFI> BOPAlgo_VectorOfVFI;
|
||||
|
||||
//
|
||||
typedef BOPTools_ContextFunctor
|
||||
<BOPAlgo_VFI,
|
||||
BOPAlgo_VectorOfVFI,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_VFIFunctor;
|
||||
//
|
||||
typedef BOPTools_ContextCnt
|
||||
<BOPAlgo_VFIFunctor,
|
||||
BOPAlgo_VectorOfVFI,
|
||||
Handle(IntTools_Context)> BOPAlgo_VFICnt;
|
||||
//
|
||||
//=======================================================================
|
||||
//function : FillImagesFaces
|
||||
//purpose :
|
||||
@@ -443,7 +474,7 @@ void BOPAlgo_Builder::BuildSplitFaces()
|
||||
}// for (i=0; i<aNbS; ++i) {
|
||||
//
|
||||
//===================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVBF);
|
||||
BOPAlgo_BuilderFaceCnt::Perform(myRunParallel, aVBF);
|
||||
//===================================================
|
||||
//
|
||||
Standard_Integer aNbBF = aVBF.Length();
|
||||
@@ -632,7 +663,7 @@ void BOPAlgo_Builder::FillSameDomainFaces()
|
||||
|
||||
//================================================================
|
||||
// Perform analysis
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVPSB, myContext);
|
||||
BOPAlgo_BuilderSDFaceCnt::Perform(myRunParallel, aVPSB, myContext);
|
||||
//================================================================
|
||||
|
||||
NCollection_List<TopTools_ListOfShape> aMBlocks(aAllocator);
|
||||
@@ -785,7 +816,7 @@ void BOPAlgo_Builder::FillInternalVertices()
|
||||
|
||||
// Perform classification
|
||||
//================================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVVFI, myContext);
|
||||
BOPAlgo_VFICnt::Perform(myRunParallel, aVVFI, myContext);
|
||||
//================================================================
|
||||
|
||||
Standard_Integer aNbVFI = aVVFI.Length();
|
||||
|
@@ -341,6 +341,13 @@ private:
|
||||
|
||||
// Vector of Solid Builders
|
||||
typedef NCollection_Vector<BOPAlgo_SplitSolid> BOPAlgo_VectorOfBuilderSolid;
|
||||
// Functors to split solids
|
||||
typedef BOPTools_Functor<BOPAlgo_SplitSolid,
|
||||
BOPAlgo_VectorOfBuilderSolid> BOPAlgo_BuilderSolidFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt<BOPAlgo_BuilderSolidFunctor,
|
||||
BOPAlgo_VectorOfBuilderSolid> BOPAlgo_BuilderSolidCnt;
|
||||
//=======================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : BuildSplitSolids
|
||||
@@ -440,7 +447,7 @@ void BOPAlgo_Builder::BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSol
|
||||
aNbBS=aVBS.Length();
|
||||
//
|
||||
//===================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVBS);
|
||||
BOPAlgo_BuilderSolidCnt::Perform(myRunParallel, aVBS);
|
||||
//===================================================
|
||||
//
|
||||
for (k = 0; k < aNbBS; ++k)
|
||||
|
@@ -102,7 +102,17 @@ class BOPAlgo_FaceSelfIntersect :
|
||||
|
||||
//=======================================================================
|
||||
|
||||
typedef NCollection_Vector<BOPAlgo_FaceSelfIntersect> BOPAlgo_VectorOfFaceSelfIntersect;
|
||||
typedef NCollection_Vector
|
||||
<BOPAlgo_FaceSelfIntersect> BOPAlgo_VectorOfFaceSelfIntersect;
|
||||
//
|
||||
typedef BOPTools_Functor
|
||||
<BOPAlgo_FaceSelfIntersect,
|
||||
BOPAlgo_VectorOfFaceSelfIntersect> BOPAlgo_FaceSelfIntersectFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt
|
||||
<BOPAlgo_FaceSelfIntersectFunctor,
|
||||
BOPAlgo_VectorOfFaceSelfIntersect> BOPAlgo_FaceSelfIntersectCnt;
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
@@ -196,7 +206,7 @@ void BOPAlgo_CheckerSI::Perform()
|
||||
PostTreat();
|
||||
}
|
||||
//
|
||||
catch (Standard_Failure const&) {
|
||||
catch (Standard_Failure) {
|
||||
AddError (new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
}
|
||||
@@ -437,7 +447,7 @@ void BOPAlgo_CheckerSI::CheckFaceSelfIntersection()
|
||||
|
||||
Standard_Integer aNbFace = aVFace.Length();
|
||||
//======================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVFace);
|
||||
BOPAlgo_FaceSelfIntersectCnt::Perform(myRunParallel, aVFace);
|
||||
//======================================================
|
||||
//
|
||||
for (Standard_Integer k = 0; k < aNbFace; k++)
|
||||
|
@@ -115,8 +115,19 @@ class BOPAlgo_VertexSolid {
|
||||
Handle(IntTools_Context) myContext;
|
||||
};
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPAlgo_VertexSolid> BOPAlgo_VectorOfVertexSolid;
|
||||
|
||||
typedef NCollection_Vector
|
||||
<BOPAlgo_VertexSolid> BOPAlgo_VectorOfVertexSolid;
|
||||
//
|
||||
typedef BOPTools_ContextFunctor
|
||||
<BOPAlgo_VertexSolid,
|
||||
BOPAlgo_VectorOfVertexSolid,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_VertexSolidFunctor;
|
||||
//
|
||||
typedef BOPTools_ContextCnt
|
||||
<BOPAlgo_VertexSolidFunctor,
|
||||
BOPAlgo_VectorOfVertexSolid,
|
||||
Handle(IntTools_Context)> BOPAlgo_VertexSolidCnt;
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_ShapeSolid
|
||||
@@ -174,8 +185,17 @@ class BOPAlgo_ShapeSolid {
|
||||
BOPDS_DS* myDS;
|
||||
};
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPAlgo_ShapeSolid> BOPAlgo_VectorOfShapeSolid;
|
||||
|
||||
typedef NCollection_Vector
|
||||
<BOPAlgo_ShapeSolid> BOPAlgo_VectorOfShapeSolid;
|
||||
//
|
||||
typedef BOPTools_Functor
|
||||
<BOPAlgo_ShapeSolid,
|
||||
BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt
|
||||
<BOPAlgo_ShapeSolidFunctor,
|
||||
BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidCnt;
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_SolidSolid
|
||||
@@ -205,7 +225,18 @@ class BOPAlgo_SolidSolid : public BOPAlgo_ShapeSolid {
|
||||
};
|
||||
};
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPAlgo_SolidSolid> BOPAlgo_VectorOfSolidSolid;
|
||||
typedef NCollection_Vector
|
||||
<BOPAlgo_SolidSolid> BOPAlgo_VectorOfSolidSolid;
|
||||
//
|
||||
typedef BOPTools_Functor
|
||||
<BOPAlgo_SolidSolid,
|
||||
BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt
|
||||
<BOPAlgo_SolidSolidFunctor,
|
||||
BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidCnt;
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformVZ
|
||||
@@ -255,7 +286,7 @@ void BOPAlgo_CheckerSI::PerformVZ()
|
||||
//
|
||||
aNbVVS=aVVS.Length();
|
||||
//=============================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVVS, myContext);
|
||||
BOPAlgo_VertexSolidCnt::Perform(myRunParallel, aVVS, myContext);
|
||||
//=============================================================
|
||||
for (k=0; k < aNbVVS; ++k) {
|
||||
const BOPAlgo_VertexSolid& aVertexSolid=aVVS(k);
|
||||
@@ -313,7 +344,7 @@ void BOPAlgo_CheckerSI::PerformZZ()
|
||||
//
|
||||
aNbSolidSolid=aVSolidSolid.Length();
|
||||
//======================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVSolidSolid);
|
||||
BOPAlgo_SolidSolidCnt::Perform(myRunParallel, aVSolidSolid);
|
||||
//======================================================
|
||||
//
|
||||
BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
|
||||
@@ -360,7 +391,7 @@ void BOPAlgo_CheckerSI::PerformSZ(const TopAbs_ShapeEnum aTS)
|
||||
//
|
||||
aNbShapeSolid=aVShapeSolid.Length();
|
||||
//======================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVShapeSolid);
|
||||
BOPAlgo_ShapeSolidCnt::Perform(myRunParallel, aVShapeSolid);
|
||||
//======================================================
|
||||
//
|
||||
BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
|
||||
|
@@ -223,7 +223,7 @@ void BOPAlgo_PaveFiller::Perform()
|
||||
PerformInternal();
|
||||
}
|
||||
//
|
||||
catch (Standard_Failure const&) {
|
||||
catch (Standard_Failure) {
|
||||
AddError (new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
}
|
||||
|
@@ -118,7 +118,7 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
|
||||
|
||||
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew, myFuzzyValue);
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
@@ -136,8 +136,20 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
|
||||
Handle(BOPDS_PaveBlock) myPB;
|
||||
};
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPAlgo_VertexEdge> BOPAlgo_VectorOfVertexEdge;
|
||||
|
||||
typedef NCollection_Vector
|
||||
<BOPAlgo_VertexEdge> BOPAlgo_VectorOfVertexEdge;
|
||||
//
|
||||
typedef BOPTools_ContextFunctor
|
||||
<BOPAlgo_VertexEdge,
|
||||
BOPAlgo_VectorOfVertexEdge,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_VertexEdgeFunctor;
|
||||
//
|
||||
typedef BOPTools_ContextCnt
|
||||
<BOPAlgo_VertexEdgeFunctor,
|
||||
BOPAlgo_VectorOfVertexEdge,
|
||||
Handle(IntTools_Context)> BOPAlgo_VertexEdgeCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
// function: PerformVE
|
||||
// purpose:
|
||||
@@ -259,7 +271,7 @@ void BOPAlgo_PaveFiller::IntersectVE
|
||||
//
|
||||
// Perform intersection
|
||||
//=============================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVVE, myContext);
|
||||
BOPAlgo_VertexEdgeCnt::Perform(myRunParallel, aVVE, myContext);
|
||||
//=============================================================
|
||||
//
|
||||
// Keep the modified edges for further update
|
||||
|
@@ -102,7 +102,7 @@ class BOPAlgo_EdgeEdge :
|
||||
|
||||
IntTools_EdgeEdge::Perform();
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
@@ -114,8 +114,18 @@ class BOPAlgo_EdgeEdge :
|
||||
};
|
||||
//
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPAlgo_EdgeEdge> BOPAlgo_VectorOfEdgeEdge;
|
||||
|
||||
typedef NCollection_Vector
|
||||
<BOPAlgo_EdgeEdge> BOPAlgo_VectorOfEdgeEdge;
|
||||
//
|
||||
typedef BOPTools_Functor
|
||||
<BOPAlgo_EdgeEdge,
|
||||
BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt
|
||||
<BOPAlgo_EdgeEdgeFunctor,
|
||||
BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeCnt;
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
// function: PerformEE
|
||||
// purpose:
|
||||
@@ -224,7 +234,7 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
//
|
||||
aNbEdgeEdge=aVEdgeEdge.Length();
|
||||
//======================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVEdgeEdge);
|
||||
BOPAlgo_EdgeEdgeCnt::Perform(myRunParallel, aVEdgeEdge);
|
||||
//======================================================
|
||||
//
|
||||
for (k = 0; k < aNbEdgeEdge; ++k) {
|
||||
@@ -1040,7 +1050,7 @@ void BOPAlgo_PaveFiller::ForceInterfEE()
|
||||
anAlloc->Reset();
|
||||
|
||||
// Perform intersection of the found pairs
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVEdgeEdge);
|
||||
BOPAlgo_EdgeEdgeCnt::Perform(myRunParallel, aVEdgeEdge);
|
||||
|
||||
BOPDS_VectorOfInterfEE& aEEs = myDS->InterfEE();
|
||||
if (aEEs.IsEmpty())
|
||||
|
@@ -114,7 +114,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
|
||||
|
||||
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew, myFuzzyValue);
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
@@ -132,8 +132,20 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
|
||||
Handle(IntTools_Context) myContext;
|
||||
};
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPAlgo_VertexFace> BOPAlgo_VectorOfVertexFace;
|
||||
|
||||
typedef NCollection_Vector<BOPAlgo_VertexFace>
|
||||
BOPAlgo_VectorOfVertexFace;
|
||||
//
|
||||
typedef BOPTools_ContextFunctor
|
||||
<BOPAlgo_VertexFace,
|
||||
BOPAlgo_VectorOfVertexFace,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_VertexFaceFunctor;
|
||||
//
|
||||
typedef BOPTools_ContextCnt
|
||||
<BOPAlgo_VertexFaceFunctor,
|
||||
BOPAlgo_VectorOfVertexFace,
|
||||
Handle(IntTools_Context)> BOPAlgo_VertexFaceCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
// function: PerformVF
|
||||
// purpose:
|
||||
@@ -222,7 +234,7 @@ void BOPAlgo_PaveFiller::PerformVF()
|
||||
//
|
||||
aNbVF=aVVF.Length();
|
||||
//================================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVVF, myContext);
|
||||
BOPAlgo_VertexFaceCnt::Perform(myRunParallel, aVVF, myContext);
|
||||
//================================================================
|
||||
//
|
||||
for (k=0; k < aNbVF; ++k) {
|
||||
|
@@ -113,7 +113,7 @@ class BOPAlgo_EdgeFace :
|
||||
|
||||
IntTools_EdgeFace::Perform();
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
@@ -128,7 +128,18 @@ class BOPAlgo_EdgeFace :
|
||||
//
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPAlgo_EdgeFace> BOPAlgo_VectorOfEdgeFace;
|
||||
|
||||
//
|
||||
typedef BOPTools_ContextFunctor
|
||||
<BOPAlgo_EdgeFace,
|
||||
BOPAlgo_VectorOfEdgeFace,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_EdgeFaceFunctor;
|
||||
//
|
||||
typedef BOPTools_ContextCnt
|
||||
<BOPAlgo_EdgeFaceFunctor,
|
||||
BOPAlgo_VectorOfEdgeFace,
|
||||
Handle(IntTools_Context)> BOPAlgo_EdgeFaceCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
//function : PerformEF
|
||||
//purpose :
|
||||
@@ -254,7 +265,7 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
//
|
||||
aNbEdgeFace=aVEdgeFace.Length();
|
||||
//=================================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVEdgeFace, myContext);
|
||||
BOPAlgo_EdgeFaceCnt::Perform(myRunParallel, aVEdgeFace, myContext);
|
||||
//=================================================================
|
||||
//
|
||||
for (k=0; k < aNbEdgeFace; ++k) {
|
||||
@@ -961,7 +972,7 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB
|
||||
anAlloc->Reset();
|
||||
|
||||
// Perform intersection of the found pairs
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVEdgeFace, myContext);
|
||||
BOPAlgo_EdgeFaceCnt::Perform(myRunParallel, aVEdgeFace, myContext);
|
||||
|
||||
BOPDS_VectorOfInterfEF& aEFs = myDS->InterfEF();
|
||||
if (theAddInterf && aEFs.IsEmpty())
|
||||
|
@@ -150,7 +150,7 @@ class BOPAlgo_FaceFace :
|
||||
|
||||
IntTools_FaceFace::Perform(myF1, myF2);
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertIntersectionFailed);
|
||||
}
|
||||
@@ -165,8 +165,16 @@ class BOPAlgo_FaceFace :
|
||||
};
|
||||
//
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPAlgo_FaceFace> BOPAlgo_VectorOfFaceFace;
|
||||
|
||||
typedef NCollection_Vector
|
||||
<BOPAlgo_FaceFace> BOPAlgo_VectorOfFaceFace;
|
||||
//
|
||||
typedef BOPTools_Functor
|
||||
<BOPAlgo_FaceFace,
|
||||
BOPAlgo_VectorOfFaceFace> BOPAlgo_FaceFaceFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt
|
||||
<BOPAlgo_FaceFaceFunctor,
|
||||
BOPAlgo_VectorOfFaceFace> BOPAlgo_FaceFaceCnt;
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//function : PerformFF
|
||||
@@ -279,7 +287,7 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
//
|
||||
//======================================================
|
||||
// Perform intersection
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVFaceFace);
|
||||
BOPAlgo_FaceFaceCnt::Perform(myRunParallel, aVFaceFace);
|
||||
//======================================================
|
||||
// Treatment of the results
|
||||
Standard_Integer k, aNbFaceFace = aVFaceFace.Length();
|
||||
|
@@ -169,8 +169,20 @@ class BOPAlgo_SplitEdge : public BOPAlgo_Algo {
|
||||
};
|
||||
//
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPAlgo_SplitEdge> BOPAlgo_VectorOfSplitEdge;
|
||||
|
||||
typedef NCollection_Vector
|
||||
<BOPAlgo_SplitEdge> BOPAlgo_VectorOfSplitEdge;
|
||||
//
|
||||
typedef BOPTools_ContextFunctor
|
||||
<BOPAlgo_SplitEdge,
|
||||
BOPAlgo_VectorOfSplitEdge,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_SplitEdgeFunctor;
|
||||
//
|
||||
typedef BOPTools_ContextCnt
|
||||
<BOPAlgo_SplitEdgeFunctor,
|
||||
BOPAlgo_VectorOfSplitEdge,
|
||||
Handle(IntTools_Context)> BOPAlgo_SplitEdgeCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_MPC
|
||||
//purpose :
|
||||
@@ -289,7 +301,7 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
|
||||
UpdateVertices(aCopyE, myF);
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertBuildingPCurveFailed(TopoDS_Shape()));
|
||||
}
|
||||
@@ -321,8 +333,20 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
|
||||
};
|
||||
//
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPAlgo_MPC> BOPAlgo_VectorOfMPC;
|
||||
|
||||
typedef NCollection_Vector
|
||||
<BOPAlgo_MPC> BOPAlgo_VectorOfMPC;
|
||||
//
|
||||
typedef BOPTools_ContextFunctor
|
||||
<BOPAlgo_MPC,
|
||||
BOPAlgo_VectorOfMPC,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_MPCFunctor;
|
||||
//
|
||||
typedef BOPTools_ContextCnt
|
||||
<BOPAlgo_MPCFunctor,
|
||||
BOPAlgo_VectorOfMPC,
|
||||
Handle(IntTools_Context)> BOPAlgo_MPCCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_BPC
|
||||
//purpose :
|
||||
@@ -367,8 +391,18 @@ class BOPAlgo_BPC {
|
||||
Standard_Boolean myToUpdate;
|
||||
};
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPAlgo_BPC> BOPAlgo_VectorOfBPC;
|
||||
|
||||
typedef NCollection_Vector
|
||||
<BOPAlgo_BPC> BOPAlgo_VectorOfBPC;
|
||||
//
|
||||
typedef BOPTools_Functor
|
||||
<BOPAlgo_BPC,
|
||||
BOPAlgo_VectorOfBPC> BOPAlgo_BPCFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt
|
||||
<BOPAlgo_BPCFunctor,
|
||||
BOPAlgo_VectorOfBPC> BOPAlgo_BPCCnt;
|
||||
//
|
||||
//
|
||||
//=======================================================================
|
||||
// function: MakeSplitEdges
|
||||
// purpose:
|
||||
@@ -490,7 +524,7 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
|
||||
//
|
||||
aNbVBSE=aVBSE.Length();
|
||||
//======================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVBSE, myContext);
|
||||
BOPAlgo_SplitEdgeCnt::Perform(myRunParallel, aVBSE, myContext);
|
||||
//======================================================
|
||||
//
|
||||
for (k=0; k < aNbVBSE; ++k) {
|
||||
@@ -719,7 +753,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
|
||||
}//if (bPCurveOnS1 || bPCurveOnS2 ) {
|
||||
//
|
||||
//======================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVMPC, myContext);
|
||||
BOPAlgo_MPCCnt::Perform(myRunParallel, aVMPC, myContext);
|
||||
//======================================================
|
||||
|
||||
// Add warnings of the failed projections and update edges with new pcurves
|
||||
@@ -842,7 +876,7 @@ void BOPAlgo_PaveFiller::Prepare()
|
||||
}
|
||||
//
|
||||
//======================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVBPC);
|
||||
BOPAlgo_BPCCnt::Perform(myRunParallel, aVBPC);
|
||||
//======================================================
|
||||
|
||||
// pcurves are built, and now update edges
|
||||
|
@@ -63,8 +63,20 @@ class BOPAlgo_ShrunkRange : public IntTools_ShrunkRange {
|
||||
};
|
||||
//
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPAlgo_ShrunkRange> BOPAlgo_VectorOfShrunkRange;
|
||||
|
||||
typedef NCollection_Vector
|
||||
<BOPAlgo_ShrunkRange> BOPAlgo_VectorOfShrunkRange;
|
||||
//
|
||||
typedef BOPTools_ContextFunctor
|
||||
<BOPAlgo_ShrunkRange,
|
||||
BOPAlgo_VectorOfShrunkRange,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_ShrunkRangeFunctor;
|
||||
//
|
||||
typedef BOPTools_ContextCnt
|
||||
<BOPAlgo_ShrunkRangeFunctor,
|
||||
BOPAlgo_VectorOfShrunkRange,
|
||||
Handle(IntTools_Context)> BOPAlgo_ShrunkRangeCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
// function: FillShrunkData
|
||||
// purpose:
|
||||
@@ -129,7 +141,7 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
|
||||
//
|
||||
aNbVSD=aVSD.Length();
|
||||
//=============================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVSD, myContext);
|
||||
BOPAlgo_ShrunkRangeCnt::Perform(myRunParallel, aVSD, myContext);
|
||||
//=============================================================
|
||||
//
|
||||
for (k=0; k < aNbVSD; ++k) {
|
||||
|
@@ -155,7 +155,7 @@ void BOPAlgo_RemoveFeatures::Perform()
|
||||
// Post treatment
|
||||
PostTreat();
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
AddError(new BOPAlgo_AlertRemoveFeaturesFailed());
|
||||
}
|
||||
@@ -354,7 +354,7 @@ public: //! @name Perform the operation
|
||||
// Trim the extended faces
|
||||
TrimExtendedFaces(aFaceExtFaceMap);
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
// Make sure the warning will be given on the higher level
|
||||
myHasAdjacentFaces = Standard_True;
|
||||
@@ -716,6 +716,12 @@ private: //! @name Fields
|
||||
|
||||
typedef NCollection_Vector<FillGap> VectorOfFillGap;
|
||||
|
||||
typedef BOPTools_Functor <FillGap, VectorOfFillGap> FillGapFunctor;
|
||||
|
||||
typedef BOPTools_Cnt <FillGapFunctor, VectorOfFillGap> FillGapCnt;
|
||||
|
||||
//=======================================================================
|
||||
|
||||
//=======================================================================
|
||||
// function: RemoveFeatures
|
||||
// purpose: Remove features by filling the gaps by extension of the
|
||||
@@ -756,7 +762,7 @@ void BOPAlgo_RemoveFeatures::RemoveFeatures()
|
||||
}
|
||||
|
||||
// Perform the reconstruction of the adjacent faces
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVFG);
|
||||
FillGapCnt::Perform(myRunParallel, aVFG);
|
||||
|
||||
// Even if the history is not requested, it is necessary to track:
|
||||
// - The solids modification after each feature removal to find
|
||||
|
@@ -71,8 +71,17 @@ class BOPAlgo_CBK {
|
||||
BOPTools_ConnexityBlock *myPCB;
|
||||
};
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPAlgo_CBK> BOPAlgo_VectorOfCBK;
|
||||
|
||||
typedef NCollection_Vector
|
||||
<BOPAlgo_CBK> BOPAlgo_VectorOfCBK;
|
||||
//
|
||||
typedef BOPTools_Functor
|
||||
<BOPAlgo_CBK,
|
||||
BOPAlgo_VectorOfCBK> BOPAlgo_CBKFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt
|
||||
<BOPAlgo_CBKFunctor,
|
||||
BOPAlgo_VectorOfCBK> BOPAlgo_CBKCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
@@ -551,7 +560,7 @@ void BOPAlgo_ShellSplitter::MakeShells()
|
||||
//
|
||||
aNbVCBK=aVCBK.Length();
|
||||
//===================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVCBK);
|
||||
BOPAlgo_CBKCnt::Perform(myRunParallel, aVCBK);
|
||||
//===================================================
|
||||
for (k=0; k<aNbVCBK; ++k) {
|
||||
BOPAlgo_CBK& aCBK=aVCBK(k);
|
||||
|
@@ -714,7 +714,7 @@ Standard_Boolean BOPAlgo_Tools::WiresToFaces(const TopoDS_Shape& theWires,
|
||||
aBB.Add(aRFaces, aFSp);
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure const&) {
|
||||
catch (Standard_Failure) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -958,8 +958,16 @@ Standard_Boolean FindPlane(const TopoDS_Shape& theWire,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_TNV;
|
||||
typedef NCollection_Vector<BOPAlgo_TNV> BOPAlgo_VectorOfTNV;
|
||||
|
||||
typedef NCollection_Vector
|
||||
<BOPAlgo_TNV> BOPAlgo_VectorOfTNV;
|
||||
//
|
||||
typedef BOPTools_Functor
|
||||
<BOPAlgo_TNV,
|
||||
BOPAlgo_VectorOfTNV> BOPAlgo_TNVFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt
|
||||
<BOPAlgo_TNVFunctor,
|
||||
BOPAlgo_VectorOfTNV> BOPAlgo_TNVCnt;
|
||||
//=======================================================================
|
||||
class BOPAlgo_TNV : public BOPTools_BoxBndTreeSelector{
|
||||
public:
|
||||
@@ -1082,7 +1090,7 @@ void BOPAlgo_Tools::IntersectVertices(const TopTools_IndexedDataMapOfShapeReal&
|
||||
aTreeFiller.Fill();
|
||||
//
|
||||
// Perform intersection
|
||||
BOPTools_Parallel::Perform (theRunParallel, aVTNV);
|
||||
BOPAlgo_TNVCnt::Perform(theRunParallel, aVTNV);
|
||||
//
|
||||
// Fence map
|
||||
TColStd_MapOfInteger aMFence;
|
||||
@@ -1521,6 +1529,16 @@ void BOPAlgo_FillIn3DParts::MakeConnexityBlock(const TopoDS_Face& theFStart,
|
||||
// Vector of solid classifiers
|
||||
typedef NCollection_Vector<BOPAlgo_FillIn3DParts> BOPAlgo_VectorOfFillIn3DParts;
|
||||
|
||||
// Functors to perform classification
|
||||
typedef BOPTools_ContextFunctor<BOPAlgo_FillIn3DParts,
|
||||
BOPAlgo_VectorOfFillIn3DParts,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_FillIn3DPartsFunctor;
|
||||
|
||||
typedef BOPTools_ContextCnt<BOPAlgo_FillIn3DPartsFunctor,
|
||||
BOPAlgo_VectorOfFillIn3DParts,
|
||||
Handle(IntTools_Context)> BOPAlgo_FillIn3DPartsCnt;
|
||||
|
||||
//=======================================================================
|
||||
//function : ClassifyFaces
|
||||
//purpose :
|
||||
@@ -1611,7 +1629,7 @@ void BOPAlgo_Tools::ClassifyFaces(const TopTools_ListOfShape& theFaces,
|
||||
|
||||
// Perform classification
|
||||
//================================================================
|
||||
BOPTools_Parallel::Perform (theRunParallel, aVFIP, theContext);
|
||||
BOPAlgo_FillIn3DPartsCnt::Perform(theRunParallel, aVFIP, theContext);
|
||||
//================================================================
|
||||
|
||||
// Analyze the results and fill the resulting map
|
||||
|
@@ -169,7 +169,19 @@ protected:
|
||||
Handle(IntTools_Context) myContext;
|
||||
};
|
||||
|
||||
typedef NCollection_Vector<BOPAlgo_WS_ConnexityBlock> BOPAlgo_VectorOfConnexityBlock;
|
||||
typedef NCollection_Vector<BOPAlgo_WS_ConnexityBlock> \
|
||||
BOPAlgo_VectorOfConnexityBlock;
|
||||
//
|
||||
typedef BOPTools_ContextFunctor
|
||||
<BOPAlgo_WS_ConnexityBlock,
|
||||
BOPAlgo_VectorOfConnexityBlock,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_SplitBlockFunctor;
|
||||
//
|
||||
typedef BOPTools_ContextCnt
|
||||
<BOPAlgo_SplitBlockFunctor,
|
||||
BOPAlgo_VectorOfConnexityBlock,
|
||||
Handle(IntTools_Context)> BOPAlgo_SplitBlockCnt;
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeWires
|
||||
@@ -202,7 +214,7 @@ void BOPAlgo_WireSplitter::MakeWires()
|
||||
}
|
||||
}
|
||||
//===================================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVCB, myContext);
|
||||
BOPAlgo_SplitBlockCnt::Perform(myRunParallel, aVCB, myContext);
|
||||
//===================================================
|
||||
aNbVCB=aVCB.Length();
|
||||
for (k=0; k<aNbVCB; ++k) {
|
||||
|
@@ -73,7 +73,9 @@ class BOPDS_TSR : public BOPTools_BoxBndTreeSelector{
|
||||
};
|
||||
//
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPDS_TSR> BOPDS_VectorOfTSR;
|
||||
typedef NCollection_Vector <BOPDS_TSR> BOPDS_VectorOfTSR;
|
||||
typedef BOPTools_Functor <BOPDS_TSR,BOPDS_VectorOfTSR> BOPDS_TSRFunctor;
|
||||
typedef BOPTools_Cnt <BOPDS_TSRFunctor, BOPDS_VectorOfTSR> BOPDS_TSRCnt;
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -321,7 +323,7 @@ void BOPDS_Iterator::Intersect(const Handle(IntTools_Context)& theCtx,
|
||||
aTreeFiller.Fill();
|
||||
//
|
||||
//===========================================
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVTSR);
|
||||
BOPDS_TSRCnt::Perform(myRunParallel, aVTSR);
|
||||
//===========================================
|
||||
//
|
||||
BOPDS_MapOfPair aMPFence;
|
||||
@@ -452,7 +454,7 @@ void BOPDS_Iterator::IntersectExt(const TColStd_MapOfInteger& theIndices)
|
||||
}
|
||||
|
||||
// Perform selection
|
||||
BOPTools_Parallel::Perform (myRunParallel, aVTSR);
|
||||
BOPDS_TSRCnt::Perform(myRunParallel, aVTSR);
|
||||
|
||||
// Treat selections
|
||||
|
||||
|
@@ -136,7 +136,7 @@ Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
|
||||
BRepLib::SameParameter(aE1T);
|
||||
BRepLib::SameRange(aE1T);
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
iRet = 6;
|
||||
return iRet;
|
||||
|
@@ -159,7 +159,15 @@ class BOPTools_CPC {
|
||||
//
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPTools_CPC> BOPTools_VectorOfCPC;
|
||||
|
||||
//
|
||||
typedef BOPTools_Functor
|
||||
<BOPTools_CPC,
|
||||
BOPTools_VectorOfCPC> BOPTools_CPCFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt
|
||||
<BOPTools_CPCFunctor,
|
||||
BOPTools_VectorOfCPC> BOPTools_CPCCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
//class : BOPTools_CWT
|
||||
//purpose :
|
||||
@@ -191,7 +199,15 @@ class BOPTools_CWT {
|
||||
};
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPTools_CWT> BOPTools_VectorOfCWT;
|
||||
|
||||
//
|
||||
typedef BOPTools_Functor
|
||||
<BOPTools_CWT,
|
||||
BOPTools_VectorOfCWT> BOPTools_CWTFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt
|
||||
<BOPTools_CWTFunctor,
|
||||
BOPTools_VectorOfCWT> BOPTools_CWTCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
//class : BOPTools_CDT
|
||||
//purpose :
|
||||
@@ -234,7 +250,15 @@ class BOPTools_CDT {
|
||||
};
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPTools_CDT> BOPTools_VectorOfCDT;
|
||||
|
||||
//
|
||||
typedef BOPTools_Functor
|
||||
<BOPTools_CDT,
|
||||
BOPTools_VectorOfCDT> BOPTools_CDTFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt
|
||||
<BOPTools_CDTFunctor,
|
||||
BOPTools_VectorOfCDT> BOPTools_CDTCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
//class : BOPTools_CVT
|
||||
//purpose :
|
||||
@@ -267,7 +291,15 @@ class BOPTools_CVT {
|
||||
//
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPTools_CVT> BOPTools_VectorOfCVT;
|
||||
|
||||
//
|
||||
typedef BOPTools_Functor
|
||||
<BOPTools_CVT,
|
||||
BOPTools_VectorOfCVT> BOPTools_CVTFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt
|
||||
<BOPTools_CVTFunctor,
|
||||
BOPTools_VectorOfCVT> BOPTools_CVTCnt;
|
||||
//
|
||||
//=======================================================================
|
||||
//class : BOPTools_CET
|
||||
//purpose :
|
||||
@@ -299,7 +331,18 @@ class BOPTools_CET {
|
||||
};
|
||||
//=======================================================================
|
||||
typedef NCollection_Vector<BOPTools_CET> BOPTools_VectorOfCET;
|
||||
|
||||
//
|
||||
typedef BOPTools_Functor
|
||||
<BOPTools_CET,
|
||||
BOPTools_VectorOfCET> BOPTools_CETFunctor;
|
||||
//
|
||||
typedef BOPTools_Cnt
|
||||
<BOPTools_CETFunctor,
|
||||
BOPTools_VectorOfCET> BOPTools_CETCnt;
|
||||
//
|
||||
//
|
||||
//=======================================================================
|
||||
//
|
||||
//=======================================================================
|
||||
// Function : CorrectTolerances
|
||||
// purpose :
|
||||
@@ -337,7 +380,7 @@ void BOPTools_AlgoTools::CorrectPointOnCurve
|
||||
}
|
||||
//
|
||||
//======================================================
|
||||
BOPTools_Parallel::Perform (bRunParallel, aVCPC);
|
||||
BOPTools_CPCCnt::Perform(bRunParallel, aVCPC);
|
||||
//======================================================
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -375,9 +418,9 @@ void BOPTools_AlgoTools::CorrectCurveOnSurface
|
||||
}
|
||||
//
|
||||
//======================================================
|
||||
BOPTools_Parallel::Perform (bRunParallel, aVCWT);
|
||||
BOPTools_CWTCnt::Perform(bRunParallel, aVCWT);
|
||||
//======================================================
|
||||
BOPTools_Parallel::Perform (bRunParallel, aVCDT);
|
||||
BOPTools_CDTCnt::Perform(bRunParallel, aVCDT);
|
||||
//======================================================
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -402,7 +445,7 @@ void BOPTools_AlgoTools::CorrectShapeTolerances
|
||||
}
|
||||
//
|
||||
//======================================================
|
||||
BOPTools_Parallel::Perform (bRunParallel, aVCVT);
|
||||
BOPTools_CVTCnt::Perform(bRunParallel, aVCVT);
|
||||
//======================================================
|
||||
//
|
||||
aExp.Init(aShape, TopAbs_FACE);
|
||||
@@ -414,7 +457,7 @@ void BOPTools_AlgoTools::CorrectShapeTolerances
|
||||
}
|
||||
//
|
||||
//======================================================
|
||||
BOPTools_Parallel::Perform (bRunParallel, aVCET);
|
||||
BOPTools_CETCnt::Perform(bRunParallel, aVCET);
|
||||
//======================================================
|
||||
}
|
||||
//
|
||||
|
@@ -18,178 +18,158 @@
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <OSD_Parallel.hxx>
|
||||
#include <OSD_ThreadPool.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <Standard_Mutex.hxx>
|
||||
#include <OSD_Thread.hxx>
|
||||
|
||||
//! Implementation of Functors/Starters
|
||||
class BOPTools_Parallel
|
||||
//
|
||||
// 1. Implementation of Functors/Starters
|
||||
//
|
||||
// 1.1. Pure version
|
||||
//
|
||||
|
||||
//=======================================================================
|
||||
//class : BOPTools_Functor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template <class TypeSolver, class TypeSolverVector>
|
||||
class BOPTools_Functor
|
||||
{
|
||||
template<class TypeSolverVector>
|
||||
class Functor
|
||||
{
|
||||
public:
|
||||
//! Constructor.
|
||||
explicit Functor(TypeSolverVector& theSolverVec) : mySolvers (theSolverVec) {}
|
||||
public:
|
||||
//! Constructor.
|
||||
explicit BOPTools_Functor(TypeSolverVector& theSolverVec)
|
||||
: mySolvers(theSolverVec) {}
|
||||
|
||||
//! Defines functor interface.
|
||||
void operator() (const Standard_Integer theIndex) const
|
||||
//! Defines functor interface.
|
||||
void operator() (const Standard_Integer theIndex) const
|
||||
{
|
||||
TypeSolver& aSolver = mySolvers(theIndex);
|
||||
aSolver.Perform();
|
||||
}
|
||||
|
||||
private:
|
||||
BOPTools_Functor(const BOPTools_Functor&);
|
||||
BOPTools_Functor& operator= (const BOPTools_Functor&);
|
||||
|
||||
private:
|
||||
TypeSolverVector& mySolvers;
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//class : BOPTools_Cnt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template <class TypeFunctor, class TypeSolverVector>
|
||||
class BOPTools_Cnt
|
||||
{
|
||||
public:
|
||||
static void Perform( const Standard_Boolean isRunParallel,
|
||||
TypeSolverVector& theSolverVector )
|
||||
{
|
||||
TypeFunctor aFunctor(theSolverVector);
|
||||
OSD_Parallel::For(0, theSolverVector.Length(), aFunctor, !isRunParallel);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 1.2. Context dependent version
|
||||
//
|
||||
|
||||
//=======================================================================
|
||||
//class : BOPTools_ContextFunctor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template <class TypeSolver, class TypeSolverVector,
|
||||
class TypeContext, typename TN>
|
||||
class BOPTools_ContextFunctor
|
||||
{
|
||||
//! Auxiliary thread ID hasher.
|
||||
struct Hasher
|
||||
{
|
||||
static Standard_Integer HashCode(const Standard_ThreadId theKey,
|
||||
const Standard_Integer Upper)
|
||||
{
|
||||
typename TypeSolverVector::value_type& aSolver = mySolvers[theIndex];
|
||||
aSolver.Perform();
|
||||
return ::HashCode((Standard_Size)theKey, Upper);
|
||||
}
|
||||
|
||||
private:
|
||||
Functor(const Functor&);
|
||||
Functor& operator= (const Functor&);
|
||||
|
||||
private:
|
||||
TypeSolverVector& mySolvers;
|
||||
static Standard_Boolean IsEqual(const Standard_ThreadId theKey1,
|
||||
const Standard_ThreadId theKey2)
|
||||
{
|
||||
return theKey1 == theKey2;
|
||||
}
|
||||
};
|
||||
|
||||
//! Functor storing map of thread id -> algorithm context
|
||||
template<class TypeSolverVector, class TypeContext>
|
||||
class ContextFunctor
|
||||
{
|
||||
//! Auxiliary thread ID hasher.
|
||||
struct Hasher
|
||||
{
|
||||
static Standard_Integer HashCode(const Standard_ThreadId theKey,
|
||||
const Standard_Integer Upper)
|
||||
{
|
||||
return ::HashCode((Standard_Size)theKey, Upper);
|
||||
}
|
||||
|
||||
static Standard_Boolean IsEqual(const Standard_ThreadId theKey1,
|
||||
const Standard_ThreadId theKey2)
|
||||
{
|
||||
return theKey1 == theKey2;
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
explicit ContextFunctor (TypeSolverVector& theVector) : mySolverVector(theVector) {}
|
||||
|
||||
//! Binds main thread context
|
||||
void SetContext (const opencascade::handle<TypeContext>& theContext)
|
||||
{
|
||||
myContextMap.Bind (OSD_Thread::Current(), theContext);
|
||||
}
|
||||
|
||||
//! Returns current thread context
|
||||
const opencascade::handle<TypeContext>& GetThreadContext() const
|
||||
{
|
||||
const Standard_ThreadId aThreadID = OSD_Thread::Current();
|
||||
if (const opencascade::handle<TypeContext>* aContextPtr = myContextMap.Seek (aThreadID))
|
||||
{
|
||||
if (!aContextPtr->IsNull())
|
||||
{
|
||||
return *aContextPtr;
|
||||
}
|
||||
}
|
||||
|
||||
// Create new context
|
||||
opencascade::handle<TypeContext> aContext = new TypeContext (NCollection_BaseAllocator::CommonBaseAllocator());
|
||||
|
||||
Standard_Mutex::Sentry aLocker (myMutex);
|
||||
myContextMap.Bind (aThreadID, aContext);
|
||||
return myContextMap (aThreadID);
|
||||
}
|
||||
|
||||
//! Defines functor interface
|
||||
void operator()( const Standard_Integer theIndex ) const
|
||||
{
|
||||
const opencascade::handle<TypeContext>& aContext = GetThreadContext();
|
||||
typename TypeSolverVector::value_type& aSolver = mySolverVector[theIndex];
|
||||
|
||||
aSolver.SetContext(aContext);
|
||||
aSolver.Perform();
|
||||
}
|
||||
|
||||
private:
|
||||
ContextFunctor(const ContextFunctor&);
|
||||
ContextFunctor& operator= (const ContextFunctor&);
|
||||
|
||||
private:
|
||||
TypeSolverVector& mySolverVector;
|
||||
mutable NCollection_DataMap<Standard_ThreadId, opencascade::handle<TypeContext>, Hasher> myContextMap;
|
||||
mutable Standard_Mutex myMutex;
|
||||
};
|
||||
|
||||
//! Functor storing array of algorithm contexts per thread in pool
|
||||
template<class TypeSolverVector, class TypeContext>
|
||||
class ContextFunctor2
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
explicit ContextFunctor2 (TypeSolverVector& theVector, const OSD_ThreadPool::Launcher& thePoolLauncher)
|
||||
: mySolverVector(theVector),
|
||||
myContextArray (thePoolLauncher.LowerThreadIndex(), thePoolLauncher.UpperThreadIndex()) {}
|
||||
|
||||
//! Binds main thread context
|
||||
void SetContext (const opencascade::handle<TypeContext>& theContext)
|
||||
{
|
||||
myContextArray.ChangeLast() = theContext; // OSD_ThreadPool::Launcher::UpperThreadIndex() is reserved for a main thread
|
||||
}
|
||||
|
||||
//! Defines functor interface with serialized thread index.
|
||||
void operator() (int theThreadIndex,
|
||||
int theIndex) const
|
||||
{
|
||||
opencascade::handle<TypeContext>& aContext = myContextArray.ChangeValue (theThreadIndex);
|
||||
if (aContext.IsNull())
|
||||
{
|
||||
aContext = new TypeContext (NCollection_BaseAllocator::CommonBaseAllocator());
|
||||
}
|
||||
typename TypeSolverVector::value_type& aSolver = mySolverVector[theIndex];
|
||||
aSolver.SetContext (aContext);
|
||||
aSolver.Perform();
|
||||
}
|
||||
|
||||
private:
|
||||
ContextFunctor2(const ContextFunctor2&);
|
||||
ContextFunctor2& operator= (const ContextFunctor2&);
|
||||
|
||||
private:
|
||||
TypeSolverVector& mySolverVector;
|
||||
mutable NCollection_Array1< opencascade::handle<TypeContext> > myContextArray;
|
||||
};
|
||||
typedef NCollection_DataMap<Standard_ThreadId, TypeContext, Hasher> ContextMap;
|
||||
|
||||
public:
|
||||
|
||||
//! Pure version
|
||||
template<class TypeSolverVector>
|
||||
static void Perform (Standard_Boolean theIsRunParallel,
|
||||
TypeSolverVector& theSolverVector)
|
||||
//! Constructor
|
||||
explicit BOPTools_ContextFunctor( TypeSolverVector& theVector )
|
||||
: mySolverVector(theVector) {}
|
||||
|
||||
//! Binds main thread context
|
||||
void SetContext( TypeContext& theContext )
|
||||
{
|
||||
Functor<TypeSolverVector> aFunctor (theSolverVector);
|
||||
OSD_Parallel::For (0, theSolverVector.Length(), aFunctor, !theIsRunParallel);
|
||||
myContexts.Bind(OSD_Thread::Current(), theContext);
|
||||
}
|
||||
|
||||
//! Context dependent version
|
||||
template<class TypeSolverVector, class TypeContext>
|
||||
static void Perform (Standard_Boolean theIsRunParallel,
|
||||
TypeSolverVector& theSolverVector,
|
||||
opencascade::handle<TypeContext>& theContext)
|
||||
//! Returns current thread context
|
||||
TypeContext& GetThreadContext() const
|
||||
{
|
||||
if (OSD_Parallel::ToUseOcctThreads())
|
||||
const Standard_ThreadId aThreadID = OSD_Thread::Current();
|
||||
if ( myContexts.IsBound(aThreadID) )
|
||||
{
|
||||
const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool();
|
||||
OSD_ThreadPool::Launcher aPoolLauncher (*aThreadPool, theIsRunParallel ? theSolverVector.Length() : 0);
|
||||
ContextFunctor2<TypeSolverVector, TypeContext> aFunctor (theSolverVector, aPoolLauncher);
|
||||
aFunctor.SetContext (theContext);
|
||||
aPoolLauncher.Perform (0, theSolverVector.Length(), aFunctor);
|
||||
}
|
||||
else
|
||||
{
|
||||
ContextFunctor<TypeSolverVector, TypeContext> aFunctor (theSolverVector);
|
||||
aFunctor.SetContext (theContext);
|
||||
OSD_Parallel::For (0, theSolverVector.Length(), aFunctor, !theIsRunParallel);
|
||||
TypeContext& aContext = myContexts(aThreadID);
|
||||
if ( aContext.IsNull() == Standard_False )
|
||||
return aContext;
|
||||
}
|
||||
|
||||
// Create new context
|
||||
TypeContext aContext = new TN
|
||||
( NCollection_BaseAllocator::CommonBaseAllocator() );
|
||||
|
||||
Standard_Mutex::Sentry aLocker(myMutex);
|
||||
myContexts.Bind(aThreadID, aContext);
|
||||
|
||||
return myContexts(aThreadID);
|
||||
}
|
||||
|
||||
//! Defines functor interface
|
||||
void operator()( const Standard_Integer theIndex ) const
|
||||
{
|
||||
TypeContext& aContext = GetThreadContext();
|
||||
TypeSolver& aSolver = mySolverVector(theIndex);
|
||||
|
||||
aSolver.SetContext(aContext);
|
||||
aSolver.Perform();
|
||||
}
|
||||
|
||||
private:
|
||||
BOPTools_ContextFunctor(const BOPTools_ContextFunctor&);
|
||||
BOPTools_ContextFunctor& operator= (const BOPTools_ContextFunctor&);
|
||||
|
||||
private:
|
||||
TypeSolverVector& mySolverVector;
|
||||
mutable ContextMap myContexts;
|
||||
mutable Standard_Mutex myMutex;
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//class : BOPTools_ContextCnt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template <class TypeFunctor, class TypeSolverVector, class TypeContext>
|
||||
class BOPTools_ContextCnt
|
||||
{
|
||||
public:
|
||||
static void Perform( const Standard_Boolean isRunParallel,
|
||||
TypeSolverVector& theSolverVector,
|
||||
TypeContext& theContext )
|
||||
{
|
||||
TypeFunctor aFunctor(theSolverVector);
|
||||
aFunctor.SetContext(theContext);
|
||||
|
||||
OSD_Parallel::For(0, theSolverVector.Length(), aFunctor, !isRunParallel);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -326,7 +326,7 @@ void BRepBuilderAPI_FastSewing::Perform(void)
|
||||
|
||||
myResShape = aQuilt.Shells();
|
||||
}
|
||||
catch(Standard_Failure const&)
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
SetStatus(FS_Exception);
|
||||
#ifdef OCCT_DEBUG
|
||||
|
@@ -903,7 +903,7 @@ TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirs
|
||||
}
|
||||
}
|
||||
|
||||
catch(Standard_Failure const&)
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
isSamePar = Standard_False;
|
||||
}
|
||||
@@ -4744,7 +4744,7 @@ void BRepBuilderAPI_Sewing::SameParameterShape()
|
||||
|
||||
BRepLib::SameParameter(sec, BRep_Tool::Tolerance(sec));
|
||||
}
|
||||
catch (Standard_Failure const&) {
|
||||
catch (Standard_Failure) {
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "Fail: BRepBuilderAPI_Sewing::SameParameterShape exception in BRepLib::SameParameter" << endl;
|
||||
#endif
|
||||
|
@@ -147,6 +147,7 @@ void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
|
||||
|
||||
if ( ! aRes.IsNull() )
|
||||
{
|
||||
aRes->SetFailStatus(exp.Current());
|
||||
aRes->SetFailStatus(S);
|
||||
}
|
||||
}
|
||||
|
@@ -238,27 +238,19 @@ static Standard_Boolean KPartCircle
|
||||
BRepFill_IndexedDataMapOfOrientedShapeListOfShape& myMap,
|
||||
Standard_Boolean& myIsDone)
|
||||
{
|
||||
TopoDS_Edge E;
|
||||
for (TopExp_Explorer anEdgeIter (mySpine, TopAbs_EDGE); anEdgeIter.More(); anEdgeIter.Next())
|
||||
{
|
||||
if (!E.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
E = TopoDS::Edge (anEdgeIter.Current());
|
||||
}
|
||||
if (E.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
TopExp_Explorer exp(mySpine,TopAbs_EDGE);
|
||||
Standard_Integer NbEdges = 0;
|
||||
TopoDS_Edge E;
|
||||
|
||||
for (; exp.More(); exp.Next()) {
|
||||
NbEdges++;
|
||||
E = TopoDS::Edge(exp.Current());
|
||||
if (NbEdges > 1) return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Real f,l;
|
||||
TopLoc_Location L;
|
||||
Handle(Geom_Curve) C = BRep_Tool::Curve(E,L,f,l);
|
||||
if (C.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if (C->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
Handle(Geom_TrimmedCurve) Ct = Handle(Geom_TrimmedCurve)::DownCast(C);
|
||||
@@ -749,6 +741,7 @@ void BRepFill_OffsetWire::PerformWithBiLo
|
||||
return;
|
||||
|
||||
BRep_Builder myBuilder;
|
||||
myBuilder.MakeCompound(TopoDS::Compound(myShape));
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// MapNodeVertex : associate to each node of the map (key1) and to
|
||||
@@ -792,11 +785,6 @@ void BRepFill_OffsetWire::PerformWithBiLo
|
||||
TopExp::Vertices(theWire, Ends[0], Ends[1]);
|
||||
}
|
||||
|
||||
if (Locus.NumberOfContours() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Standard_Integer ic = 1; ic <= Locus.NumberOfContours(); ic++) {
|
||||
TopoDS_Shape PEE = Link.GeneratingShape(Locus.BasicElt(ic,Locus.NumberOfElts(ic)));
|
||||
TopoDS_Shape& PE = PEE ;
|
||||
|
@@ -2297,7 +2297,7 @@ void BRepLib::EncodeRegularity(TopoDS_Edge& E,
|
||||
B.Continuity(E,F1,F2,aCont);
|
||||
|
||||
}
|
||||
catch(Standard_Failure const&)
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "Failure: Exception in BRepLib::EncodeRegularity" << endl;
|
||||
|
@@ -152,7 +152,7 @@ static Standard_Boolean Is2DClosed(const TopoDS_Shape& theShape,
|
||||
TopoDS_Vertex aV2 = TopExp::LastVertex( aLastEdge, Standard_True );
|
||||
return ( aV1.IsSame( aV2 ) && Is2DConnected( aLastEdge, aFisrtEdge, theSurface, theLocation));
|
||||
}
|
||||
catch (Standard_Failure const&) {
|
||||
catch ( Standard_Failure ) {
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
|
@@ -131,10 +131,10 @@ BRepLib_MakeWire::BRepLib_MakeWire(const TopoDS_Wire& W,
|
||||
|
||||
void BRepLib_MakeWire::Add(const TopoDS_Wire& W)
|
||||
{
|
||||
for (TopoDS_Iterator it(W); it.More(); it.Next()) {
|
||||
Add(TopoDS::Edge(it.Value()));
|
||||
if (myError != BRepLib_WireDone)
|
||||
break;
|
||||
TopExp_Explorer ex(W,TopAbs_EDGE);
|
||||
while (ex.More()) {
|
||||
Add(TopoDS::Edge(ex.Current()));
|
||||
ex.Next();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,10 +24,10 @@
|
||||
#include <BRepLib_WireError.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <BRepLib_MakeShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <NCollection_Map.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <NCollection_UBTree.hxx>
|
||||
|
||||
@@ -172,14 +172,14 @@ private:
|
||||
};
|
||||
|
||||
void CollectCoincidentVertices(const TopTools_ListOfShape& theL,
|
||||
NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL);
|
||||
NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL);
|
||||
|
||||
void CreateNewVertices(const NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL,
|
||||
TopTools_DataMapOfShapeShape& theO2NV);
|
||||
NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex>& theO2NV);
|
||||
|
||||
void CreateNewListOfEdges(const TopTools_ListOfShape& theL,
|
||||
const TopTools_DataMapOfShapeShape& theO2NV,
|
||||
TopTools_ListOfShape& theNewEList);
|
||||
const NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex>& theO2NV,
|
||||
TopTools_ListOfShape& theNewEList);
|
||||
|
||||
void Add(const TopoDS_Edge& E, Standard_Boolean IsCheckGeometryProximity);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user