mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +03:00
Compare commits
139 Commits
CR0_IILS_P
...
IR-2020-03
Author | SHA1 | Date | |
---|---|---|---|
|
d6e18114eb | ||
|
e5c11edd7b | ||
|
fffc249f21 | ||
|
739c7e5968 | ||
|
f732ea1ab5 | ||
|
ae87bb87d0 | ||
|
3d60d73f76 | ||
|
0950253ca6 | ||
|
f6d8ca74d5 | ||
|
00cdefc7a2 | ||
|
d850414af1 | ||
|
b380b06c5d | ||
|
c64efd9e30 | ||
|
cd43c08f2b | ||
|
28b13b31aa | ||
|
10ac040338 | ||
|
7e1c1e4869 | ||
|
a2803f37e7 | ||
|
18348b382e | ||
|
64e68ea690 | ||
|
bee13ef1cf | ||
|
e73ef9d219 | ||
|
8b3fbdef34 | ||
|
e2550e48f1 | ||
|
62beabff7c | ||
|
5e06dfcb32 | ||
|
35befde2ad | ||
|
bc73b00672 | ||
|
00ea7f2676 | ||
|
fe758dbe2c | ||
|
8811d6f2aa | ||
|
1939cfd9cb | ||
|
7860770232 | ||
|
6216ed573e | ||
|
973f7d55bd | ||
|
0c74168c42 | ||
|
3eba1c72ef | ||
|
e83d440f92 | ||
|
6558400123 | ||
|
389f5b59dd | ||
|
08353e37cf | ||
|
c8bead4752 | ||
|
9df71488b3 | ||
|
ef59b5e064 | ||
|
0c061f3d9d | ||
|
88b312d3a4 | ||
|
0858125fd4 | ||
|
89d855ba58 | ||
|
d415125a68 | ||
|
0da2ecac41 | ||
|
bdd09cfaf4 | ||
|
9504a30d15 | ||
|
9a1701fbcb | ||
|
c68c346d2b | ||
|
e2447a80ea | ||
|
936ce1f273 | ||
|
6ef7a1f9e5 | ||
|
23c2ae55c7 | ||
|
8bfae263c1 | ||
|
1c2ddf5612 | ||
|
5a8d30b87b | ||
|
b7b22996bb | ||
|
552a74d829 | ||
|
c37bd936c3 | ||
|
4e8c1d8666 | ||
|
72f6dc612c | ||
|
f051908edc | ||
|
420b38fde9 | ||
|
34e7ac6817 | ||
|
2b5a58a33c | ||
|
e513a6c538 | ||
|
8c2d331426 | ||
|
caee80f39f | ||
|
01b2f506d6 | ||
|
df8c7e3e18 | ||
|
3f1675c941 | ||
|
6a56fe9240 | ||
|
51ee6a7dbb | ||
|
14a356b178 | ||
|
4eff0c0480 | ||
|
8f00325d73 | ||
|
9a90a4524e | ||
|
31a5a359bb | ||
|
bf97419a18 | ||
|
4c26106f76 | ||
|
15e4e6a23e | ||
|
6b467e52bb | ||
|
08b438b076 | ||
|
a14f2b4722 | ||
|
a1a9b24952 | ||
|
f979709590 | ||
|
e9d05765c2 | ||
|
7756fc599d | ||
|
b31fbc832d | ||
|
1bd04b5a02 | ||
|
6466cc9eb1 | ||
|
f7fc0c03be | ||
|
67312b7991 | ||
|
f4a7308f61 | ||
|
53d770b3a2 | ||
|
7ed6e985e2 | ||
|
da6b95a075 | ||
|
565baee64b | ||
|
36e28f96f6 | ||
|
215dd33149 | ||
|
5646c90e87 | ||
|
97e0059b05 | ||
|
8445efca81 | ||
|
a6a66c3a21 | ||
|
cc99be369e | ||
|
1a5007a920 | ||
|
3818aacaa5 | ||
|
e1d039d56d | ||
|
a4815d5509 | ||
|
ba00aab7a0 | ||
|
aaf8d6a98d | ||
|
b008226203 | ||
|
eff3eff916 | ||
|
bf327822d6 | ||
|
63da0df9c2 | ||
|
13a44c4b7f | ||
|
f04de1335c | ||
|
c08fd12706 | ||
|
d7992a77f6 | ||
|
8c787b5fa9 | ||
|
44fafc477f | ||
|
780fbc2897 | ||
|
620a6baa59 | ||
|
89073268fd | ||
|
6ed44b1ca9 | ||
|
746cb7c328 | ||
|
8ba3d978db | ||
|
c275673dbf | ||
|
9e3045dae1 | ||
|
c2bcd98369 | ||
|
683b72c3c1 | ||
|
3358ed643b | ||
|
2724a0b3cc | ||
|
0deeff45a0 |
21
adm/UDLIST
21
adm/UDLIST
@@ -108,6 +108,7 @@ n BRepMesh
|
|||||||
n BRepMeshData
|
n BRepMeshData
|
||||||
n BRepOffset
|
n BRepOffset
|
||||||
n BRepOffsetAPI
|
n BRepOffsetAPI
|
||||||
|
n BRepPreviewAPI
|
||||||
n BRepPrim
|
n BRepPrim
|
||||||
n BRepPrimAPI
|
n BRepPrimAPI
|
||||||
n BRepProj
|
n BRepProj
|
||||||
@@ -443,3 +444,23 @@ t TKRWMesh
|
|||||||
n RWGltf
|
n RWGltf
|
||||||
n RWMesh
|
n RWMesh
|
||||||
n RWObj
|
n RWObj
|
||||||
|
n DFBrowser
|
||||||
|
n DFBrowserPane
|
||||||
|
n DFBrowserPaneXDE
|
||||||
|
n ShapeView
|
||||||
|
n TInspector
|
||||||
|
n TInspectorAPI
|
||||||
|
x TInspectorEXE
|
||||||
|
t TKDFBrowser
|
||||||
|
t TKShapeView
|
||||||
|
t TKTInspector
|
||||||
|
t TKTInspectorAPI
|
||||||
|
t TKToolsDraw
|
||||||
|
t TKTreeModel
|
||||||
|
t TKView
|
||||||
|
t TKVInspector
|
||||||
|
n ToolsDraw
|
||||||
|
n TreeModel
|
||||||
|
n View
|
||||||
|
n ViewControl
|
||||||
|
n VInspector
|
||||||
|
@@ -108,6 +108,7 @@ else()
|
|||||||
elseif (ANDROID)
|
elseif (ANDROID)
|
||||||
set (CSF_ThreadLibs "c")
|
set (CSF_ThreadLibs "c")
|
||||||
set (CSF_OpenGlLibs "EGL GLESv2")
|
set (CSF_OpenGlLibs "EGL GLESv2")
|
||||||
|
set (CSF_androidlog "log")
|
||||||
elseif (UNIX)
|
elseif (UNIX)
|
||||||
set (CSF_ThreadLibs "pthread rt stdc++")
|
set (CSF_ThreadLibs "pthread rt stdc++")
|
||||||
if (USE_GLES2)
|
if (USE_GLES2)
|
||||||
|
@@ -130,7 +130,9 @@ elseif ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
|
|||||||
if (APPLE)
|
if (APPLE)
|
||||||
# CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated.
|
# CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated.
|
||||||
set (CMAKE_CXX_FLAGS "-std=c++0x -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
|
set (CMAKE_CXX_FLAGS "-std=c++0x -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
|
||||||
else()
|
elseif(NOT WIN32)
|
||||||
|
# CLang for Windows (at least CLang 8.0 distributed with VS 2019)
|
||||||
|
# does not support option "-std=c++0x"
|
||||||
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
@@ -12,18 +12,12 @@ macro (OCCT_CHECK_AND_UNSET VARNAME)
|
|||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro (OCCT_CHECK_AND_UNSET_GROUP VARNAME)
|
macro (OCCT_CHECK_AND_UNSET_GROUP GROUPNAME)
|
||||||
OCCT_CHECK_AND_UNSET ("${VARNAME}_DIR")
|
get_cmake_property(VARS VARIABLES)
|
||||||
|
string (REGEX MATCHALL "(^|;)${GROUPNAME}[A-Za-z0-9_]*" GROUPNAME_VARS "${VARS}")
|
||||||
OCCT_CHECK_AND_UNSET ("${VARNAME}_INCLUDE_DIR")
|
foreach(GROUPNAME_VAR ${GROUPNAME_VARS})
|
||||||
|
OCCT_CHECK_AND_UNSET(${GROUPNAME_VAR})
|
||||||
OCCT_CHECK_AND_UNSET ("${VARNAME}_LIBRARY")
|
endforeach()
|
||||||
OCCT_CHECK_AND_UNSET ("${VARNAME}_LIBRARY_DIR")
|
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
OCCT_CHECK_AND_UNSET ("${VARNAME}_DLL")
|
|
||||||
OCCT_CHECK_AND_UNSET ("${VARNAME}_DLL_DIR")
|
|
||||||
endif()
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro (OCCT_CHECK_AND_UNSET_INSTALL_DIR_SUBDIRS)
|
macro (OCCT_CHECK_AND_UNSET_INSTALL_DIR_SUBDIRS)
|
||||||
|
@@ -7,7 +7,8 @@ if (NOT DEFINED ${3RDPARTY_QT_DIR} AND ${3RDPARTY_QT_DIR} STREQUAL "")
|
|||||||
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" Qt 3RDPARTY_QT_DIR_NAME)
|
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" Qt 3RDPARTY_QT_DIR_NAME)
|
||||||
|
|
||||||
if (NOT DEFINED ${3RDPARTY_QT_DIR_NAME} AND ${3RDPARTY_QT_DIR_NAME} STREQUAL "")
|
if (NOT DEFINED ${3RDPARTY_QT_DIR_NAME} AND ${3RDPARTY_QT_DIR_NAME} STREQUAL "")
|
||||||
message (FATAL_ERROR "... Qt root directory was not found")
|
set (3RDPARTY_QT_DIR "" CACHE PATH "The directory containing qt")
|
||||||
|
message (FATAL_ERROR "Could not find used third-party product: 3RDPARTY_QT_DIR")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Combine directory name with absolute path and show in GUI
|
# Combine directory name with absolute path and show in GUI
|
||||||
@@ -31,4 +32,10 @@ if (NOT ${Qt5_FOUND})
|
|||||||
#message (STATUS "Qt4 cmake configuration")
|
#message (STATUS "Qt4 cmake configuration")
|
||||||
else()
|
else()
|
||||||
#message (STATUS "Qt5 cmake configuration")
|
#message (STATUS "Qt5 cmake configuration")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (3RDPARTY_QT_DIR OR EXISTS "${3RDPARTY_QT_DIR}")
|
||||||
|
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_QT_DIR}/bin")
|
||||||
|
else()
|
||||||
|
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_QT_DLL_DIR)
|
||||||
|
endif()
|
||||||
|
@@ -82,6 +82,11 @@ if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Micr
|
|||||||
lappend ::SYS_VC_LIST "vc142-uwp"
|
lappend ::SYS_VC_LIST "vc142-uwp"
|
||||||
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
|
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
|
||||||
}
|
}
|
||||||
|
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] } {
|
||||||
|
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset ClangCL)"
|
||||||
|
lappend ::SYS_VC_LIST "vclang"
|
||||||
|
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
|
||||||
|
}
|
||||||
|
|
||||||
# detect installed Visual Studio instances from global environment
|
# detect installed Visual Studio instances from global environment
|
||||||
if { [info exists ::env(VS140COMNTOOLS)] } {
|
if { [info exists ::env(VS140COMNTOOLS)] } {
|
||||||
@@ -193,7 +198,11 @@ proc wokdep:gui:UpdateList {} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if { "$::HAVE_ZLIB" == "true" } {
|
if { "$::HAVE_ZLIB" == "true" } {
|
||||||
wokdep:SearchStandardLibrary anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs "zlib" "zlib.h" "zlib" {"zlib"}
|
set aCheckLib "z"
|
||||||
|
if { "$::tcl_platform(platform)" == "windows" } {
|
||||||
|
set aCheckLib "zlib"
|
||||||
|
}
|
||||||
|
wokdep:SearchStandardLibrary anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs "zlib" "zlib.h" "$aCheckLib" {"zlib"}
|
||||||
}
|
}
|
||||||
if { "$::HAVE_LIBLZMA" == "true" } {
|
if { "$::HAVE_LIBLZMA" == "true" } {
|
||||||
set aCheckLib "lzma"
|
set aCheckLib "lzma"
|
||||||
@@ -214,9 +223,14 @@ proc wokdep:gui:UpdateList {} {
|
|||||||
wokdep:SearchRapidJson anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
wokdep:SearchRapidJson anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
||||||
}
|
}
|
||||||
|
|
||||||
if { "$::CHECK_QT4" == "true" } {
|
if {"$::BUILD_Inspector" == "true" } {
|
||||||
wokdep:SearchQt4 anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
set ::CHECK_QT "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if { "$::CHECK_QT" == "true" } {
|
||||||
|
wokdep:SearchQt anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
||||||
|
}
|
||||||
|
|
||||||
if { "$::CHECK_JDK" == "true" } {
|
if { "$::CHECK_JDK" == "true" } {
|
||||||
wokdep:SearchJDK anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
wokdep:SearchJDK anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
||||||
}
|
}
|
||||||
@@ -485,11 +499,16 @@ ttk::label .myFrame.myChecks.myLzmaLbl -text "Use liblzma"
|
|||||||
checkbutton .myFrame.myChecks.myE57Check -offvalue "false" -onvalue "true" -variable HAVE_E57 -command wokdep:gui:UpdateList
|
checkbutton .myFrame.myChecks.myE57Check -offvalue "false" -onvalue "true" -variable HAVE_E57 -command wokdep:gui:UpdateList
|
||||||
ttk::label .myFrame.myChecks.myE57Lbl -text "Use E57"
|
ttk::label .myFrame.myChecks.myE57Lbl -text "Use E57"
|
||||||
|
|
||||||
checkbutton .myFrame.myChecks.myQt4Check -offvalue "false" -onvalue "true" -variable CHECK_QT4 -command wokdep:gui:UpdateList
|
checkbutton .myFrame.myChecks.myQtCheck -offvalue "false" -onvalue "true" -variable CHECK_QT -command wokdep:gui:UpdateList
|
||||||
ttk::label .myFrame.myChecks.myQt4Lbl -text "Search Qt4"
|
ttk::label .myFrame.myChecks.myQtLbl -text "Search Qt"
|
||||||
checkbutton .myFrame.myChecks.myJDKCheck -offvalue "false" -onvalue "true" -variable CHECK_JDK -command wokdep:gui:UpdateList
|
checkbutton .myFrame.myChecks.myJDKCheck -offvalue "false" -onvalue "true" -variable CHECK_JDK -command wokdep:gui:UpdateList
|
||||||
ttk::label .myFrame.myChecks.myJDKLbl -text "Search JDK"
|
ttk::label .myFrame.myChecks.myJDKLbl -text "Search JDK"
|
||||||
|
|
||||||
|
if { "$::tcl_platform(platform)" == "windows" } {
|
||||||
|
checkbutton .myFrame.myChecks.myInspectorBuild -offvalue "false" -onvalue "true" -variable BUILD_Inspector -command wokdep:gui:UpdateList
|
||||||
|
ttk::label .myFrame.myChecks.myInspectorLbl -text "Build Inspector"
|
||||||
|
}
|
||||||
|
|
||||||
# Additional headers search paths
|
# Additional headers search paths
|
||||||
ttk::label .myFrame.myIncLbl -text "Additional headers search paths:" -padding {5 5 80 5}
|
ttk::label .myFrame.myIncLbl -text "Additional headers search paths:" -padding {5 5 80 5}
|
||||||
scrollbar .myFrame.myIncScrl -command ".myFrame.myIncList yview"
|
scrollbar .myFrame.myIncScrl -command ".myFrame.myIncList yview"
|
||||||
@@ -593,8 +612,8 @@ if { "$::tcl_platform(os)" != "Darwin" } {
|
|||||||
grid .myFrame.myChecks.myZLibCheck -row $aCheckRowIter -column 6 -sticky e
|
grid .myFrame.myChecks.myZLibCheck -row $aCheckRowIter -column 6 -sticky e
|
||||||
grid .myFrame.myChecks.myZLibLbl -row $aCheckRowIter -column 7 -sticky w
|
grid .myFrame.myChecks.myZLibLbl -row $aCheckRowIter -column 7 -sticky w
|
||||||
|
|
||||||
grid .myFrame.myChecks.myQt4Check -row $aCheckRowIter -column 12 -sticky e
|
grid .myFrame.myChecks.myQtCheck -row $aCheckRowIter -column 12 -sticky e
|
||||||
grid .myFrame.myChecks.myQt4Lbl -row $aCheckRowIter -column 13 -sticky w
|
grid .myFrame.myChecks.myQtLbl -row $aCheckRowIter -column 13 -sticky w
|
||||||
|
|
||||||
incr aCheckRowIter
|
incr aCheckRowIter
|
||||||
grid .myFrame.myChecks.myFFmpegCheck -row $aCheckRowIter -column 0 -sticky e
|
grid .myFrame.myChecks.myFFmpegCheck -row $aCheckRowIter -column 0 -sticky e
|
||||||
@@ -619,6 +638,11 @@ grid .myFrame.myChecks.myRapidJsonLbl -row $aCheckRowIter -column 1 -sticky w
|
|||||||
grid .myFrame.myChecks.myE57Check -row $aCheckRowIter -column 6 -sticky e
|
grid .myFrame.myChecks.myE57Check -row $aCheckRowIter -column 6 -sticky e
|
||||||
grid .myFrame.myChecks.myE57Lbl -row $aCheckRowIter -column 7 -sticky w
|
grid .myFrame.myChecks.myE57Lbl -row $aCheckRowIter -column 7 -sticky w
|
||||||
|
|
||||||
|
if { "$::tcl_platform(platform)" == "windows" } {
|
||||||
|
grid .myFrame.myChecks.myInspectorBuild -row $aCheckRowIter -column 12 -sticky e
|
||||||
|
grid .myFrame.myChecks.myInspectorLbl -row $aCheckRowIter -column 13 -sticky w
|
||||||
|
}
|
||||||
|
|
||||||
incr aCheckRowIter
|
incr aCheckRowIter
|
||||||
|
|
||||||
# Additional headers search paths
|
# Additional headers search paths
|
||||||
|
@@ -68,7 +68,7 @@ if { [info exists ::env(SHORTCUT_HEADERS)] } {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# fetch environment variables (e.g. set by custom.sh or custom.bat) and set them as tcl variables with the same name
|
# fetch environment variables (e.g. set by custom.sh or custom.bat) and set them as tcl variables with the same name
|
||||||
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_E57 HAVE_RAPIDJSON HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo}
|
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_E57 HAVE_RAPIDJSON HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo BUILD_Inspector}
|
||||||
foreach anEnvIter $THE_ENV_VARIABLES {
|
foreach anEnvIter $THE_ENV_VARIABLES {
|
||||||
set ${anEnvIter} "false"
|
set ${anEnvIter} "false"
|
||||||
if { [info exists ::env(${anEnvIter})] } {
|
if { [info exists ::env(${anEnvIter})] } {
|
||||||
@@ -241,7 +241,11 @@ proc wokdep:Preferred {theList theCmpl theArch} {
|
|||||||
|
|
||||||
# keep only two first digits in "vc141"
|
# keep only two first digits in "vc141"
|
||||||
if { ! [regexp {^vc[0-9][0-9]} $theCmpl aCmpl] } {
|
if { ! [regexp {^vc[0-9][0-9]} $theCmpl aCmpl] } {
|
||||||
set aCmpl $theCmpl
|
if { [regexp {^vclang} $theCmpl] } {
|
||||||
|
set aCmpl vc14
|
||||||
|
} else {
|
||||||
|
set aCmpl $theCmpl
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set aShortList {}
|
set aShortList {}
|
||||||
@@ -631,7 +635,11 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
|
|||||||
|
|
||||||
# keep only two first digits in "vc141"
|
# keep only two first digits in "vc141"
|
||||||
if { ! [regexp {^vc[0-9][0-9]} ${::VCVER} aVcLib] } {
|
if { ! [regexp {^vc[0-9][0-9]} ${::VCVER} aVcLib] } {
|
||||||
set aVcLib ${::VCVER}
|
if { [regexp {^vclang} ${::VCVER}] } {
|
||||||
|
set aVcLib vc14
|
||||||
|
} else {
|
||||||
|
set aVcLib ${::VCVER}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set isFound "true"
|
set isFound "true"
|
||||||
@@ -1014,8 +1022,8 @@ proc wokdep:SearchVTK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
|
|||||||
return "$isFound"
|
return "$isFound"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Search Qt4 libraries placement
|
# Search Qt libraries placement
|
||||||
proc wokdep:SearchQt4 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
|
proc wokdep:SearchQt {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
|
||||||
upvar $theErrInc anErrInc
|
upvar $theErrInc anErrInc
|
||||||
upvar $theErrLib32 anErrLib32
|
upvar $theErrLib32 anErrLib32
|
||||||
upvar $theErrLib64 anErrLib64
|
upvar $theErrLib64 anErrLib64
|
||||||
@@ -1023,53 +1031,46 @@ proc wokdep:SearchQt4 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
|
|||||||
upvar $theErrBin64 anErrBin64
|
upvar $theErrBin64 anErrBin64
|
||||||
|
|
||||||
set isFound "true"
|
set isFound "true"
|
||||||
set aQMsgBoxHPath [wokdep:SearchHeader "QtGui/qmessagebox.h"]
|
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt}*] "$::VCVER" "$::ARCH" ]
|
||||||
|
set aQMsgBoxHPath [wokdep:SearchHeader "QtGui/qguiapplication.h"]
|
||||||
if { "$aQMsgBoxHPath" == "" } {
|
if { "$aQMsgBoxHPath" == "" } {
|
||||||
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$::ARCH" ]
|
if { "$aPath" != "" && [file exists "$aPath/include/QtGui/qguiapplication.h"] } {
|
||||||
if { "$aPath" != "" && [file exists "$aPath/include/QtGui/qmessagebox.h"] } {
|
|
||||||
lappend ::CSF_OPT_INC "$aPath/include"
|
lappend ::CSF_OPT_INC "$aPath/include"
|
||||||
lappend ::CSF_OPT_INC "$aPath/include/Qt"
|
lappend ::CSF_OPT_INC "$aPath/include/Qt"
|
||||||
lappend ::CSF_OPT_INC "$aPath/include/QtGui"
|
lappend ::CSF_OPT_INC "$aPath/include/QtGui"
|
||||||
lappend ::CSF_OPT_INC "$aPath/include/QtCore"
|
lappend ::CSF_OPT_INC "$aPath/include/QtCore"
|
||||||
|
lappend ::CSF_OPT_INC "$aPath/include/QtWidgets"
|
||||||
|
lappend ::CSF_OPT_INC "$aPath/include/QtXml"
|
||||||
} else {
|
} else {
|
||||||
if { [file exists "/usr/include/qt4/QtGui/qmessagebox.h"] } {
|
lappend anErrInc "Error: 'QtGui/qguiapplication.h' not found"
|
||||||
lappend ::CSF_OPT_INC "/usr/include/qt4"
|
|
||||||
lappend ::CSF_OPT_INC "/usr/include/qt4/Qt"
|
|
||||||
lappend ::CSF_OPT_INC "/usr/include/qt4/QtGui"
|
|
||||||
lappend ::CSF_OPT_INC "/usr/include/qt4/QtCore"
|
|
||||||
} else {
|
|
||||||
lappend anErrInc "Error: 'QtGui/qmessagebox.h' not found (Qt4)"
|
|
||||||
set isFound "false"
|
set isFound "false"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set aQtGuiLibName "QtGui"
|
set aQtGuiLibName "QtGui"
|
||||||
if { "$::tcl_platform(platform)" == "windows" } {
|
if { "$::tcl_platform(platform)" == "windows" } {
|
||||||
set aQtGuiLibName "QtGui4"
|
set aQtGuiLibName "Qt5Gui"
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach anArchIter {64 32} {
|
foreach anArchIter {64 32} {
|
||||||
set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter"]
|
set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter"]
|
||||||
if { "$aQMsgBoxLibPath" == "" } {
|
if { "$aQMsgBoxLibPath" == "" } {
|
||||||
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
|
|
||||||
set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter" "$aPath/lib"]
|
set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter" "$aPath/lib"]
|
||||||
if { "$aQMsgBoxLibPath" != "" } {
|
if { "$aQMsgBoxLibPath" != "" } {
|
||||||
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
|
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
|
||||||
} else {
|
} else {
|
||||||
lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aQtGuiLibName}.${::SYS_LIB_SUFFIX}' not found (Qt4)"
|
lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aQtGuiLibName}.${::SYS_LIB_SUFFIX}' not found (Qt)"
|
||||||
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
|
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if { "$::tcl_platform(platform)" == "windows" } {
|
if { "$::tcl_platform(platform)" == "windows" } {
|
||||||
set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter"]
|
set aQMsgBoxDllPath [wokdep:SearchBin "${aQtGuiLibName}.dll" "$anArchIter"]
|
||||||
if { "$aQMsgBoxDllPath" == "" } {
|
if { "$aQMsgBoxDllPath" == "" } {
|
||||||
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
|
set aQMsgBoxDllPath [wokdep:SearchBin "${aQtGuiLibName}.dll" "$anArchIter" "$aPath/bin"]
|
||||||
set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter" "$aPath/bin"]
|
|
||||||
if { "$aQMsgBoxDllPath" != "" } {
|
if { "$aQMsgBoxDllPath" != "" } {
|
||||||
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
|
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
|
||||||
} else {
|
} else {
|
||||||
lappend anErrBin$anArchIter "Error: 'QtGui4.dll' not found (Qt4)"
|
lappend anErrBin$anArchIter "Error: '${aQtGuiLibName}.dll' not found (Qt)"
|
||||||
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
|
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
530
adm/genproj.tcl
530
adm/genproj.tcl
File diff suppressed because it is too large
Load Diff
@@ -77,6 +77,9 @@ if "%VCVER:~-4%" == "-uwp" (
|
|||||||
set VCLIB=%VCLIB%-uwp
|
set VCLIB=%VCLIB%-uwp
|
||||||
set VCPROP=Universal
|
set VCPROP=Universal
|
||||||
)
|
)
|
||||||
|
if "%VCFMT%" == "vclang" (
|
||||||
|
set VCLIB=vc14
|
||||||
|
)
|
||||||
rem echo VCVER=%VCVER% VCFMT=%VCFMT% VCLIB=%VCLIB% VCPROP=%VCPROP%
|
rem echo VCVER=%VCVER% VCFMT=%VCFMT% VCLIB=%VCLIB% VCPROP=%VCPROP%
|
||||||
|
|
||||||
rem ----- Parsing of Visual Studio platform -----
|
rem ----- Parsing of Visual Studio platform -----
|
||||||
@@ -106,6 +109,10 @@ if not "%DevEnvDir%" == "" (
|
|||||||
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
||||||
set "DevEnvDir=%%i\Common7\IDE\"
|
set "DevEnvDir=%%i\Common7\IDE\"
|
||||||
)
|
)
|
||||||
|
) else if /I "%VCFMT%" == "vclang" (
|
||||||
|
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
||||||
|
set "DevEnvDir=%%i\Common7\IDE\"
|
||||||
|
)
|
||||||
) else if /I "%VCFMT%" == "gcc" (
|
) else if /I "%VCFMT%" == "gcc" (
|
||||||
rem MinGW
|
rem MinGW
|
||||||
) else (
|
) else (
|
||||||
@@ -118,6 +125,7 @@ if not "%DevEnvDir%" == "" (
|
|||||||
echo vc14 = VS 2015
|
echo vc14 = VS 2015
|
||||||
echo vc141 = VS 2017
|
echo vc141 = VS 2017
|
||||||
echo vc142 = VS 2019
|
echo vc142 = VS 2019
|
||||||
|
echo vclang = VS 2019 with ClangCL toolset
|
||||||
exit /B
|
exit /B
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -147,6 +155,11 @@ if /I "%VCFMT%" == "vc9" (
|
|||||||
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
|
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
|
||||||
)
|
)
|
||||||
set "VCPlatformToolSet=v142"
|
set "VCPlatformToolSet=v142"
|
||||||
|
) else if /I "%VCFMT%" == "vclang" (
|
||||||
|
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
|
||||||
|
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
|
||||||
|
)
|
||||||
|
set "VCPlatformToolSet=ClangCL"
|
||||||
) else if /I "%VCFMT%" == "gcc" (
|
) else if /I "%VCFMT%" == "gcc" (
|
||||||
rem MinGW
|
rem MinGW
|
||||||
) else (
|
) else (
|
||||||
|
@@ -159,7 +159,7 @@
|
|||||||
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
|
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>
|
||||||
<OutputFile>.\..\..\..\win32\__VCVER__\bind\__TKNAM__.dll</OutputFile>
|
<OutputFile>.\..\..\..\win32\__VCVER__\bind\__TKNAM__.dll</OutputFile>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<AdditionalLibraryDirectories>..\..\..\win32\__VCVER__\libd;$(CSF_OPT_LIB32D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>..\..\..\win32\__VCVER__\libd;$(CSF_OPT_LIB32D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
@@ -255,7 +255,7 @@
|
|||||||
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
|
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>
|
||||||
<OutputFile>.\..\..\..\win64\__VCVER__\bind\__TKNAM__.dll</OutputFile>
|
<OutputFile>.\..\..\..\win64\__VCVER__\bind\__TKNAM__.dll</OutputFile>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<AdditionalLibraryDirectories>..\..\..\win64\__VCVER__\libd;$(CSF_OPT_LIB64D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>..\..\..\win64\__VCVER__\libd;$(CSF_OPT_LIB64D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
@@ -149,7 +149,7 @@
|
|||||||
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
|
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<AdditionalLibraryDirectories>..\..\..\win32\__VCVER__\libd;$(CSF_OPT_LIB32D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>..\..\..\win32\__VCVER__\libd;$(CSF_OPT_LIB32D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
@@ -238,7 +238,7 @@
|
|||||||
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
|
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<AdditionalLibraryDirectories>..\..\..\win64\__VCVER__\libd;$(CSF_OPT_LIB64D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>..\..\..\win64\__VCVER__\libd;$(CSF_OPT_LIB64D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@@ -14,6 +14,7 @@ overview/overview.md
|
|||||||
../samples/qt/AndroidQt/ReadMe.md
|
../samples/qt/AndroidQt/ReadMe.md
|
||||||
../samples/java/jniviewer/ReadMe.md
|
../samples/java/jniviewer/ReadMe.md
|
||||||
../samples/ios/UIKitSample/ReadMe.md
|
../samples/ios/UIKitSample/ReadMe.md
|
||||||
|
../samples/webgl/ReadMe.md
|
||||||
|
|
||||||
tutorial/tutorial.md
|
tutorial/tutorial.md
|
||||||
|
|
||||||
|
@@ -64,7 +64,7 @@ Then makefiles will appear in the build folder (e.g. <i> D:/occt/build-android <
|
|||||||
|
|
||||||
Alternatively one may specify the values without a toolchain file:
|
Alternatively one may specify the values without a toolchain file:
|
||||||
|
|
||||||
> cmake -G "MinGW Makefiles" -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=D:/DevTools/android-ndk-r13b -DCMAKE_ANDROID_STL_TYPE=gnustl_shared -DCMAKE_SYSTEM_VERSION=15 -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_MAKE_PROGRAM=D:/DevTools/MinGW/bin/mingw32-make.exe -D3RDPARTY_DIR=D:/occt-3rdparty D:/occt
|
> cmake -G "MinGW Makefiles" -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=D:/DevTools/android-ndk-r13b -DCMAKE_ANDROID_STL_TYPE=gnustl_shared -DCMAKE_SYSTEM_VERSION=21 -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_MAKE_PROGRAM=D:/DevTools/MinGW/bin/mingw32-make.exe -D3RDPARTY_DIR=D:/occt-3rdparty D:/occt
|
||||||
|
|
||||||
@figure{/dev_guides/building/android/images/android_image006.png}
|
@figure{/dev_guides/building/android/images/android_image006.png}
|
||||||
|
|
||||||
|
@@ -150,7 +150,8 @@ Steps to prepare dump of the object into json:
|
|||||||
1. Create method <b>DumpJson</b>. The method should accept the output stream and the depth for the fields dump.
|
1. Create method <b>DumpJson</b>. The method should accept the output stream and the depth for the fields dump.
|
||||||
Depth, equal to zero means that only fields of this class should be dumped. Default value -1 means that whole tree of dump will be built recursively calling dump of all fields.
|
Depth, equal to zero means that only fields of this class should be dumped. Default value -1 means that whole tree of dump will be built recursively calling dump of all fields.
|
||||||
|
|
||||||
2. Put into the first row of the method <b>OCCT_DUMP_CLASS_BEGIN</b>. This macro creates a local variable, that will open Json structure on start, and close on exit from this method.
|
2. Put into the first row of the method <b>OCCT_DUMP_CLASS_BEGIN</b> or <b>OCCT_DUMP_TRANSIENT_CLASS_BEGIN</b> (for Standard_Transient objects).
|
||||||
|
This macro appends class name into output stream.
|
||||||
|
|
||||||
3. Add several macro to store field values.
|
3. Add several macro to store field values.
|
||||||
|
|
||||||
@@ -368,3 +369,53 @@ Each counter has its name shown when the collected statistics are printed.
|
|||||||
In DRAW, use command *dperf* to print all performance statistics.
|
In DRAW, use command *dperf* to print all performance statistics.
|
||||||
|
|
||||||
Note that performance counters are not thread-safe.
|
Note that performance counters are not thread-safe.
|
||||||
|
|
||||||
|
@section occt_debug_sanitizers Use of compiler sanitizers
|
||||||
|
|
||||||
|
GCC and Clang compilers provide options for instrumenting the code with the tools intended for detection of run-time errors, called sanitizers.
|
||||||
|
This section provides some hints for using sanitizers for detecting possible errors in OCCT code.
|
||||||
|
|
||||||
|
@subsection occt_debug_sanitizers_linux Linux
|
||||||
|
|
||||||
|
Example of configuration steps for Ubuntu:
|
||||||
|
|
||||||
|
1. In CMake configuration:
|
||||||
|
|
||||||
|
- Use up-to-date version of the GCC or CLang compiler; make sure that if CMAKE_CXX_COMPILER is set to C++ compiler (e.g. "clang++-6.0") and CMAKE_C_COMPILER is set to C compiler (e.g. "clang-6.0")
|
||||||
|
- Ensure that CMAKE_LINKER is set to the C++ linker bundled with compiler (e.g. clang++-6.0); this is important to avoid linking problems
|
||||||
|
- For building with Address sanitizer, set CMAKE_CXX_FLAGS and CMAKE_C_FLAGS to "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls"
|
||||||
|
- For building with Undefined Behavior sanitizer, set CMAKE_CXX_FLAGS and CMAKE_C_FLAGS to "-fsanitize=undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls"
|
||||||
|
- Set CMAKE_BUILD_TYPE to RelWithDebInfo to get more informative stack traces on errors
|
||||||
|
|
||||||
|
2. Build as usual (make)
|
||||||
|
|
||||||
|
Be prepared that it works much slower than normal build and consumes more disk space.
|
||||||
|
|
||||||
|
3. Before running executable, make sure that "llvm-symbolizer" is in PATH; this is necessary to get human-readable stack traces. The tool must have exactly that name.
|
||||||
|
|
||||||
|
If it is installed in common folder (/usr/bin or similar) with different name, one option is to create a symlink, for instance:
|
||||||
|
> sudo ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer
|
||||||
|
|
||||||
|
Alternatively, add directory where actual llvm-symbolizer is located (such as /usr/lib/llvm-6.0/bin) to the PATH variable.
|
||||||
|
|
||||||
|
4. Set environment variable to disable memory leaks detection (they seem to be reported for every global variable at exit, not much useful):
|
||||||
|
> export ASAN_OPTIONS=detect_leaks=0
|
||||||
|
|
||||||
|
5. Set environment variable CSF_CPULIMIT_FACTOR to reasonably large number to increase the time limits for program execution (used by OCCT tests) to compensate the performance penalty introduced by sanitizers:
|
||||||
|
> export CSF_CPULIMIT_FACTOR=20
|
||||||
|
|
||||||
|
6. When using UBSan, set environment variable UBSAN_OPTIONS to get stack traces:
|
||||||
|
> export UBSAN_OPTIONS=print_stacktrace=1
|
||||||
|
|
||||||
|
7. Run DRAW and perform tests as usual, keeping in mind that running with sanitizer is much heavier than normal build:
|
||||||
|
> ./draw.sh relwithdeb <br>
|
||||||
|
> Draw[]> testgrid -parallel 0
|
||||||
|
|
||||||
|
Note that when running tests under sanitizers, behavior may be different.
|
||||||
|
Known problems (as of CLang 6.0) are:
|
||||||
|
- Software signals (access violation etc.) are not handled
|
||||||
|
- Heap memory usage always reports zero
|
||||||
|
|
||||||
|
@subsection occt_debug_sanitizers_windows Windows
|
||||||
|
|
||||||
|
Though CLang toolset is available in Visual Studio 2015 and newer, sanitizer do not seem to be available out of the box (last tested with VS 2019 16.2.3).
|
||||||
|
@@ -1857,3 +1857,48 @@ The following API changes have been made:
|
|||||||
@subsection upgrade_740_stdnamespace Standard_Stream.hxx no more has "using std::" statements
|
@subsection upgrade_740_stdnamespace Standard_Stream.hxx no more has "using std::" statements
|
||||||
*Standard_Stream.hxx* header, commonly included by other OCCT header files, does no more add entities from *std namespace* related to streams (like *std::cout*, *std::istream* and others) into global namespace.
|
*Standard_Stream.hxx* header, commonly included by other OCCT header files, does no more add entities from *std namespace* related to streams (like *std::cout*, *std::istream* and others) into global namespace.
|
||||||
The application code relying on this matter should be updated to either specify std namespace explicitly (like std::cout) or add "using std::" statements locally.
|
The application code relying on this matter should be updated to either specify std namespace explicitly (like std::cout) or add "using std::" statements locally.
|
||||||
|
|
||||||
|
@section upgrade_occt750 Upgrade to OCCT 7.5.0
|
||||||
|
|
||||||
|
@subsection upgrade_750_srgb_color RGB color definition
|
||||||
|
|
||||||
|
OCCT 3D Viewer has been improved to properly perform lighting using in linear RGB color space and then convert result into non-linear gamma-shifted sRGB color space before displaying on display.
|
||||||
|
This change affects texture mapping, material definition and color definition.
|
||||||
|
|
||||||
|
Previously *Quantity_Color* definition was provided with unspecified RGB color space.
|
||||||
|
In practice, mixed color spaces have been actually used, with non-linear sRGB prevailing in general.
|
||||||
|
Since OCCT 7.5.0, *Quantity_Color* now specifies that components are defined in linear RGB color space.
|
||||||
|
|
||||||
|
This change affects following parts:
|
||||||
|
* Standard colors defined by *Quantity_NameOfColor* enumeration have been converted into linear RGB values within Quantity_Color construction.
|
||||||
|
* Application may use new enumeration value *Quantity_TOC_sRGB* for passing/fetching colors in sRGB color space,
|
||||||
|
which can be useful for interoperation with color picking widgets (returning 8-bit integer values within [0..255] range)
|
||||||
|
or for porting colors constants within old application code without manual conversion.
|
||||||
|
* *Graphic3d_MaterialAspect* color components are now expected in linear RGB color space,
|
||||||
|
and standard OCCT materials within *Graphic3d_NameOfMaterial* enumeration have been updated accordingly.
|
||||||
|
* Texture mapping now handles new *Graphic3d_TextureRoot::IsColorMap()* for interpreting content in linear RGB or sRGB color space.
|
||||||
|
It is responsibility of user specifying this flag correctly. The flag value is TRUE by default.
|
||||||
|
* Method *Image_PixMap::PixelColor()* has been extended with a new Boolean flag for performing linearization of non-linear sRGB.
|
||||||
|
This flag is FALSE by default; application should consider passing TRUE instead for further handling *Quantity_Color* properly as linear RGB values.
|
||||||
|
|
||||||
|
@subsection upgrade_750_aspectwindow Aspect_Window interface change
|
||||||
|
|
||||||
|
Unexpected const-ness of Aspect_Window::DoResize() method has been removed, so that application classes implementing this interface should be updated accordingly.
|
||||||
|
|
||||||
|
@subsection upgrade_750_rename Renaming of types
|
||||||
|
|
||||||
|
Enumeration BRepOffset_Type is renamed to ChFiDS_TypeOfConcavity.
|
||||||
|
|
||||||
|
@subsection upgrade_750_sensitiveEntity Select3D_SensitiveEntity interface change
|
||||||
|
|
||||||
|
The method Select3D_SensitiveEntity::NbSubElements() has been changed to be constant. Select3D_SensitiveEntity subclasses at application level should be updated accordingly.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection upgrade_750_Booleans Changes in Boolean operations algorithm
|
||||||
|
|
||||||
|
* TreatCompound method has been moved from *BOPAlgo_Tools* to *BOPTools_AlgoTools*. Additionally, the map parameter became optional:
|
||||||
|
~~~~
|
||||||
|
void BOPTools_AlgoTools::TreatCompound (const TopoDS_Shape& theS,
|
||||||
|
TopTools_ListOfShape& theLS,
|
||||||
|
TopTools_MapOfShape* theMap = NULL);
|
||||||
|
~~~~
|
||||||
|
BIN
dox/overview/images/sample_webgl.png
Normal file
BIN
dox/overview/images/sample_webgl.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 74 KiB |
@@ -153,6 +153,9 @@ on this tool.
|
|||||||
**RapidJSON** is an Open Source JSON parser and generator for C++.
|
**RapidJSON** is an Open Source JSON parser and generator for C++.
|
||||||
RapidJSON is optionally used by OCCT for reading glTF files (https://rapidjson.org/).
|
RapidJSON is optionally used by OCCT for reading glTF files (https://rapidjson.org/).
|
||||||
|
|
||||||
|
**DejaVu** fonts are a font family based on the Vera Fonts under a permissive license (MIT-like, https://dejavu-fonts.github.io/License.html).
|
||||||
|
DejaVu Sans (basic Latin sub-set) is used by OCCT as fallback font when no system font is available.
|
||||||
|
|
||||||
Adobe Systems, Inc. provides **Adobe Reader**, which can be used to view files in Portable Document Format (PDF).
|
Adobe Systems, Inc. provides **Adobe Reader**, which can be used to view files in Portable Document Format (PDF).
|
||||||
|
|
||||||
@section OCCT_OVW_SECTION_3 Documentation
|
@section OCCT_OVW_SECTION_3 Documentation
|
||||||
@@ -207,10 +210,11 @@ for which OCCT is certified to work.
|
|||||||
|
|
||||||
| OS | Compiler |
|
| OS | Compiler |
|
||||||
| --------- | ----------- |
|
| --------- | ----------- |
|
||||||
| Windows | Microsoft Visual Studio: 2008 SP1, 2010 SP1, 2012 Update 4, 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019 <br> GCC 4.3+ (Mingw-w64)|
|
| Windows | Microsoft Visual Studio: 2008 SP1, 2010 SP1, 2012 Update 4, 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
|
||||||
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
|
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
|
||||||
| OS X / macOS | XCode 6 or newer |
|
| OS X / macOS | XCode 6 or newer |
|
||||||
| Android | NDK r10, GNU gcc 4.8 or newer |
|
| Android | NDK r10, GNU gcc 4.8 or newer |
|
||||||
|
| Web | Emscripten SDK 1.39 or newer (CLang) |
|
||||||
|
|
||||||
1) VC++ 141 64-bit is used for regular testing and for building binary package of official release of OCCT on Windows.
|
1) VC++ 141 64-bit is used for regular testing and for building binary package of official release of OCCT on Windows.
|
||||||
|
|
||||||
@@ -569,3 +573,11 @@ There is a sample demonstrating usage of OCCT on iOS with Apple UIKit framework.
|
|||||||
@figure{/overview/images/sample_ios_uikit.png}
|
@figure{/overview/images/sample_ios_uikit.png}
|
||||||
|
|
||||||
See \subpage occt_samples_ios_uikit "iOS sample Readme" for details.
|
See \subpage occt_samples_ios_uikit "iOS sample Readme" for details.
|
||||||
|
|
||||||
|
@subsubsection OCCT_OVW_SECTION_7_3_6 Web
|
||||||
|
|
||||||
|
WebGL Viewer sample demonstrating usage of OCCT 3D Viewer in Web browser with Emscripten SDK can be found in `samples/webgl`.
|
||||||
|
|
||||||
|
@figure{/overview/images/sample_webgl.png}
|
||||||
|
|
||||||
|
See \subpage occt_samples_webgl "WebGL sample Readme" for details.
|
||||||
|
@@ -35,13 +35,49 @@
|
|||||||
|
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
//! Convert GLFW mouse button into Aspect_VKeyMouse.
|
||||||
|
static Aspect_VKeyMouse mouseButtonFromGlfw (int theButton)
|
||||||
|
{
|
||||||
|
switch (theButton)
|
||||||
|
{
|
||||||
|
case GLFW_MOUSE_BUTTON_LEFT: return Aspect_VKeyMouse_LeftButton;
|
||||||
|
case GLFW_MOUSE_BUTTON_RIGHT: return Aspect_VKeyMouse_RightButton;
|
||||||
|
case GLFW_MOUSE_BUTTON_MIDDLE: return Aspect_VKeyMouse_MiddleButton;
|
||||||
|
}
|
||||||
|
return Aspect_VKeyMouse_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Convert GLFW key modifiers into Aspect_VKeyFlags.
|
||||||
|
static Aspect_VKeyFlags keyFlagsFromGlfw (int theFlags)
|
||||||
|
{
|
||||||
|
Aspect_VKeyFlags aFlags = Aspect_VKeyFlags_NONE;
|
||||||
|
if ((theFlags & GLFW_MOD_SHIFT) != 0)
|
||||||
|
{
|
||||||
|
aFlags |= Aspect_VKeyFlags_SHIFT;
|
||||||
|
}
|
||||||
|
if ((theFlags & GLFW_MOD_CONTROL) != 0)
|
||||||
|
{
|
||||||
|
aFlags |= Aspect_VKeyFlags_CTRL;
|
||||||
|
}
|
||||||
|
if ((theFlags & GLFW_MOD_ALT) != 0)
|
||||||
|
{
|
||||||
|
aFlags |= Aspect_VKeyFlags_ALT;
|
||||||
|
}
|
||||||
|
if ((theFlags & GLFW_MOD_SUPER) != 0)
|
||||||
|
{
|
||||||
|
aFlags |= Aspect_VKeyFlags_META;
|
||||||
|
}
|
||||||
|
return aFlags;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ================================================================
|
// ================================================================
|
||||||
// Function : GlfwOcctView
|
// Function : GlfwOcctView
|
||||||
// Purpose :
|
// Purpose :
|
||||||
// ================================================================
|
// ================================================================
|
||||||
GlfwOcctView::GlfwOcctView()
|
GlfwOcctView::GlfwOcctView()
|
||||||
: myCurAction3d (CurAction3d_Nothing),
|
|
||||||
myToRedraw (true)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,15 +229,7 @@ void GlfwOcctView::mainloop()
|
|||||||
glfwWaitEvents();
|
glfwWaitEvents();
|
||||||
if (!myView.IsNull())
|
if (!myView.IsNull())
|
||||||
{
|
{
|
||||||
if (myView->IsInvalidated())
|
FlushViewEvents (myContext, myView, true);
|
||||||
{
|
|
||||||
myView->Redraw();
|
|
||||||
}
|
|
||||||
else if (myToRedraw)
|
|
||||||
{
|
|
||||||
myView->RedrawImmediate();
|
|
||||||
}
|
|
||||||
myToRedraw = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -237,7 +265,6 @@ void GlfwOcctView::onResize (int theWidth, int theHeight)
|
|||||||
myView->MustBeResized();
|
myView->MustBeResized();
|
||||||
myView->Invalidate();
|
myView->Invalidate();
|
||||||
myView->Redraw();
|
myView->Redraw();
|
||||||
//myToRedraw = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,13 +274,10 @@ void GlfwOcctView::onResize (int theWidth, int theHeight)
|
|||||||
// ================================================================
|
// ================================================================
|
||||||
void GlfwOcctView::onMouseScroll (double theOffsetX, double theOffsetY)
|
void GlfwOcctView::onMouseScroll (double theOffsetX, double theOffsetY)
|
||||||
{
|
{
|
||||||
if (myView.IsNull()) { return; }
|
if (!myView.IsNull())
|
||||||
|
{
|
||||||
const Graphic3d_Vec2i aPos = myOcctWindow->CursorPosition();
|
UpdateZoom (Aspect_ScrollDelta (myOcctWindow->CursorPosition(), int(theOffsetY * 8.0)));
|
||||||
myView->StartZoomAtPoint (aPos.x(), aPos.y());
|
}
|
||||||
myView->ZoomAtPoint (0, 0, int(theOffsetY * 4.0), int(theOffsetY * 4.0));
|
|
||||||
myView->Invalidate();
|
|
||||||
myToRedraw = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================================================================
|
// ================================================================
|
||||||
@@ -265,27 +289,13 @@ void GlfwOcctView::onMouseButton (int theButton, int theAction, int theMods)
|
|||||||
if (myView.IsNull()) { return; }
|
if (myView.IsNull()) { return; }
|
||||||
|
|
||||||
const Graphic3d_Vec2i aPos = myOcctWindow->CursorPosition();
|
const Graphic3d_Vec2i aPos = myOcctWindow->CursorPosition();
|
||||||
if (theAction != GLFW_PRESS)
|
if (theAction == GLFW_PRESS)
|
||||||
{
|
{
|
||||||
myCurAction3d = CurAction3d_Nothing;
|
PressMouseButton (aPos, mouseButtonFromGlfw (theButton), keyFlagsFromGlfw (theMods), false);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
myMouseMin = aPos;
|
|
||||||
myMouseMax = aPos;
|
|
||||||
switch (theButton)
|
|
||||||
{
|
{
|
||||||
case GLFW_MOUSE_BUTTON_RIGHT:
|
ReleaseMouseButton (aPos, mouseButtonFromGlfw (theButton), keyFlagsFromGlfw (theMods), false);
|
||||||
{
|
|
||||||
myCurAction3d = CurAction3d_DynamicRoation;
|
|
||||||
myView->StartRotation (aPos.x(), aPos.y());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GLFW_MOUSE_BUTTON_MIDDLE:
|
|
||||||
{
|
|
||||||
myCurAction3d = CurAction3d_DynamicPanning;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,30 +305,9 @@ void GlfwOcctView::onMouseButton (int theButton, int theAction, int theMods)
|
|||||||
// ================================================================
|
// ================================================================
|
||||||
void GlfwOcctView::onMouseMove (int thePosX, int thePosY)
|
void GlfwOcctView::onMouseMove (int thePosX, int thePosY)
|
||||||
{
|
{
|
||||||
if (myView.IsNull()) { return; }
|
const Graphic3d_Vec2i aNewPos (thePosX, thePosY);
|
||||||
|
if (!myView.IsNull())
|
||||||
switch (myCurAction3d)
|
|
||||||
{
|
{
|
||||||
case CurAction3d_DynamicRoation:
|
UpdateMousePosition (aNewPos, PressedMouseButtons(), LastMouseFlags(), false);
|
||||||
{
|
|
||||||
myView->Rotation (thePosX, thePosY);
|
|
||||||
myView->Invalidate();
|
|
||||||
myToRedraw = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case CurAction3d_DynamicPanning:
|
|
||||||
{
|
|
||||||
myView->Pan (thePosX - myMouseMax.x(), -(thePosY - myMouseMax.y()));
|
|
||||||
myView->Invalidate();
|
|
||||||
myToRedraw = true;
|
|
||||||
myMouseMax.SetValues (thePosX, thePosY);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
myContext->MoveTo (thePosX, thePosY, myView, false);
|
|
||||||
myToRedraw = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,20 +25,12 @@
|
|||||||
#include "GlfwOcctWindow.h"
|
#include "GlfwOcctWindow.h"
|
||||||
|
|
||||||
#include <AIS_InteractiveContext.hxx>
|
#include <AIS_InteractiveContext.hxx>
|
||||||
|
#include <AIS_ViewController.hxx>
|
||||||
#include <V3d_View.hxx>
|
#include <V3d_View.hxx>
|
||||||
|
|
||||||
//! Sample class creating 3D Viewer within GLFW window.
|
//! Sample class creating 3D Viewer within GLFW window.
|
||||||
class GlfwOcctView
|
class GlfwOcctView : protected AIS_ViewController
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
enum CurAction3d
|
|
||||||
{
|
|
||||||
CurAction3d_Nothing,
|
|
||||||
CurAction3d_DynamicZooming,
|
|
||||||
CurAction3d_DynamicPanning,
|
|
||||||
CurAction3d_DynamicRoation
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
GlfwOcctView();
|
GlfwOcctView();
|
||||||
@@ -115,11 +107,6 @@ private:
|
|||||||
Handle(V3d_View) myView;
|
Handle(V3d_View) myView;
|
||||||
Handle(AIS_InteractiveContext) myContext;
|
Handle(AIS_InteractiveContext) myContext;
|
||||||
|
|
||||||
CurAction3d myCurAction3d;
|
|
||||||
Graphic3d_Vec2i myMouseMin;
|
|
||||||
Graphic3d_Vec2i myMouseMax;
|
|
||||||
bool myToRedraw;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _GlfwOcctView_Header
|
#endif // _GlfwOcctView_Header
|
||||||
|
@@ -134,17 +134,17 @@ void GlfwOcctWindow::Unmap() const
|
|||||||
// Function : DoResize
|
// Function : DoResize
|
||||||
// Purpose :
|
// Purpose :
|
||||||
// ================================================================
|
// ================================================================
|
||||||
Aspect_TypeOfResize GlfwOcctWindow::DoResize() const
|
Aspect_TypeOfResize GlfwOcctWindow::DoResize()
|
||||||
{
|
{
|
||||||
if (glfwGetWindowAttrib (myGlfwWindow, GLFW_VISIBLE) == 1)
|
if (glfwGetWindowAttrib (myGlfwWindow, GLFW_VISIBLE) == 1)
|
||||||
{
|
{
|
||||||
int anXPos = 0, anYPos = 0, aWidth = 0, aHeight = 0;
|
int anXPos = 0, anYPos = 0, aWidth = 0, aHeight = 0;
|
||||||
glfwGetWindowPos (myGlfwWindow, &anXPos, &anYPos);
|
glfwGetWindowPos (myGlfwWindow, &anXPos, &anYPos);
|
||||||
glfwGetWindowSize(myGlfwWindow, &aWidth, &aHeight);
|
glfwGetWindowSize(myGlfwWindow, &aWidth, &aHeight);
|
||||||
*const_cast<Standard_Integer*>(&myXLeft ) = anXPos;
|
myXLeft = anXPos;
|
||||||
*const_cast<Standard_Integer*>(&myXRight ) = anXPos + aWidth;
|
myXRight = anXPos + aWidth;
|
||||||
*const_cast<Standard_Integer*>(&myYTop ) = anYPos;
|
myYTop = anYPos;
|
||||||
*const_cast<Standard_Integer*>(&myYBottom) = anYPos + aHeight;
|
myYBottom = anYPos + aHeight;
|
||||||
}
|
}
|
||||||
return Aspect_TOR_UNKNOWN;
|
return Aspect_TOR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@@ -65,7 +65,7 @@ public:
|
|||||||
virtual Aspect_Drawable NativeParentHandle() const Standard_OVERRIDE { return 0; }
|
virtual Aspect_Drawable NativeParentHandle() const Standard_OVERRIDE { return 0; }
|
||||||
|
|
||||||
//! Applies the resizing to the window <me>
|
//! Applies the resizing to the window <me>
|
||||||
virtual Aspect_TypeOfResize DoResize() const Standard_OVERRIDE;
|
virtual Aspect_TypeOfResize DoResize() Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Returns True if the window <me> is opened and False if the window is closed.
|
//! Returns True if the window <me> is opened and False if the window is closed.
|
||||||
virtual Standard_Boolean IsMapped() const Standard_OVERRIDE;
|
virtual Standard_Boolean IsMapped() const Standard_OVERRIDE;
|
||||||
|
@@ -44,7 +44,7 @@ public:
|
|||||||
virtual void Unmap() const Standard_OVERRIDE {}
|
virtual void Unmap() const Standard_OVERRIDE {}
|
||||||
|
|
||||||
//! Applies the resizing to the window <me>
|
//! Applies the resizing to the window <me>
|
||||||
virtual Aspect_TypeOfResize DoResize() const Standard_OVERRIDE { return Aspect_TOR_UNKNOWN; }
|
virtual Aspect_TypeOfResize DoResize() Standard_OVERRIDE { return Aspect_TOR_UNKNOWN; }
|
||||||
|
|
||||||
//! Apply the mapping change to the window <me>
|
//! Apply the mapping change to the window <me>
|
||||||
virtual Standard_Boolean DoMapping() const Standard_OVERRIDE { return Standard_True; }
|
virtual Standard_Boolean DoMapping() const Standard_OVERRIDE { return Standard_True; }
|
||||||
|
@@ -216,8 +216,7 @@ void GeomSources::DisplaySurface(CGeometryDoc* aDoc,
|
|||||||
|
|
||||||
void GeomSources::ResetView(CGeometryDoc* aDoc)
|
void GeomSources::ResetView(CGeometryDoc* aDoc)
|
||||||
{
|
{
|
||||||
aDoc->GetAISContext()->CurrentViewer()->InitActiveViews();
|
Handle(V3d_View) aView = aDoc->GetAISContext()->CurrentViewer()->ActiveViews().First();
|
||||||
Handle(V3d_View) aView = aDoc->GetAISContext()->CurrentViewer()->ActiveView();
|
|
||||||
aView->Reset();
|
aView->Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -68,8 +68,7 @@ void TexturesExt_Presentation::DoSample()
|
|||||||
void TexturesExt_Presentation::Init()
|
void TexturesExt_Presentation::Init()
|
||||||
{
|
{
|
||||||
// initialize v3d_view so it displays TexturesExt well
|
// initialize v3d_view so it displays TexturesExt well
|
||||||
getViewer()->InitActiveViews();
|
Handle(V3d_View) aView = getViewer()->ActiveViews().First();
|
||||||
Handle(V3d_View) aView = getViewer()->ActiveView();
|
|
||||||
aView->SetSize(ZVIEW_SIZE);
|
aView->SetSize(ZVIEW_SIZE);
|
||||||
|
|
||||||
// getDocument()->UpdateResultMessageDlg("Textured Shape",
|
// getDocument()->UpdateResultMessageDlg("Textured Shape",
|
||||||
|
@@ -1020,8 +1020,7 @@ void CViewer3dDoc::OnDumpView()
|
|||||||
pView->UpdateWindow();
|
pView->UpdateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
myViewer->InitActiveViews();
|
Handle(V3d_View) aView = myViewer->ActiveViews().First();
|
||||||
Handle(V3d_View) aView = myViewer->ActiveView();
|
|
||||||
ExportView (aView);
|
ExportView (aView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1012,65 +1012,61 @@ aParams.NbMsaaSamples = aParams.NbMsaaSamples == 0 ? 8 : 0;\n\
|
|||||||
GetDocument()->UpdateResultMessageDlg("SetAntialiasingOn/SetAntialiasingOff",Message);
|
GetDocument()->UpdateResultMessageDlg("SetAntialiasingOn/SetAntialiasingOff",Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CViewer3dView::OnClearLights()
|
void CViewer3dView::OnClearLights()
|
||||||
{
|
{
|
||||||
// Setting Off all viewer active lights
|
// Setting Off all viewer active lights
|
||||||
TColStd_ListOfTransient lights;
|
V3d_ListOfLight lights;
|
||||||
for(myView->Viewer()->InitActiveLights(); myView->Viewer()->MoreActiveLights(); myView->Viewer()->NextActiveLights())
|
for (V3d_ListOfLightIterator anIter = myView->Viewer()->ActiveLightIterator(); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
lights.Append(myView->Viewer()->ActiveLight());
|
lights.Append (anIter.Value());
|
||||||
}
|
}
|
||||||
TColStd_ListIteratorOfListOfTransient itrLights(lights);
|
V3d_ListOfLightIterator itrLights(lights);
|
||||||
for (; itrLights.More(); itrLights.Next())
|
for (; itrLights.More(); itrLights.Next())
|
||||||
{
|
{
|
||||||
Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());
|
myView->Viewer()->SetLightOff (itrLights.Value());
|
||||||
myView->Viewer()->SetLightOff(light);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setting Off all view active lights
|
// Setting Off all view active lights
|
||||||
lights.Clear();
|
lights.Clear();
|
||||||
for(myView->InitActiveLights(); myView->MoreActiveLights(); myView->NextActiveLights())
|
for (V3d_ListOfLightIterator anIter = myView->ActiveLightIterator(); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
lights.Append(myView->ActiveLight());
|
lights.Append (anIter.Value());
|
||||||
}
|
}
|
||||||
itrLights.Initialize(lights);
|
itrLights.Initialize (lights);
|
||||||
for (; itrLights.More(); itrLights.Next())
|
for (; itrLights.More(); itrLights.Next())
|
||||||
{
|
{
|
||||||
Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());
|
myView->SetLightOff (itrLights.Value());
|
||||||
myView->SetLightOff(light);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
myView->Viewer()->SetDefaultLights();// Setting the default lights on
|
myView->Viewer()->SetDefaultLights(); // Setting the default lights on
|
||||||
|
|
||||||
NbActiveLights = 2;// There are 2 default active lights
|
NbActiveLights = 2; // There are 2 default active lights
|
||||||
|
|
||||||
myView->Update();
|
myView->Update();
|
||||||
|
|
||||||
TCollection_AsciiString Message("\
|
TCollection_AsciiString Message("\
|
||||||
// Setting Off all viewer active lights\n\
|
// Setting Off all viewer active lights\n\
|
||||||
TColStd_ListOfTransient lights;\n\
|
V3d_ListOfLight lights;\n\
|
||||||
for(myView->Viewer()->InitActiveLights(); myView->Viewer()->MoreActiveLights(); myView->Viewer()->NextActiveLights())\n\
|
for (V3d_ListOfLightIterator anIter = myView->Viewer()->ActiveLightIterator(); anIter.More(); anIter.Next())\n\
|
||||||
{\n\
|
{\n\
|
||||||
lights.Append(myView->Viewer()->ActiveLight());\n\
|
lights.Append (anIter.Value());\n\
|
||||||
}\n\
|
}\n\
|
||||||
TColStd_ListIteratorOfListOfTransient itrLights(lights);\n\
|
V3d_ListOfLightIterator itrLights(lights);\n\
|
||||||
for (; itrLights.More(); itrLights.Next())\n\
|
for (; itrLights.More(); itrLights.Next())\n\
|
||||||
{\n\
|
{\n\
|
||||||
Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());\n\
|
myView->Viewer()->SetLightOff (itrLights.Value())\n\
|
||||||
myView->Viewer()->SetLightOff(light);\n\
|
|
||||||
}\n\
|
}\n\
|
||||||
\n\
|
\n\
|
||||||
// Setting Off all view active lights\n\
|
// Setting Off all view active lights\n\
|
||||||
lights.Clear();\n\
|
lights.Clear();\n\
|
||||||
for(myView->InitActiveLights(); myView->MoreActiveLights(); myView->NextActiveLights())\n\
|
for (V3d_ListOfLightIterator anIter = myView->ActiveLightIterator(); anIter.More(); anIter.Next())\n\
|
||||||
{\n\
|
{\n\
|
||||||
lights.Append(myView->ActiveLight());\n\
|
lights.Append (anIter.Value());\n\
|
||||||
}\n\
|
}\n\
|
||||||
itrLights.Initialize(lights);\n\
|
itrLights.Initialize(lights);\n\
|
||||||
for (; itrLights.More(); itrLights.Next())\n\
|
for (; itrLights.More(); itrLights.Next())\n\
|
||||||
{\n\
|
{\n\
|
||||||
Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());\n\
|
myView->SetLightOff (itrLights.Value());\n\
|
||||||
myView->SetLightOff(light);\n\
|
|
||||||
}\n\
|
}\n\
|
||||||
\n\
|
\n\
|
||||||
myView->Viewer()->SetDefaultLights();// Setting the default lights on\n\
|
myView->Viewer()->SetDefaultLights();// Setting the default lights on\n\
|
||||||
|
@@ -413,8 +413,7 @@ void CTriangulationDoc::OnDumpView()
|
|||||||
pView->UpdateWindow();
|
pView->UpdateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
myViewer->InitActiveViews();
|
Handle(V3d_View) aView = myViewer->ActiveViews().First();
|
||||||
Handle(V3d_View) aView = myViewer->ActiveView();
|
|
||||||
ExportView (aView);
|
ExportView (aView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -230,8 +230,7 @@ void COCCDemoDoc::OnDumpView()
|
|||||||
pView->UpdateWindow();
|
pView->UpdateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
myViewer->InitActiveViews();
|
Handle(V3d_View) aView = myViewer->ActiveViews().First();
|
||||||
Handle(V3d_View) aView = myViewer->ActiveView();
|
|
||||||
ExportView (aView);
|
ExportView (aView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -489,8 +489,7 @@ void OCC_3dBaseDoc::OnUpdateV3dButtons (CCmdUI* pCmdUI)
|
|||||||
// Common function to change raytracing params and redraw view
|
// Common function to change raytracing params and redraw view
|
||||||
void OCC_3dBaseDoc::OnObjectRayTracingAction()
|
void OCC_3dBaseDoc::OnObjectRayTracingAction()
|
||||||
{
|
{
|
||||||
myAISContext->CurrentViewer()->InitActiveViews();
|
Handle(V3d_View) aView = myAISContext->CurrentViewer()->ActiveViews().First();
|
||||||
Handle(V3d_View) aView = myAISContext->CurrentViewer()->ActiveView();
|
|
||||||
Graphic3d_RenderingParams& aParams = aView->ChangeRenderingParams();
|
Graphic3d_RenderingParams& aParams = aView->ChangeRenderingParams();
|
||||||
if (myRayTracingIsOn)
|
if (myRayTracingIsOn)
|
||||||
aParams.Method = Graphic3d_RM_RAYTRACING;
|
aParams.Method = Graphic3d_RM_RAYTRACING;
|
||||||
|
@@ -44,7 +44,7 @@ public:
|
|||||||
virtual void Unmap() const {}
|
virtual void Unmap() const {}
|
||||||
|
|
||||||
//! Applies the resizing to the window <me>
|
//! Applies the resizing to the window <me>
|
||||||
virtual Aspect_TypeOfResize DoResize() const { return Aspect_TOR_UNKNOWN; }
|
virtual Aspect_TypeOfResize DoResize() { return Aspect_TOR_UNKNOWN; }
|
||||||
|
|
||||||
//! Apply the mapping change to the window <me>
|
//! Apply the mapping change to the window <me>
|
||||||
virtual Standard_Boolean DoMapping() const { return Standard_True; }
|
virtual Standard_Boolean DoMapping() const { return Standard_True; }
|
||||||
|
@@ -81,7 +81,7 @@ void OcctWindow::Unmap() const
|
|||||||
// function : DoResize
|
// function : DoResize
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Aspect_TypeOfResize OcctWindow::DoResize() const
|
Aspect_TypeOfResize OcctWindow::DoResize()
|
||||||
{
|
{
|
||||||
int aMask = 0;
|
int aMask = 0;
|
||||||
Aspect_TypeOfResize aMode = Aspect_TOR_UNKNOWN;
|
Aspect_TypeOfResize aMode = Aspect_TOR_UNKNOWN;
|
||||||
@@ -126,10 +126,10 @@ Aspect_TypeOfResize OcctWindow::DoResize() const
|
|||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
*( ( Standard_Integer* )&myXLeft ) = myWidget->rect().left();
|
myXLeft = myWidget->rect().left();
|
||||||
*( ( Standard_Integer* )&myXRight ) = myWidget->rect().right();
|
myXRight = myWidget->rect().right();
|
||||||
*( ( Standard_Integer* )&myYTop ) = myWidget->rect().top();
|
myYTop = myWidget->rect().top();
|
||||||
*( ( Standard_Integer* )&myYBottom) = myWidget->rect().bottom();
|
myYBottom = myWidget->rect().bottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
return aMode;
|
return aMode;
|
||||||
|
@@ -51,7 +51,7 @@ public:
|
|||||||
virtual Aspect_Drawable NativeParentHandle() const;
|
virtual Aspect_Drawable NativeParentHandle() const;
|
||||||
|
|
||||||
//! Applies the resizing to the window <me>
|
//! Applies the resizing to the window <me>
|
||||||
virtual Aspect_TypeOfResize DoResize() const;
|
virtual Aspect_TypeOfResize DoResize();
|
||||||
|
|
||||||
//! Returns True if the window <me> is opened
|
//! Returns True if the window <me> is opened
|
||||||
//! and False if the window is closed.
|
//! and False if the window is closed.
|
||||||
|
@@ -276,7 +276,7 @@ blend result _model 2 _model_161
|
|||||||
# Show result
|
# Show result
|
||||||
pload VISUALIZATION
|
pload VISUALIZATION
|
||||||
vinit Driver1/Viewer1/View1
|
vinit Driver1/Viewer1/View1
|
||||||
vbackground -color 0.784314 0.784314 1
|
vbackground -color C8C8FF
|
||||||
vdisplay -dispMode 1 result
|
vdisplay -dispMode 1 result
|
||||||
vfit
|
vfit
|
||||||
vaspects result -setFaceBoundaryDraw 1 -mostContinuity c2
|
vaspects result -setFaceBoundaryDraw 1 -mostContinuity c2
|
||||||
|
@@ -262,7 +262,7 @@ unifysamedom result p_1
|
|||||||
# Show result
|
# Show result
|
||||||
pload VISUALIZATION
|
pload VISUALIZATION
|
||||||
vinit Driver1/Viewer1/View1
|
vinit Driver1/Viewer1/View1
|
||||||
vbackground -color 0.784314 0.784314 1
|
vbackground -color C8C8FF
|
||||||
vdisplay -dispMode 1 result
|
vdisplay -dispMode 1 result
|
||||||
vfit
|
vfit
|
||||||
vaspects result -setFaceBoundaryDraw 1
|
vaspects result -setFaceBoundaryDraw 1
|
||||||
|
@@ -86,7 +86,7 @@ sage " Fusion of this prism with the original part "
|
|||||||
sage " fuse result rr result"
|
sage " fuse result rr result"
|
||||||
sage " "
|
sage " "
|
||||||
fuse result rr result
|
fuse result rr result
|
||||||
donl result
|
donly result
|
||||||
nexplode result f
|
nexplode result f
|
||||||
erase result
|
erase result
|
||||||
fit
|
fit
|
||||||
@@ -108,13 +108,13 @@ ttranslate cyl cyl 0 7.5 0
|
|||||||
sage " Display the Shape on Hidden Line Mode "
|
sage " Display the Shape on Hidden Line Mode "
|
||||||
sage " hlr hid r"
|
sage " hlr hid r"
|
||||||
sage ""
|
sage ""
|
||||||
donl r
|
donly r
|
||||||
hlr hid r
|
hlr hid r
|
||||||
sage " Display the Shape on HLR Mode "
|
sage " Display the Shape on HLR Mode "
|
||||||
sage " hlr nohid r"
|
sage " hlr nohid r"
|
||||||
sage " hlr hlr r"
|
sage " hlr hlr r"
|
||||||
sage ""
|
sage ""
|
||||||
donl r
|
donly r
|
||||||
hlr nohid r
|
hlr nohid r
|
||||||
hlr hlr r
|
hlr hlr r
|
||||||
sage "Demo completed"
|
sage "Demo completed"
|
||||||
|
@@ -68,18 +68,18 @@ vlight add directional direction 0 -10 0 head 1 color white
|
|||||||
vdisplay b1 b2 b3 b4 b5 b6 b7 b8 b9 b10
|
vdisplay b1 b2 b3 b4 b5 b6 b7 b8 b9 b10
|
||||||
|
|
||||||
# set colors like in boxes of on OCC logo
|
# set colors like in boxes of on OCC logo
|
||||||
vsetcolor b1 0.8671875 0 0.16015625
|
vsetcolor b1 DD0029
|
||||||
vsetcolor b2 0.96484375 0.8671875 0
|
vsetcolor b2 F6DD00
|
||||||
vsetcolor b3 0.609375 0.97734375 0.09375
|
vsetcolor b3 98F918
|
||||||
vsetcolor b4 0.90234375 0 0.48046875
|
vsetcolor b4 E9007A
|
||||||
vsetcolor b5 0 0.48046875 0.73828125
|
vsetcolor b5 007ABC
|
||||||
vsetcolor b6 0.578125 0 0.48046875
|
vsetcolor b6 93007A
|
||||||
vsetcolor b7 0.93359375 0.609375 0
|
vsetcolor b7 EE9800
|
||||||
vsetcolor b8 0 0.70703125 0.9296875
|
vsetcolor b8 00B489
|
||||||
vsetcolor b9 0 0.64453125 0.48046875
|
vsetcolor b9 00A47A
|
||||||
vsetcolor b10 0 0.48046875 0.73828125
|
vsetcolor b10 007ABC
|
||||||
|
|
||||||
# set material to plastic for better look
|
# set material to plastic for better look
|
||||||
for {set i 1} {$i <= 10} {incr i} {vsetmaterial b$i plastic}
|
for {set i 1} {$i <= 10} {incr i} {vsetmaterial b$i plastic}
|
||||||
|
|
||||||
vdrawtext label "Which\nbox\nis\ncloser\nto\nyou?" -pos 0 -6 -2 -color 0 0 0 -halign left -valign bottom -angle 0 -zoom 0 -height 40
|
vdrawtext label "Which\nbox\nis\ncloser\nto\nyou?" -pos 0 -6 -2 -color BLACK -halign left -valign bottom -angle 0 -zoom 0 -height 40
|
||||||
|
@@ -255,27 +255,27 @@ if [info exists i7_show_3dview] {
|
|||||||
vlight add directional direction 1 -1 -2 head 1
|
vlight add directional direction 1 -1 -2 head 1
|
||||||
|
|
||||||
vdisplay case
|
vdisplay case
|
||||||
vsetcolor case 0.7 0.7 0.7
|
vsetcolor case GRAY70
|
||||||
|
|
||||||
vdisplay title
|
vdisplay title
|
||||||
vsetcolor title 0.1 0.1 0.1
|
vsetcolor title GRAY10
|
||||||
|
|
||||||
# board is mostly yellow (edges, triangle markers)
|
# board is mostly yellow (edges, triangle markers)
|
||||||
foreach f [explode board f] { vdisplay $f; vsetcolor $f 0.7 0.5 0.3 }
|
foreach f [explode board f] { vdisplay $f; vsetcolor $f B3803D }
|
||||||
# top and bottom faces are light-green (outside) and dark-green (inside)
|
# top and bottom faces are light-green (outside) and dark-green (inside)
|
||||||
vsetcolor board_4 0 0.6 0.55
|
vsetcolor board_4 00998C
|
||||||
vsetcolor board_5 0 0.6 0.55
|
vsetcolor board_5 00998C
|
||||||
vsetcolor board_12 0 0.3 0.33
|
vsetcolor board_12 004D54
|
||||||
vsetcolor board_14 0 0.3 0.33
|
vsetcolor board_14 004D54
|
||||||
|
|
||||||
vdisplay rpads
|
vdisplay rpads
|
||||||
vsetcolor rpads 0.7 0.6 0.4
|
vsetcolor rpads B39966
|
||||||
|
|
||||||
vdisplay bpads
|
vdisplay bpads
|
||||||
vsetcolor bpads 0.7 0.6 0.4
|
vsetcolor bpads B39966
|
||||||
|
|
||||||
vdisplay brpk
|
vdisplay brpk
|
||||||
vsetcolor brpk 0.5 0.4 0.3
|
vsetcolor brpk 80664D
|
||||||
|
|
||||||
donly board case rpads brpk; fit
|
donly board case rpads brpk; fit
|
||||||
}
|
}
|
||||||
@@ -287,17 +287,17 @@ pload OCAF XDE
|
|||||||
NewDocument D MDTV-XCAF
|
NewDocument D MDTV-XCAF
|
||||||
|
|
||||||
SetName D [XAddShape D board 0] "Board"
|
SetName D [XAddShape D board 0] "Board"
|
||||||
foreach f [explode board f] { XSetColor D $f 0.7 0.5 0.3 }
|
foreach f [explode board f] { XSetColor D $f B3803D }
|
||||||
XSetColor D board_4 0 0.6 0.55
|
XSetColor D board_4 00998C
|
||||||
XSetColor D board_5 0 0.6 0.55
|
XSetColor D board_5 00998C
|
||||||
XSetColor D board_12 0 0.3 0.33
|
XSetColor D board_12 004D54
|
||||||
XSetColor D board_14 0 0.3 0.33
|
XSetColor D board_14 004D54
|
||||||
|
|
||||||
SetName D [XAddShape D case 0] "Case"
|
SetName D [XAddShape D case 0] "Case"
|
||||||
XSetColor D case 0.7 0.7 0.7
|
XSetColor D case GRAY70
|
||||||
|
|
||||||
SetName D [XAddShape D title 0] "Case title"
|
SetName D [XAddShape D title 0] "Case title"
|
||||||
XSetColor D title 0.1 0.1 0.1
|
XSetColor D title GRAY10
|
||||||
|
|
||||||
SetName D [XAddShape D rpads 1] "Top side contact pads"
|
SetName D [XAddShape D rpads 1] "Top side contact pads"
|
||||||
SetName D [XAddShape D bpads 1] "Bottom contact pads"
|
SetName D [XAddShape D bpads 1] "Bottom contact pads"
|
||||||
@@ -306,17 +306,17 @@ SetName D [XFindShape D rpad] "Round pad"
|
|||||||
SetName D [XFindShape D Rpad] "Big round pad"
|
SetName D [XFindShape D Rpad] "Big round pad"
|
||||||
SetName D [XFindShape D spad_1] "Square pad 1"
|
SetName D [XFindShape D spad_1] "Square pad 1"
|
||||||
SetName D [XFindShape D spad_2] "Square pad 2"
|
SetName D [XFindShape D spad_2] "Square pad 2"
|
||||||
XSetColor D rpad 0.7 0.6 0.4
|
XSetColor D rpad B39966
|
||||||
XSetColor D Rpad 0.7 0.6 0.4
|
XSetColor D Rpad B39966
|
||||||
XSetColor D bpad 0.7 0.6 0.4
|
XSetColor D bpad B39966
|
||||||
XSetColor D spad_1 0.7 0.6 0.4
|
XSetColor D spad_1 B39966
|
||||||
XSetColor D spad_2 0.7 0.6 0.4
|
XSetColor D spad_2 B39966
|
||||||
|
|
||||||
SetName D [XAddShape D brpk 1] "Bottom packages"
|
SetName D [XAddShape D brpk 1] "Bottom packages"
|
||||||
SetName D [XFindShape D rpk] "Bottom package"
|
SetName D [XFindShape D rpk] "Bottom package"
|
||||||
XSetColor D rpk1 0.7 0.7 0.7
|
XSetColor D rpk1 GRAY70
|
||||||
XSetColor D rpk2 0.5 0.4 0.3
|
XSetColor D rpk2 80664D
|
||||||
XSetColor D rpk3 0.7 0.7 0.7
|
XSetColor D rpk3 GRAY70
|
||||||
|
|
||||||
XShow D
|
XShow D
|
||||||
vlight clear
|
vlight clear
|
||||||
|
@@ -36,9 +36,7 @@ set anArrAngle [expr 3.14 * 12.0 / 180.0]
|
|||||||
|
|
||||||
# Form dimension names list to set parameters with vdimparam command
|
# Form dimension names list to set parameters with vdimparam command
|
||||||
set aList {rd_1 rd_2 ad_1 ad_2 ad_3}
|
set aList {rd_1 rd_2 ad_1 ad_2 ad_3}
|
||||||
for {set i 1} {$i <= 10} {incr i} {
|
for {set i 1} {$i <= 10} {incr i} { lappend aList ld_$i }
|
||||||
lappend aList ld_$i
|
|
||||||
}
|
|
||||||
|
|
||||||
puts "Creating dimensions..."
|
puts "Creating dimensions..."
|
||||||
vdimension ld_1 -length -shapes bs_27 -plane xoy -color black -flyout -15
|
vdimension ld_1 -length -shapes bs_27 -plane xoy -color black -flyout -15
|
||||||
@@ -67,29 +65,14 @@ foreach i $aList {
|
|||||||
vfit
|
vfit
|
||||||
|
|
||||||
puts "Displaying exported shapes..."
|
puts "Displaying exported shapes..."
|
||||||
vdisplay a b
|
vdisplay -dispMode 1 a b
|
||||||
vsetdispmode a 1
|
|
||||||
vsetdispmode b 1
|
|
||||||
vaspects a -setmaterial steel
|
vaspects a -setmaterial steel
|
||||||
vaspects b -setmaterial bronze
|
vaspects b -setmaterial bronze
|
||||||
|
|
||||||
puts "Clipping shapes for better view..."
|
puts "Clipping shapes for better view..."
|
||||||
vclipplane create pa
|
|
||||||
vclipplane change pa equation 0 0 1 0
|
|
||||||
vclipplane change pa capping on
|
|
||||||
vclipplane change pa capping color 0.9 0.9 0.9
|
|
||||||
vclipplane set pa object a
|
|
||||||
|
|
||||||
vclipplane create pb
|
vclipplane pa -set a -equation 0 0 1 0 -capping on -color GRAY90 -texName $aHatch -texScale 0.05 -0.05
|
||||||
vclipplane change pb equation 0 0 1 0
|
vclipplane pb -set b -equation 0 0 1 0 -capping on -color GOLD -texName $aHatch -texScale 0.05 -0.05
|
||||||
vclipplane change pb capping on
|
|
||||||
vclipplane change pb capping color 1.0 0.8 0.0
|
|
||||||
vclipplane set pb object b
|
|
||||||
|
|
||||||
vclipplane change pa capping texname $aHatch
|
|
||||||
vclipplane change pa capping texscale 0.05 -0.05
|
|
||||||
vclipplane change pb capping texname $aHatch
|
|
||||||
vclipplane change pb capping texscale 0.05 0.05
|
|
||||||
|
|
||||||
vbottom
|
vbottom
|
||||||
vrotate -0.3 -0.3 0
|
vrotate -0.3 -0.3 0
|
||||||
|
@@ -77,14 +77,13 @@ SetName D $main "OCC Logo 2019"
|
|||||||
SetName D [XFindShape D sb] "Core"
|
SetName D [XFindShape D sb] "Core"
|
||||||
SetName D [XFindShape D tp] "Loop"
|
SetName D [XFindShape D tp] "Loop"
|
||||||
SetName D [XFindShape D rs] "Connector"
|
SetName D [XFindShape D rs] "Connector"
|
||||||
XSetColor D sb 1 0.21 0.32
|
XSetColor D sb FF3652
|
||||||
XSetColor D tp 0 0.667 0.855
|
XSetColor D tp 00AADA
|
||||||
XSetColor D rs 0 0.45 0.69
|
XSetColor D rs 0073B0
|
||||||
|
|
||||||
# display
|
# display
|
||||||
vinit
|
vinit View1
|
||||||
vsetcolorbg 1 1 1
|
vbackground -color WHITE
|
||||||
vsetdispmode 1
|
XDisplay -dispMode 1 D
|
||||||
XDisplay D
|
|
||||||
vtop
|
vtop
|
||||||
vfit
|
vfit
|
||||||
|
@@ -56,7 +56,7 @@ for { set aMarkerType 0 } { $aMarkerType <= 13 } { incr aMarkerType } {
|
|||||||
set aRow [expr $aMarkerType - 7]
|
set aRow [expr $aMarkerType - 7]
|
||||||
set aCol 5
|
set aCol 5
|
||||||
set aName [lindex $aMarkerTypeNames $aMarkerType]
|
set aName [lindex $aMarkerTypeNames $aMarkerType]
|
||||||
vdrawtext "$aName" "$aName" -pos 0 [expr $aRow + 0.5] 0 -color 0.5 1.0 1.0 -halign center -valign center -angle 000 -zoom 0 -height 12 -aspect bold -font $aLabelFont -noupdate
|
vdrawtext "$aName" "$aName" -pos 0 [expr $aRow + 0.5] 0 -color 7FFFFF -halign center -valign center -angle 000 -zoom 0 -height 12 -aspect bold -font $aLabelFont -noupdate
|
||||||
vdisplay -top -noupdate "$aName"
|
vdisplay -top -noupdate "$aName"
|
||||||
if { $aMarkerType == 13 } {
|
if { $aMarkerType == 13 } {
|
||||||
vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 PointsOnSide=1 FileName=$aCustom1
|
vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 PointsOnSide=1 FileName=$aCustom1
|
||||||
|
@@ -4,36 +4,22 @@
|
|||||||
#Title: Material properties in viewer
|
#Title: Material properties in viewer
|
||||||
|
|
||||||
set THE_MATERIALS {brass bronze copper gold jade neon_phc pewter obsidian plaster plastic satin silver steel stone chrome aluminium water glass diamond charcoal}
|
set THE_MATERIALS {brass bronze copper gold jade neon_phc pewter obsidian plaster plastic satin silver steel stone chrome aluminium water glass diamond charcoal}
|
||||||
set THE_COLORS {default red green blue1}
|
set THE_COLORS {default red green blue}
|
||||||
set THE_ROW_DIST 35
|
set THE_ROW_DIST 35
|
||||||
|
|
||||||
proc drawLabels {} {
|
proc drawLabels {} {
|
||||||
set x 20
|
set x 20
|
||||||
set y 15
|
set y 15
|
||||||
set r 0.098
|
|
||||||
set g 0.098
|
|
||||||
set b 0.098
|
|
||||||
foreach aMatIter $::THE_MATERIALS {
|
foreach aMatIter $::THE_MATERIALS {
|
||||||
vdrawtext "$aMatIter" "$aMatIter" -pos $x $y 0 -color $r $g $b -halign right -valign center -angle 000 -zoom 0 -height 14 -aspect regular -font Arial
|
vdrawtext "$aMatIter" "$aMatIter" -pos $x $y 0 -color GRAY10 -halign right -valign center -angle 000 -zoom 0 -height 14 -aspect regular -font Arial
|
||||||
incr y 10
|
incr y 10
|
||||||
}
|
}
|
||||||
set x 40
|
set x 40
|
||||||
set y 5
|
set y 5
|
||||||
foreach aColIter $::THE_COLORS {
|
foreach aColIter $::THE_COLORS {
|
||||||
if { $aColIter == "red" } {
|
set aLabColor "$aColIter"
|
||||||
set r 1.0
|
if { "$aColIter" == "default" } { set aLabColor BLACK }
|
||||||
set g 0.0
|
vdrawtext "$aColIter" "$aColIter" -pos $x $y 0 -color "$aLabColor" -halign center -valign center -angle 000 -zoom 0 -height 14 -aspect regular -font Arial
|
||||||
set b 0
|
|
||||||
} elseif { $aColIter == "green" } {
|
|
||||||
set r 0.0
|
|
||||||
set g 1.0
|
|
||||||
set b 0.0
|
|
||||||
} elseif { $aColIter == "blue1" } {
|
|
||||||
set r 0.0
|
|
||||||
set g 0.0
|
|
||||||
set b 1.0
|
|
||||||
}
|
|
||||||
vdrawtext "$aColIter" "$aColIter" -pos $x $y 0 -color $r $g $b -halign center -valign center -angle 000 -zoom 0 -height 14 -aspect regular -font Arial
|
|
||||||
incr x $::THE_ROW_DIST
|
incr x $::THE_ROW_DIST
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +55,7 @@ vclose ALL
|
|||||||
vinit View1 w=768 h=768
|
vinit View1 w=768 h=768
|
||||||
vtop
|
vtop
|
||||||
vglinfo
|
vglinfo
|
||||||
vbackground -gradient 0.705882 0.784314 1 0.705882 0.705882 0.705882 -gradientMode VERTICAL
|
vbackground -gradient B4C8FF B4B4B4 -gradientMode VERTICAL
|
||||||
|
|
||||||
vlight -change 0 -dir 0.577 -0.577 -0.577
|
vlight -change 0 -dir 0.577 -0.577 -0.577
|
||||||
vrenderparams -msaa 8
|
vrenderparams -msaa 8
|
||||||
|
@@ -57,11 +57,10 @@ for {set i 0} {$i < 12} {incr i} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Configure light sources
|
# Configure light sources
|
||||||
vlight del 1
|
vlight -change 0 -head 0
|
||||||
vlight change 0 head 0
|
vlight -change 0 -direction -0.25 -1 -1
|
||||||
vlight change 0 direction -0.25 -1 -1
|
vlight -change 0 -sm 0.3
|
||||||
vlight change 0 sm 0.3
|
vlight -change 0 -int 10.0
|
||||||
vlight change 0 int 10
|
|
||||||
|
|
||||||
# Load environment map
|
# Load environment map
|
||||||
vtextureenv on 1
|
vtextureenv on 1
|
||||||
|
@@ -12,11 +12,8 @@ vinit name=View1 w=512 h=512
|
|||||||
vglinfo
|
vglinfo
|
||||||
|
|
||||||
# setup light sources
|
# setup light sources
|
||||||
vlight del 0
|
vlight -clear
|
||||||
vlight del 1
|
vlight -add positional -head 0 -pos 0.5 0.5 0.85 -sm 0.06 -int 30.0
|
||||||
vlight add positional head 0 pos 0.5 0.5 0.85
|
|
||||||
vlight change 0 sm 0.06
|
|
||||||
vlight change 0 int 30.0
|
|
||||||
|
|
||||||
vvbo 0
|
vvbo 0
|
||||||
vsetdispmode 1
|
vsetdispmode 1
|
||||||
|
@@ -208,8 +208,9 @@ vviewparams -eye 139.412 -1.62643 178.037
|
|||||||
vviewparams -size 170.508
|
vviewparams -size 170.508
|
||||||
|
|
||||||
# Restore light source parameters
|
# Restore light source parameters
|
||||||
vlight clear
|
vlight -clear
|
||||||
vlight add directional direction -0.303949 -0.434084 -0.848048 smoothness 0.3 intensity 12
|
vlight -add ambient
|
||||||
|
vlight -add directional -direction -0.303949 -0.434084 -0.848048 -smoothness 0.3 -intensity 12
|
||||||
|
|
||||||
# Load environment map
|
# Load environment map
|
||||||
vtextureenv on 1
|
vtextureenv on 1
|
||||||
|
@@ -46,18 +46,17 @@ NewDocument D
|
|||||||
XAddShape D body_1
|
XAddShape D body_1
|
||||||
XAddShape D core_1
|
XAddShape D core_1
|
||||||
|
|
||||||
#XSetColor D body_1 0. 0. 1.
|
for {set i 1} {$i <= 26} {incr i} {XSetColor D body_1_$i BLUE}
|
||||||
for {set i 1} {$i <= 26} {incr i} {XSetColor D body_1_$i 0. 0. 1.}
|
XSetColor D body_1_1 E68066
|
||||||
XSetColor D body_1_1 0.9 0.5 0.4
|
XSetColor D body_1_9 E68066
|
||||||
XSetColor D body_1_9 0.9 0.5 0.4
|
for {set i 10} {$i <= 22} {incr i} {XSetColor D body_1_$i 99B300}
|
||||||
for {set i 10} {$i <= 22} {incr i} {XSetColor D body_1_$i 0.6 0.7 0.0}
|
XSetColor D core_1 1A1AFF
|
||||||
XSetColor D core_1 0.1 0.1 1.
|
foreach ff [explode core_1 f] { XSetColor D $ff 1A1AFF ; puts "set color $ff" }
|
||||||
foreach ff [explode core_1 f] { XSetColor D $ff 0.1 0.1 1. ; puts "set color $ff" }
|
|
||||||
|
|
||||||
XShow D
|
|
||||||
|
|
||||||
|
vclear
|
||||||
|
vinit View1
|
||||||
|
XDisplay -dispMode 1 D -explore
|
||||||
vfit
|
vfit
|
||||||
vsetdispmode 1
|
|
||||||
vrenderparams -msaa 8
|
vrenderparams -msaa 8
|
||||||
vbackground -color WHITE
|
vbackground -color WHITE
|
||||||
|
|
||||||
|
91
samples/tcl/vis_pbr_spheres.tcl
Normal file
91
samples/tcl/vis_pbr_spheres.tcl
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
# Script demonstrating PBR metallic-roughness material properties
|
||||||
|
#Category: Visualization
|
||||||
|
#Title: PBR metallic-rougness spheres
|
||||||
|
|
||||||
|
pload XDE OCAF MODELING VISUALIZATION
|
||||||
|
psphere s 0.35
|
||||||
|
|
||||||
|
catch { Close D }
|
||||||
|
XNewDoc D
|
||||||
|
|
||||||
|
# grid of spheres
|
||||||
|
set THE_UPPER 6
|
||||||
|
foreach i [list 0 3] {
|
||||||
|
set aPrefix ""
|
||||||
|
set aColor "GRAY80"
|
||||||
|
if { $i != 0 } {
|
||||||
|
set aPrefix "g_";
|
||||||
|
set aColor "CCB11D"
|
||||||
|
}
|
||||||
|
set aColShapes {}
|
||||||
|
for { set m 0 } { $m <= $THE_UPPER } { incr m } {
|
||||||
|
set aRowShapes {}
|
||||||
|
for { set r 0 } { $r <= $THE_UPPER } { incr r } {
|
||||||
|
set aName ${aPrefix}m${m}r${r}
|
||||||
|
copy s $aName
|
||||||
|
lappend aRowShapes $aName
|
||||||
|
ttranslate $aName ${r} ${i} ${m}
|
||||||
|
}
|
||||||
|
set aName ${aPrefix}m${m}
|
||||||
|
compound {*}$aRowShapes $aName
|
||||||
|
lappend aColShapes $aName
|
||||||
|
}
|
||||||
|
set aName ${aPrefix}spheres
|
||||||
|
compound {*}$aColShapes $aName
|
||||||
|
set aLabName "Gray Spheres"
|
||||||
|
if { $i != 0 } { set aLabName "Golden Spheres" }
|
||||||
|
set aLabComp [XAddShape D $aName 0]
|
||||||
|
SetName D $aLabComp $aLabName
|
||||||
|
|
||||||
|
for { set m 0 } { $m <= $THE_UPPER } { incr m } {
|
||||||
|
set aMet [expr 100 * ${m}/$THE_UPPER]
|
||||||
|
set aName ${aPrefix}m${m}
|
||||||
|
XAddComponent D $aLabComp $aName
|
||||||
|
set aLabCompCol [XFindShape D $aName]
|
||||||
|
SetName D $aLabCompCol "${aPrefix}m${aMet}%"
|
||||||
|
SetName D {*}[XFindComponent D $aName] "${aPrefix}m${aMet}%"
|
||||||
|
for { set r 0 } { $r <= $THE_UPPER } { incr r } {
|
||||||
|
set aRoug [expr 100 * ${r}/$THE_UPPER]
|
||||||
|
set aName ${aPrefix}m${m}r${r}
|
||||||
|
XAddComponent D $aLabCompCol $aName
|
||||||
|
set aLab [XFindComponent D $aName]
|
||||||
|
SetName D {*}$aLab "${aPrefix}m${aMet}%_r${aRoug}%"
|
||||||
|
XAddVisMaterial D $aName -baseColor $aColor -metallic ${m}/$THE_UPPER -roughness ${r}/$THE_UPPER
|
||||||
|
XSetVisMaterial D {*}$aLab $aName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set aLab [XFindShape D s]
|
||||||
|
SetName D {*}$aLab "Sphere"
|
||||||
|
|
||||||
|
XGetAllVisMaterials D
|
||||||
|
|
||||||
|
# labels
|
||||||
|
text2brep tm "Metal" -plane 0 -1 0 0 0 -1 -height 0.5 -pos -0.5 0 6.5 -halign left -valign top -font monospace
|
||||||
|
text2brep tnm "Non-metal" -plane 0 -1 0 0 0 -1 -height 0.5 -pos -0.5 0 -0.5 -halign right -valign top -font monospace
|
||||||
|
text2brep ts "Smooth" -plane 0 -1 0 1 0 0 -height 0.5 -pos -0.5 0 -0.5 -halign left -valign top -font monospace
|
||||||
|
text2brep tr "Rough" -plane 0 -1 0 1 0 0 -height 0.5 -pos 6.5 0 -0.5 -halign right -valign top -font monospace
|
||||||
|
compound tm tnm ts tr labs
|
||||||
|
set aLab [XAddShape D labs 0]
|
||||||
|
SetName D $aLab "Labels"
|
||||||
|
XAddComponent D $aLab tm
|
||||||
|
XAddComponent D $aLab tnm
|
||||||
|
XAddComponent D $aLab ts
|
||||||
|
XAddComponent D $aLab tr
|
||||||
|
SetName D {*}[XFindComponent D tm] "Metal"
|
||||||
|
SetName D [XFindShape D tm] "Metal"
|
||||||
|
SetName D {*}[XFindComponent D tnm] "Non-metal"
|
||||||
|
SetName D [XFindShape D tnm] "Non-metal"
|
||||||
|
SetName D {*}[XFindComponent D ts] "Smooth"
|
||||||
|
SetName D [XFindShape D ts] "Smooth"
|
||||||
|
SetName D {*}[XFindComponent D tr] "Rough"
|
||||||
|
SetName D [XFindShape D tr] "Rough"
|
||||||
|
|
||||||
|
vclear
|
||||||
|
vinit View1 -width 768 -height 768
|
||||||
|
vfront
|
||||||
|
vrenderparams -shadingModel PBR
|
||||||
|
vlight -change 0 -intensity 2.5
|
||||||
|
XDisplay -dispMode 1 D
|
||||||
|
vcamera -ortho
|
||||||
|
vfit
|
@@ -28,19 +28,20 @@ SetName D [XFindShape D link]:2 "Nut instance 1"
|
|||||||
SetName D [XFindShape D link]:3 "Nut instance 2"
|
SetName D [XFindShape D link]:3 "Nut instance 2"
|
||||||
|
|
||||||
puts "- Pin will be white"
|
puts "- Pin will be white"
|
||||||
XSetColor D [XFindShape D pin] 1 1 1
|
XSetColor D [XFindShape D pin] WHITE
|
||||||
puts "- Nut itself will be dark gray"
|
puts "- Nut itself will be dark gray"
|
||||||
XSetColor D [XFindShape D nut] 0.1 0.1 0.1
|
XSetColor D [XFindShape D nut] GRAY10
|
||||||
puts "- Nut instance #1 will be red"
|
puts "- Nut instance #1 will be red"
|
||||||
XSetColor D [XFindShape D link]:2 1 0 0
|
XSetColor D [XFindShape D link]:2 RED
|
||||||
puts "- Nut instance #2 will be green"
|
puts "- Nut instance #2 will be green"
|
||||||
XSetColor D [XFindShape D link]:3 0 1 0
|
XSetColor D [XFindShape D link]:3 GREEN
|
||||||
|
|
||||||
puts "Starting DF browser..."
|
puts "Starting DF browser..."
|
||||||
DFBrowse D
|
DFBrowse D
|
||||||
puts "Expand the document tree to see its structure and assigned names"
|
puts "Expand the document tree to see its structure and assigned names"
|
||||||
|
|
||||||
puts "Showing assembly in 3d view..."
|
puts "Showing assembly in 3d view..."
|
||||||
XShow D
|
vclear
|
||||||
|
vinit View1
|
||||||
|
XDisplay -dispMode 1 D -explore
|
||||||
vfit
|
vfit
|
||||||
vsetdispmode 1
|
|
||||||
|
2
samples/webgl/.gitignore
vendored
Normal file
2
samples/webgl/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/build
|
||||||
|
/work
|
66
samples/webgl/CMakeLists.txt
Normal file
66
samples/webgl/CMakeLists.txt
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.2)
|
||||||
|
|
||||||
|
project(occt-webgl-sample)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(APP_VERSION_MAJOR 1)
|
||||||
|
set(APP_VERSION_MINOR 0)
|
||||||
|
set(APP_TARGET occt-webgl-sample)
|
||||||
|
|
||||||
|
# customize build
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM=1")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_WEBGL2=1")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
|
||||||
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s SAFE_HEAP=1")
|
||||||
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_EXIT_RUNTIME=1")
|
||||||
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s TOTAL_MEMORY=16MB")
|
||||||
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ABORTING_MALLOC=0")
|
||||||
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s FORCE_FILESYSTEM=1")
|
||||||
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --preload-file myFile")
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
|
||||||
|
file(GLOB SOURCES
|
||||||
|
*.h
|
||||||
|
*.cpp
|
||||||
|
)
|
||||||
|
source_group ("Headers" FILES
|
||||||
|
WasmOcctView.h)
|
||||||
|
source_group ("Sources" FILES
|
||||||
|
WasmOcctView.cpp
|
||||||
|
main.cpp)
|
||||||
|
|
||||||
|
# FreeType
|
||||||
|
find_package(freetype REQUIRED NO_DEFAULT_PATH)
|
||||||
|
if(freetype_FOUND)
|
||||||
|
message (STATUS "Using FreeType from \"${freetype_DIR}\"" )
|
||||||
|
else()
|
||||||
|
message(WARNING "Could not find FreeType, please set freetype_DIR variable." )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Open CASCADE Technology
|
||||||
|
find_package(OpenCASCADE REQUIRED NO_DEFAULT_PATH)
|
||||||
|
if(OpenCASCADE_FOUND)
|
||||||
|
message (STATUS "Using OpenCASCADE from \"${OpenCASCADE_DIR}\"" )
|
||||||
|
INCLUDE_DIRECTORIES(${OpenCASCADE_INCLUDE_DIR})
|
||||||
|
LINK_DIRECTORIES(${OpenCASCADE_LIBRARY_DIR})
|
||||||
|
else()
|
||||||
|
message(WARNING "Could not find OpenCASCADE, please set OpenCASCADE_DIR variable." )
|
||||||
|
set(OCCT_LIBRARY_DIR)
|
||||||
|
set(OCCT_BIN_DIR)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(OpenCASCADE_LIBS TKRWMesh TKBinXCAF TKBin TKBinL TKOpenGl TKXCAF TKVCAF TKCAF TKV3d TKHLR TKMesh TKService TKShHealing TKPrim TKTopAlgo TKGeomAlgo TKBRep TKGeomBase TKG3d TKG2d TKMath TKLCAF TKCDF TKernel)
|
||||||
|
|
||||||
|
add_executable(${APP_TARGET} ${SOURCES})
|
||||||
|
target_link_libraries(
|
||||||
|
${APP_TARGET}
|
||||||
|
${OpenCASCADE_LIBS}
|
||||||
|
freetype
|
||||||
|
)
|
||||||
|
set_target_properties(${APP_TARGET} PROPERTIES LINK_FLAGS "-s EXPORTED_FUNCTIONS=['_main','_onFileDataRead'] -s EXTRA_EXPORTED_RUNTIME_METHODS=['ccall','cwrap']")
|
||||||
|
|
||||||
|
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.wasm DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||||
|
install(FILES occt-webgl-sample.html DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||||
|
install(FILES ${OpenCASCADE_RESOURCE_DIR}/DrawResources/OCC_logo.png DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||||
|
install(FILES ${OpenCASCADE_RESOURCE_DIR}/DrawResources/lamp.ico DESTINATION ${CMAKE_INSTALL_PREFIX})
|
28
samples/webgl/ReadMe.md
Normal file
28
samples/webgl/ReadMe.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
OCCT WebGL Viewer sample {#occt_samples_webgl}
|
||||||
|
==================
|
||||||
|
|
||||||
|
This sample demonstrates simple way of using OCCT libraries in Web application written in C++ and translated into WebAssembly module using Emscripten SDK (emsdk):
|
||||||
|
https://emscripten.org/
|
||||||
|
|
||||||
|
Sample consists of the Open CASCADE 3D Viewer with a button for opening a model in BREP format.
|
||||||
|
The sample requires a WebGL 2.0 capable browser supporting WebAssembly 1.0 (Wasm).
|
||||||
|
|
||||||
|
Installation and configuration:
|
||||||
|
1. Install Emscripten SDK and activate minimal configuration (Python, Java and CLang) following *emsdk* documentation. Activate also MinGW when building sample on Windows host.
|
||||||
|
2. Build (using *emsdk*) or download FreeType static library.
|
||||||
|
3. Configure CMake for building Open CASCADE Technology (OCCT) static libraries (BUILD_LIBRARY_TYPE="Static").
|
||||||
|
For this, activate *emsdk* command prompt, configure CMake for building OCCT using cross-compilation toolchain, disable *BUILD_MODULE_Draw*.
|
||||||
|
4. Perform building and installation steps.
|
||||||
|
~~~~~
|
||||||
|
> ${EMSDK}/fastcomp/emscripten/cmake/Modules/Platform/Emscripten.cmake
|
||||||
|
~~~~~
|
||||||
|
5. Configure CMake for building this WebGL sample using *emsdk* with paths to OCCT and FreeType. Perform building and installation steps.
|
||||||
|
6. Copy data/occ/Ball.brep from OCCT into "samples" folder within WebGL sample installation path.
|
||||||
|
7. Navigate to installation folder and start web server from it; Python coming with *emsdk* can be used for this purpose:
|
||||||
|
~~~~~
|
||||||
|
> python -m SimpleHTTPServer 8080
|
||||||
|
~~~~~
|
||||||
|
8. Open compatible browser and enter path taking into account your web server settings:
|
||||||
|
~~~~~
|
||||||
|
> http://localhost:8080/occt-webgl-sample.html
|
||||||
|
~~~~~
|
678
samples/webgl/WasmOcctView.cpp
Normal file
678
samples/webgl/WasmOcctView.cpp
Normal file
@@ -0,0 +1,678 @@
|
|||||||
|
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of the examples of the Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
|
||||||
|
|
||||||
|
#include "WasmOcctView.h"
|
||||||
|
|
||||||
|
#include "WasmVKeys.h"
|
||||||
|
|
||||||
|
#include <AIS_Shape.hxx>
|
||||||
|
#include <AIS_ViewCube.hxx>
|
||||||
|
#include <Aspect_Handle.hxx>
|
||||||
|
#include <Aspect_DisplayConnection.hxx>
|
||||||
|
#include <Aspect_NeutralWindow.hxx>
|
||||||
|
#include <Message.hxx>
|
||||||
|
#include <Message_Messenger.hxx>
|
||||||
|
#include <OpenGl_GraphicDriver.hxx>
|
||||||
|
#include <Prs3d_DatumAspect.hxx>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#define THE_CANVAS_ID "canvas"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
EM_JS(int, jsCanvasGetWidth, (), {
|
||||||
|
return canvas.width;
|
||||||
|
});
|
||||||
|
|
||||||
|
EM_JS(int, jsCanvasGetHeight, (), {
|
||||||
|
return canvas.height;
|
||||||
|
});
|
||||||
|
|
||||||
|
EM_JS(float, jsDevicePixelRatio, (), {
|
||||||
|
var aDevicePixelRatio = window.devicePixelRatio || 1;
|
||||||
|
return aDevicePixelRatio;
|
||||||
|
});
|
||||||
|
|
||||||
|
//! Return cavas size in pixels.
|
||||||
|
static Graphic3d_Vec2i jsCanvasSize()
|
||||||
|
{
|
||||||
|
return Graphic3d_Vec2i (jsCanvasGetWidth(), jsCanvasGetHeight());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : WasmOcctView
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
WasmOcctView::WasmOcctView()
|
||||||
|
: myDevicePixelRatio (1.0f),
|
||||||
|
myUpdateRequests (0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : ~WasmOcctView
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
WasmOcctView::~WasmOcctView()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : run
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
void WasmOcctView::run()
|
||||||
|
{
|
||||||
|
initWindow();
|
||||||
|
initViewer();
|
||||||
|
initDemoScene();
|
||||||
|
if (myView.IsNull())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
myView->MustBeResized();
|
||||||
|
myView->Redraw();
|
||||||
|
|
||||||
|
// There is no inifinite message loop, main() will return from here immediately.
|
||||||
|
// Tell that our Module should be left loaded and handle events through callbacks.
|
||||||
|
//emscripten_set_main_loop (redrawView, 60, 1);
|
||||||
|
//emscripten_set_main_loop (redrawView, -1, 1);
|
||||||
|
EM_ASM(Module['noExitRuntime'] = true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : initWindow
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
void WasmOcctView::initWindow()
|
||||||
|
{
|
||||||
|
myDevicePixelRatio = jsDevicePixelRatio();
|
||||||
|
myCanvasId = THE_CANVAS_ID;
|
||||||
|
const char* aTargetId = !myCanvasId.IsEmpty() ? myCanvasId.ToCString() : NULL;
|
||||||
|
const EM_BOOL toUseCapture = EM_TRUE;
|
||||||
|
emscripten_set_resize_callback (NULL, this, toUseCapture, onResizeCallback);
|
||||||
|
|
||||||
|
emscripten_set_mousedown_callback (NULL, this, toUseCapture, onMouseCallback);
|
||||||
|
emscripten_set_mouseup_callback (NULL, this, toUseCapture, onMouseCallback);
|
||||||
|
emscripten_set_mousemove_callback (NULL, this, toUseCapture, onMouseCallback);
|
||||||
|
emscripten_set_dblclick_callback (aTargetId, this, toUseCapture, onMouseCallback);
|
||||||
|
emscripten_set_click_callback (aTargetId, this, toUseCapture, onMouseCallback);
|
||||||
|
emscripten_set_mouseenter_callback (aTargetId, this, toUseCapture, onMouseCallback);
|
||||||
|
emscripten_set_mouseleave_callback (aTargetId, this, toUseCapture, onMouseCallback);
|
||||||
|
emscripten_set_wheel_callback (aTargetId, this, toUseCapture, onWheelCallback);
|
||||||
|
|
||||||
|
emscripten_set_touchstart_callback (aTargetId, this, toUseCapture, onTouchCallback);
|
||||||
|
emscripten_set_touchend_callback (aTargetId, this, toUseCapture, onTouchCallback);
|
||||||
|
emscripten_set_touchmove_callback (aTargetId, this, toUseCapture, onTouchCallback);
|
||||||
|
emscripten_set_touchcancel_callback(aTargetId, this, toUseCapture, onTouchCallback);
|
||||||
|
|
||||||
|
//emscripten_set_keypress_callback (NULL, this, toUseCapture, onKeyCallback);
|
||||||
|
emscripten_set_keydown_callback (NULL, this, toUseCapture, onKeyDownCallback);
|
||||||
|
emscripten_set_keyup_callback (NULL, this, toUseCapture, onKeyUpCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : dumpGlInfo
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
void WasmOcctView::dumpGlInfo (bool theIsBasic)
|
||||||
|
{
|
||||||
|
TColStd_IndexedDataMapOfStringString aGlCapsDict;
|
||||||
|
myView->DiagnosticInformation (aGlCapsDict, theIsBasic ? Graphic3d_DiagnosticInfo_Basic : Graphic3d_DiagnosticInfo_Complete);
|
||||||
|
if (theIsBasic)
|
||||||
|
{
|
||||||
|
TCollection_AsciiString aViewport;
|
||||||
|
aGlCapsDict.FindFromKey ("Viewport", aViewport);
|
||||||
|
aGlCapsDict.Clear();
|
||||||
|
aGlCapsDict.Add ("Viewport", aViewport);
|
||||||
|
}
|
||||||
|
aGlCapsDict.Add ("Display scale", TCollection_AsciiString(myDevicePixelRatio));
|
||||||
|
|
||||||
|
// beautify output
|
||||||
|
{
|
||||||
|
TCollection_AsciiString* aGlVer = aGlCapsDict.ChangeSeek ("GLversion");
|
||||||
|
TCollection_AsciiString* aGlslVer = aGlCapsDict.ChangeSeek ("GLSLversion");
|
||||||
|
if (aGlVer != NULL
|
||||||
|
&& aGlslVer != NULL)
|
||||||
|
{
|
||||||
|
*aGlVer = *aGlVer + " [GLSL: " + *aGlslVer + "]";
|
||||||
|
aGlslVer->Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TCollection_AsciiString anInfo;
|
||||||
|
for (TColStd_IndexedDataMapOfStringString::Iterator aValueIter (aGlCapsDict); aValueIter.More(); aValueIter.Next())
|
||||||
|
{
|
||||||
|
if (!aValueIter.Value().IsEmpty())
|
||||||
|
{
|
||||||
|
if (!anInfo.IsEmpty())
|
||||||
|
{
|
||||||
|
anInfo += "\n";
|
||||||
|
}
|
||||||
|
anInfo += aValueIter.Key() + ": " + aValueIter.Value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::Message::DefaultMessenger()->Send (anInfo, Message_Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : initPixelScaleRatio
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
void WasmOcctView::initPixelScaleRatio()
|
||||||
|
{
|
||||||
|
SetTouchToleranceScale (myDevicePixelRatio);
|
||||||
|
if (!myView.IsNull())
|
||||||
|
{
|
||||||
|
myView->ChangeRenderingParams().Resolution = (unsigned int )(96.0 * myDevicePixelRatio + 0.5);
|
||||||
|
}
|
||||||
|
if (!myContext.IsNull())
|
||||||
|
{
|
||||||
|
myContext->SetPixelTolerance (int(myDevicePixelRatio * 6.0));
|
||||||
|
if (!myViewCube.IsNull())
|
||||||
|
{
|
||||||
|
static const double THE_CUBE_SIZE = 60.0;
|
||||||
|
myViewCube->SetSize (myDevicePixelRatio * THE_CUBE_SIZE, false);
|
||||||
|
myViewCube->SetBoxFacetExtension (myViewCube->Size() * 0.15);
|
||||||
|
myViewCube->SetAxesPadding (myViewCube->Size() * 0.10);
|
||||||
|
myViewCube->SetFontHeight (THE_CUBE_SIZE * 0.16);
|
||||||
|
if (myViewCube->HasInteractiveContext())
|
||||||
|
{
|
||||||
|
myContext->Redisplay (myViewCube, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : initViewer
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
bool WasmOcctView::initViewer()
|
||||||
|
{
|
||||||
|
// Build with "--preload-file MyFontFile.ttf" option
|
||||||
|
// and register font in Font Manager to use custom font(s).
|
||||||
|
/*const char* aFontPath = "MyFontFile.ttf";
|
||||||
|
if (Handle(Font_SystemFont) aFont = Font_FontMgr::GetInstance()->CheckFont (aFontPath))
|
||||||
|
{
|
||||||
|
Font_FontMgr::GetInstance()->RegisterFont (aFont, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: font '") + aFontPath + "' is not found", Message_Fail);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
Handle(Aspect_DisplayConnection) aDisp;
|
||||||
|
Handle(OpenGl_GraphicDriver) aDriver = new OpenGl_GraphicDriver (aDisp, false);
|
||||||
|
aDriver->ChangeOptions().buffersNoSwap = true; // swap has no effect in WebGL
|
||||||
|
if (!aDriver->InitContext())
|
||||||
|
{
|
||||||
|
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: EGL initialization failed"), Message_Fail);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(V3d_Viewer) aViewer = new V3d_Viewer (aDriver);
|
||||||
|
aViewer->SetComputedMode (false);
|
||||||
|
aViewer->SetDefaultShadingModel (Graphic3d_TOSM_FRAGMENT);
|
||||||
|
aViewer->SetDefaultLights();
|
||||||
|
aViewer->SetLightOn();
|
||||||
|
|
||||||
|
Handle(Aspect_NeutralWindow) aWindow = new Aspect_NeutralWindow();
|
||||||
|
Graphic3d_Vec2i aWinSize = jsCanvasSize();
|
||||||
|
if (aWinSize.x() < 10 || aWinSize.y() < 10)
|
||||||
|
{
|
||||||
|
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Warning: invalid canvas size"), Message_Warning);
|
||||||
|
}
|
||||||
|
aWindow->SetSize (aWinSize.x(), aWinSize.y());
|
||||||
|
|
||||||
|
myTextStyle = new Prs3d_TextAspect();
|
||||||
|
myTextStyle->SetFont (Font_NOF_ASCII_MONO);
|
||||||
|
myTextStyle->SetHeight (12);
|
||||||
|
myTextStyle->Aspect()->SetColor (Quantity_NOC_GRAY95);
|
||||||
|
myTextStyle->Aspect()->SetColorSubTitle (Quantity_NOC_BLACK);
|
||||||
|
myTextStyle->Aspect()->SetDisplayType (Aspect_TODT_SHADOW);
|
||||||
|
myTextStyle->Aspect()->SetTextFontAspect (Font_FA_Bold);
|
||||||
|
myTextStyle->Aspect()->SetTextZoomable (false);
|
||||||
|
myTextStyle->SetHorizontalJustification (Graphic3d_HTA_LEFT);
|
||||||
|
myTextStyle->SetVerticalJustification (Graphic3d_VTA_BOTTOM);
|
||||||
|
|
||||||
|
myView = new V3d_View (aViewer);
|
||||||
|
myView->SetImmediateUpdate (false);
|
||||||
|
myView->ChangeRenderingParams().Resolution = (unsigned int )(96.0 * myDevicePixelRatio + 0.5);
|
||||||
|
myView->ChangeRenderingParams().ToShowStats = true;
|
||||||
|
myView->ChangeRenderingParams().StatsTextAspect = myTextStyle->Aspect();
|
||||||
|
myView->ChangeRenderingParams().StatsTextHeight = (int )myTextStyle->Height();
|
||||||
|
myView->SetWindow (aWindow);
|
||||||
|
dumpGlInfo (false);
|
||||||
|
|
||||||
|
myContext = new AIS_InteractiveContext (aViewer);
|
||||||
|
initPixelScaleRatio();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : initDemoScene
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
void WasmOcctView::initDemoScene()
|
||||||
|
{
|
||||||
|
if (myContext.IsNull())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//myView->TriedronDisplay (Aspect_TOTP_LEFT_LOWER, Quantity_NOC_GOLD, 0.08, V3d_WIREFRAME);
|
||||||
|
|
||||||
|
myViewCube = new AIS_ViewCube();
|
||||||
|
// presentation parameters
|
||||||
|
initPixelScaleRatio();
|
||||||
|
myViewCube->SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_TriedronPers, Aspect_TOTP_RIGHT_LOWER, Graphic3d_Vec2i (100, 100)));
|
||||||
|
myViewCube->Attributes()->SetDatumAspect (new Prs3d_DatumAspect());
|
||||||
|
myViewCube->Attributes()->DatumAspect()->SetTextAspect (myTextStyle);
|
||||||
|
// animation parameters
|
||||||
|
myViewCube->SetViewAnimation (myViewAnimation);
|
||||||
|
myViewCube->SetFixedAnimationLoop (false);
|
||||||
|
myViewCube->SetAutoStartAnimation (true);
|
||||||
|
myContext->Display (myViewCube, false);
|
||||||
|
|
||||||
|
// Build with "--preload-file MySampleFile.brep" option to load some shapes here.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : updateView
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
void WasmOcctView::updateView()
|
||||||
|
{
|
||||||
|
if (!myView.IsNull())
|
||||||
|
{
|
||||||
|
if (++myUpdateRequests == 1)
|
||||||
|
{
|
||||||
|
emscripten_async_call (onRedrawView, this, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : redrawView
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
void WasmOcctView::redrawView()
|
||||||
|
{
|
||||||
|
if (!myView.IsNull())
|
||||||
|
{
|
||||||
|
FlushViewEvents (myContext, myView, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : handleViewRedraw
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
void WasmOcctView::handleViewRedraw (const Handle(AIS_InteractiveContext)& theCtx,
|
||||||
|
const Handle(V3d_View)& theView)
|
||||||
|
{
|
||||||
|
myUpdateRequests = 0;
|
||||||
|
AIS_ViewController::handleViewRedraw (theCtx, theView);
|
||||||
|
if (myToAskNextFrame)
|
||||||
|
{
|
||||||
|
// ask more frames
|
||||||
|
++myUpdateRequests;
|
||||||
|
emscripten_async_call (onRedrawView, this, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : onResizeEvent
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
EM_BOOL WasmOcctView::onResizeEvent (int theEventType, const EmscriptenUiEvent* theEvent)
|
||||||
|
{
|
||||||
|
(void )theEventType; // EMSCRIPTEN_EVENT_RESIZE or EMSCRIPTEN_EVENT_CANVASRESIZED
|
||||||
|
(void )theEvent;
|
||||||
|
if (myView.IsNull())
|
||||||
|
{
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(Aspect_NeutralWindow) aWindow = Handle(Aspect_NeutralWindow)::DownCast (myView->Window());
|
||||||
|
Graphic3d_Vec2i aWinSizeOld, aWinSizeNew (jsCanvasSize());
|
||||||
|
if (aWinSizeNew.x() < 10 || aWinSizeNew.y() < 10)
|
||||||
|
{
|
||||||
|
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Warning: invalid canvas size"), Message_Warning);
|
||||||
|
}
|
||||||
|
aWindow->Size (aWinSizeOld.x(), aWinSizeOld.y());
|
||||||
|
const float aPixelRatio = jsDevicePixelRatio();
|
||||||
|
if (aWinSizeNew != aWinSizeOld
|
||||||
|
|| aPixelRatio != myDevicePixelRatio)
|
||||||
|
{
|
||||||
|
if (myDevicePixelRatio != aPixelRatio)
|
||||||
|
{
|
||||||
|
myDevicePixelRatio = aPixelRatio;
|
||||||
|
initPixelScaleRatio();
|
||||||
|
}
|
||||||
|
aWindow->SetSize (aWinSizeNew.x(), aWinSizeNew.y());
|
||||||
|
myView->MustBeResized();
|
||||||
|
myView->Invalidate();
|
||||||
|
myView->Redraw();
|
||||||
|
dumpGlInfo (true);
|
||||||
|
}
|
||||||
|
return EM_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : onMouseEvent
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
EM_BOOL WasmOcctView::onMouseEvent (int theEventType, const EmscriptenMouseEvent* theEvent)
|
||||||
|
{
|
||||||
|
if (myView.IsNull())
|
||||||
|
{
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Graphic3d_Vec2i aWinSize;
|
||||||
|
myView->Window()->Size (aWinSize.x(), aWinSize.y());
|
||||||
|
const Graphic3d_Vec2i aNewPos = convertPointToBacking (Graphic3d_Vec2i (theEvent->canvasX, theEvent->canvasY));
|
||||||
|
Aspect_VKeyFlags aFlags = 0;
|
||||||
|
if (theEvent->ctrlKey == EM_TRUE) { aFlags |= Aspect_VKeyFlags_CTRL; }
|
||||||
|
if (theEvent->shiftKey == EM_TRUE) { aFlags |= Aspect_VKeyFlags_SHIFT; }
|
||||||
|
if (theEvent->altKey == EM_TRUE) { aFlags |= Aspect_VKeyFlags_ALT; }
|
||||||
|
if (theEvent->metaKey == EM_TRUE) { aFlags |= Aspect_VKeyFlags_META; }
|
||||||
|
|
||||||
|
const bool isEmulated = false;
|
||||||
|
const Aspect_VKeyMouse aButtons = WasmVKeys_MouseButtonsFromNative (theEvent->buttons);
|
||||||
|
switch (theEventType)
|
||||||
|
{
|
||||||
|
case EMSCRIPTEN_EVENT_MOUSEMOVE:
|
||||||
|
{
|
||||||
|
if ((aNewPos.x() < 0 || aNewPos.x() > aWinSize.x()
|
||||||
|
|| aNewPos.y() < 0 || aNewPos.y() > aWinSize.y())
|
||||||
|
&& PressedMouseButtons() == Aspect_VKeyMouse_NONE)
|
||||||
|
{
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
||||||
|
if (UpdateMousePosition (aNewPos, aButtons, aFlags, isEmulated))
|
||||||
|
{
|
||||||
|
updateView();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EMSCRIPTEN_EVENT_MOUSEDOWN:
|
||||||
|
case EMSCRIPTEN_EVENT_MOUSEUP:
|
||||||
|
{
|
||||||
|
if (aNewPos.x() < 0 || aNewPos.x() > aWinSize.x()
|
||||||
|
|| aNewPos.y() < 0 || aNewPos.y() > aWinSize.y())
|
||||||
|
{
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
||||||
|
if (UpdateMouseButtons (aNewPos, aButtons, aFlags, isEmulated))
|
||||||
|
{
|
||||||
|
updateView();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EMSCRIPTEN_EVENT_CLICK:
|
||||||
|
case EMSCRIPTEN_EVENT_DBLCLICK:
|
||||||
|
{
|
||||||
|
if (aNewPos.x() < 0 || aNewPos.x() > aWinSize.x()
|
||||||
|
|| aNewPos.y() < 0 || aNewPos.y() > aWinSize.y())
|
||||||
|
{
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EMSCRIPTEN_EVENT_MOUSEENTER:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EMSCRIPTEN_EVENT_MOUSELEAVE:
|
||||||
|
{
|
||||||
|
// there is no SetCapture() support, so that mouse unclick events outside canvas will not arrive,
|
||||||
|
// so we have to forget current state...
|
||||||
|
if (UpdateMouseButtons (aNewPos, Aspect_VKeyMouse_NONE, aFlags, isEmulated))
|
||||||
|
{
|
||||||
|
updateView();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return EM_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : onWheelEvent
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
EM_BOOL WasmOcctView::onWheelEvent (int theEventType, const EmscriptenWheelEvent* theEvent)
|
||||||
|
{
|
||||||
|
if (myView.IsNull()
|
||||||
|
|| theEventType != EMSCRIPTEN_EVENT_WHEEL)
|
||||||
|
{
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Graphic3d_Vec2i aWinSize;
|
||||||
|
myView->Window()->Size (aWinSize.x(), aWinSize.y());
|
||||||
|
const Graphic3d_Vec2i aNewPos = convertPointToBacking (Graphic3d_Vec2i (theEvent->mouse.canvasX, theEvent->mouse.canvasY));
|
||||||
|
if (aNewPos.x() < 0 || aNewPos.x() > aWinSize.x()
|
||||||
|
|| aNewPos.y() < 0 || aNewPos.y() > aWinSize.y())
|
||||||
|
{
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
double aDelta = 0.0;
|
||||||
|
switch (theEvent->deltaMode)
|
||||||
|
{
|
||||||
|
case DOM_DELTA_PIXEL:
|
||||||
|
{
|
||||||
|
aDelta = theEvent->deltaY / (5.0 * myDevicePixelRatio);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DOM_DELTA_LINE:
|
||||||
|
{
|
||||||
|
aDelta = theEvent->deltaY * 8.0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DOM_DELTA_PAGE:
|
||||||
|
{
|
||||||
|
aDelta = theEvent->deltaY >= 0.0 ? 24.0 : -24.0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UpdateZoom (Aspect_ScrollDelta (aNewPos, -aDelta)))
|
||||||
|
{
|
||||||
|
updateView();
|
||||||
|
}
|
||||||
|
return EM_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : onTouchEvent
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
EM_BOOL WasmOcctView::onTouchEvent (int theEventType, const EmscriptenTouchEvent* theEvent)
|
||||||
|
{
|
||||||
|
const double aClickTolerance = 5.0;
|
||||||
|
if (myView.IsNull())
|
||||||
|
{
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Graphic3d_Vec2i aWinSize;
|
||||||
|
myView->Window()->Size (aWinSize.x(), aWinSize.y());
|
||||||
|
bool hasUpdates = false;
|
||||||
|
for (int aTouchIter = 0; aTouchIter < theEvent->numTouches; ++aTouchIter)
|
||||||
|
{
|
||||||
|
const EmscriptenTouchPoint& aTouch = theEvent->touches[aTouchIter];
|
||||||
|
if (!aTouch.isChanged)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Standard_Size aTouchId = (Standard_Size )aTouch.identifier;
|
||||||
|
const Graphic3d_Vec2i aNewPos = convertPointToBacking (Graphic3d_Vec2i (aTouch.canvasX, aTouch.canvasY));
|
||||||
|
switch (theEventType)
|
||||||
|
{
|
||||||
|
case EMSCRIPTEN_EVENT_TOUCHSTART:
|
||||||
|
{
|
||||||
|
if (aNewPos.x() >= 0 && aNewPos.x() < aWinSize.x()
|
||||||
|
&& aNewPos.y() >= 0 && aNewPos.y() < aWinSize.y())
|
||||||
|
{
|
||||||
|
hasUpdates = true;
|
||||||
|
AddTouchPoint (aTouchId, Graphic3d_Vec2d (aNewPos));
|
||||||
|
myClickTouch.From.SetValues (-1.0, -1.0);
|
||||||
|
if (myTouchPoints.Extent() == 1)
|
||||||
|
{
|
||||||
|
myClickTouch.From = Graphic3d_Vec2d (aNewPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EMSCRIPTEN_EVENT_TOUCHMOVE:
|
||||||
|
{
|
||||||
|
const int anOldIndex = myTouchPoints.FindIndex (aTouchId);
|
||||||
|
if (anOldIndex != 0)
|
||||||
|
{
|
||||||
|
hasUpdates = true;
|
||||||
|
UpdateTouchPoint (aTouchId, Graphic3d_Vec2d (aNewPos));
|
||||||
|
if (myTouchPoints.Extent() == 1
|
||||||
|
&& (myClickTouch.From - Graphic3d_Vec2d (aNewPos)).cwiseAbs().maxComp() > aClickTolerance)
|
||||||
|
{
|
||||||
|
myClickTouch.From.SetValues (-1.0, -1.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EMSCRIPTEN_EVENT_TOUCHEND:
|
||||||
|
case EMSCRIPTEN_EVENT_TOUCHCANCEL:
|
||||||
|
{
|
||||||
|
if (RemoveTouchPoint (aTouchId))
|
||||||
|
{
|
||||||
|
if (myTouchPoints.IsEmpty()
|
||||||
|
&& myClickTouch.From.minComp() >= 0.0)
|
||||||
|
{
|
||||||
|
if (myDoubleTapTimer.IsStarted()
|
||||||
|
&& myDoubleTapTimer.ElapsedTime() <= myMouseDoubleClickInt)
|
||||||
|
{
|
||||||
|
myView->FitAll (0.01, false);
|
||||||
|
myView->Invalidate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myDoubleTapTimer.Stop();
|
||||||
|
myDoubleTapTimer.Reset();
|
||||||
|
myDoubleTapTimer.Start();
|
||||||
|
SelectInViewer (Graphic3d_Vec2i (myClickTouch.From), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hasUpdates = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasUpdates)
|
||||||
|
{
|
||||||
|
updateView();
|
||||||
|
}
|
||||||
|
return hasUpdates || !myTouchPoints.IsEmpty() ? EM_TRUE : EM_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : onKeyDownEvent
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
EM_BOOL WasmOcctView::onKeyDownEvent (int theEventType, const EmscriptenKeyboardEvent* theEvent)
|
||||||
|
{
|
||||||
|
if (myView.IsNull()
|
||||||
|
|| theEventType != EMSCRIPTEN_EVENT_KEYDOWN) // EMSCRIPTEN_EVENT_KEYPRESS
|
||||||
|
{
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const double aTimeStamp = EventTime();
|
||||||
|
const Aspect_VKey aVKey = WasmVKeys_VirtualKeyFromNative (theEvent->keyCode);
|
||||||
|
if (aVKey == Aspect_VKey_UNKNOWN)
|
||||||
|
{
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (theEvent->repeat == EM_FALSE)
|
||||||
|
{
|
||||||
|
myKeys.KeyDown (aVKey, aTimeStamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Aspect_VKey2Modifier (aVKey) == 0)
|
||||||
|
{
|
||||||
|
// normal key
|
||||||
|
}
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// Function : onKeyUpEvent
|
||||||
|
// Purpose :
|
||||||
|
// ================================================================
|
||||||
|
EM_BOOL WasmOcctView::onKeyUpEvent (int theEventType, const EmscriptenKeyboardEvent* theEvent)
|
||||||
|
{
|
||||||
|
if (myView.IsNull()
|
||||||
|
|| theEventType != EMSCRIPTEN_EVENT_KEYUP)
|
||||||
|
{
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const double aTimeStamp = EventTime();
|
||||||
|
const Aspect_VKey aVKey = WasmVKeys_VirtualKeyFromNative (theEvent->keyCode);
|
||||||
|
if (aVKey == Aspect_VKey_UNKNOWN)
|
||||||
|
{
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (theEvent->repeat == EM_TRUE)
|
||||||
|
{
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const unsigned int aModif = myKeys.Modifiers();
|
||||||
|
myKeys.KeyUp (aVKey, aTimeStamp);
|
||||||
|
if (Aspect_VKey2Modifier (aVKey) == 0)
|
||||||
|
{
|
||||||
|
// normal key released
|
||||||
|
switch (aVKey | aModif)
|
||||||
|
{
|
||||||
|
case Aspect_VKey_F:
|
||||||
|
{
|
||||||
|
myView->FitAll (0.01, false);
|
||||||
|
myView->Invalidate();
|
||||||
|
updateView();
|
||||||
|
return EM_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return EM_FALSE;
|
||||||
|
}
|
157
samples/webgl/WasmOcctView.h
Normal file
157
samples/webgl/WasmOcctView.h
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of the examples of the Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
|
||||||
|
|
||||||
|
#ifndef _WasmOcctView_HeaderFile
|
||||||
|
#define _WasmOcctView_HeaderFile
|
||||||
|
|
||||||
|
#include <AIS_InteractiveContext.hxx>
|
||||||
|
#include <AIS_ViewController.hxx>
|
||||||
|
#include <V3d_View.hxx>
|
||||||
|
|
||||||
|
#include <emscripten.h>
|
||||||
|
#include <emscripten/html5.h>
|
||||||
|
|
||||||
|
class AIS_ViewCube;
|
||||||
|
|
||||||
|
//! Sample class creating 3D Viewer within Emscripten canvas.
|
||||||
|
class WasmOcctView : protected AIS_ViewController
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Default constructor.
|
||||||
|
WasmOcctView();
|
||||||
|
|
||||||
|
//! Destructor.
|
||||||
|
virtual ~WasmOcctView();
|
||||||
|
|
||||||
|
//! Main application entry point.
|
||||||
|
void run();
|
||||||
|
|
||||||
|
//! Return interactive context.
|
||||||
|
const Handle(AIS_InteractiveContext)& Context() const { return myContext; }
|
||||||
|
|
||||||
|
//! Return view.
|
||||||
|
const Handle(V3d_View)& View() const { return myView; }
|
||||||
|
|
||||||
|
//! Return device pixel ratio for handling high DPI displays.
|
||||||
|
float DevicePixelRatio() const { return myDevicePixelRatio; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
//! Create window.
|
||||||
|
void initWindow();
|
||||||
|
|
||||||
|
//! Create 3D Viewer.
|
||||||
|
bool initViewer();
|
||||||
|
|
||||||
|
//! Fill 3D Viewer with a DEMO items.
|
||||||
|
void initDemoScene();
|
||||||
|
|
||||||
|
//! Application event loop.
|
||||||
|
void mainloop();
|
||||||
|
|
||||||
|
//! Request view redrawing.
|
||||||
|
void updateView();
|
||||||
|
|
||||||
|
//! Flush events and redraw view.
|
||||||
|
void redrawView();
|
||||||
|
|
||||||
|
//! Handle view redraw.
|
||||||
|
virtual void handleViewRedraw (const Handle(AIS_InteractiveContext)& theCtx,
|
||||||
|
const Handle(V3d_View)& theView) override;
|
||||||
|
|
||||||
|
//! Dump WebGL context information.
|
||||||
|
void dumpGlInfo (bool theIsBasic);
|
||||||
|
|
||||||
|
//! Initialize pixel scale ratio.
|
||||||
|
void initPixelScaleRatio();
|
||||||
|
|
||||||
|
//! Return point from logical units to backing store.
|
||||||
|
Graphic3d_Vec2d convertPointToBacking (const Graphic3d_Vec2d& thePnt) const
|
||||||
|
{
|
||||||
|
return thePnt * myDevicePixelRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Return point from logical units to backing store.
|
||||||
|
Graphic3d_Vec2i convertPointToBacking (const Graphic3d_Vec2i& thePnt) const
|
||||||
|
{
|
||||||
|
Graphic3d_Vec2d aPnt = Graphic3d_Vec2d (thePnt) * myDevicePixelRatio + Graphic3d_Vec2d (0.5);
|
||||||
|
return Graphic3d_Vec2i (aPnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! @name Emscripten callbacks
|
||||||
|
private:
|
||||||
|
//! Window resize event.
|
||||||
|
EM_BOOL onResizeEvent (int theEventType, const EmscriptenUiEvent* theEvent);
|
||||||
|
|
||||||
|
//! Mouse event.
|
||||||
|
EM_BOOL onMouseEvent (int theEventType, const EmscriptenMouseEvent* theEvent);
|
||||||
|
|
||||||
|
//! Scroll event.
|
||||||
|
EM_BOOL onWheelEvent (int theEventType, const EmscriptenWheelEvent* theEvent);
|
||||||
|
|
||||||
|
//! Touch event.
|
||||||
|
EM_BOOL onTouchEvent (int theEventType, const EmscriptenTouchEvent* theEvent);
|
||||||
|
|
||||||
|
//! Key down event.
|
||||||
|
EM_BOOL onKeyDownEvent (int theEventType, const EmscriptenKeyboardEvent* theEvent);
|
||||||
|
|
||||||
|
//! Key up event.
|
||||||
|
EM_BOOL onKeyUpEvent (int theEventType, const EmscriptenKeyboardEvent* theEvent);
|
||||||
|
|
||||||
|
//! @name Emscripten callbacks (static functions)
|
||||||
|
private:
|
||||||
|
|
||||||
|
static EM_BOOL onResizeCallback (int theEventType, const EmscriptenUiEvent* theEvent, void* theView)
|
||||||
|
{ return ((WasmOcctView* )theView)->onResizeEvent (theEventType, theEvent); }
|
||||||
|
|
||||||
|
static void onRedrawView (void* theView)
|
||||||
|
{ return ((WasmOcctView* )theView)->redrawView(); }
|
||||||
|
|
||||||
|
static EM_BOOL onMouseCallback (int theEventType, const EmscriptenMouseEvent* theEvent, void* theView)
|
||||||
|
{ return ((WasmOcctView* )theView)->onMouseEvent (theEventType, theEvent); }
|
||||||
|
|
||||||
|
static EM_BOOL onWheelCallback (int theEventType, const EmscriptenWheelEvent* theEvent, void* theView)
|
||||||
|
{ return ((WasmOcctView* )theView)->onWheelEvent (theEventType, theEvent); }
|
||||||
|
|
||||||
|
static EM_BOOL onTouchCallback (int theEventType, const EmscriptenTouchEvent* theEvent, void* theView)
|
||||||
|
{ return ((WasmOcctView* )theView)->onTouchEvent (theEventType, theEvent); }
|
||||||
|
|
||||||
|
static EM_BOOL onKeyDownCallback (int theEventType, const EmscriptenKeyboardEvent* theEvent, void* theView)
|
||||||
|
{ return ((WasmOcctView* )theView)->onKeyDownEvent (theEventType, theEvent); }
|
||||||
|
|
||||||
|
static EM_BOOL onKeyUpCallback (int theEventType, const EmscriptenKeyboardEvent* theEvent, void* theView)
|
||||||
|
{ return ((WasmOcctView* )theView)->onKeyUpEvent (theEventType, theEvent); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
Handle(AIS_InteractiveContext) myContext; //!< interactive context
|
||||||
|
Handle(V3d_View) myView; //!< 3D view
|
||||||
|
Handle(Prs3d_TextAspect) myTextStyle; //!< text style for OSD elements
|
||||||
|
Handle(AIS_ViewCube) myViewCube; //!< view cube object
|
||||||
|
TCollection_AsciiString myCanvasId; //!< canvas element id on HTML page
|
||||||
|
Aspect_Touch myClickTouch; //!< single touch position for handling clicks
|
||||||
|
OSD_Timer myDoubleTapTimer; //!< timer for handling double tap
|
||||||
|
float myDevicePixelRatio; //!< device pixel ratio for handling high DPI displays
|
||||||
|
unsigned int myUpdateRequests; //!< counter for unhandled update requests
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _WasmOcctView_HeaderFile
|
264
samples/webgl/WasmVKeys.h
Normal file
264
samples/webgl/WasmVKeys.h
Normal file
@@ -0,0 +1,264 @@
|
|||||||
|
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of the examples of the Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
|
||||||
|
|
||||||
|
#ifndef _WasmVKeys_HeaderFile
|
||||||
|
#define _WasmVKeys_HeaderFile
|
||||||
|
|
||||||
|
#include <Aspect_VKey.hxx>
|
||||||
|
|
||||||
|
#include <emscripten/key_codes.h>
|
||||||
|
|
||||||
|
//! Convert Emscripten mouse buttons into Aspect_VKeyMouse.
|
||||||
|
inline Aspect_VKeyMouse WasmVKeys_MouseButtonsFromNative (unsigned short theButtons)
|
||||||
|
{
|
||||||
|
Aspect_VKeyMouse aButtons = Aspect_VKeyMouse_NONE;
|
||||||
|
if ((theButtons & 0x1) != 0)
|
||||||
|
{
|
||||||
|
aButtons |= Aspect_VKeyMouse_LeftButton;
|
||||||
|
}
|
||||||
|
if ((theButtons & 0x2) != 0)
|
||||||
|
{
|
||||||
|
aButtons |= Aspect_VKeyMouse_RightButton;
|
||||||
|
}
|
||||||
|
if ((theButtons & 0x4) != 0)
|
||||||
|
{
|
||||||
|
aButtons |= Aspect_VKeyMouse_MiddleButton;
|
||||||
|
}
|
||||||
|
return aButtons;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Convert DOM virtual key into Aspect_VKey.
|
||||||
|
inline Aspect_VKey WasmVKeys_VirtualKeyFromNative (Standard_Integer theKey)
|
||||||
|
{
|
||||||
|
if (theKey >= DOM_VK_0
|
||||||
|
&& theKey <= DOM_VK_9)
|
||||||
|
{
|
||||||
|
// numpad keys
|
||||||
|
return Aspect_VKey((theKey - DOM_VK_0) + Aspect_VKey_0);
|
||||||
|
}
|
||||||
|
if (theKey >= DOM_VK_A
|
||||||
|
&& theKey <= DOM_VK_Z)
|
||||||
|
{
|
||||||
|
// main latin alphabet keys
|
||||||
|
return Aspect_VKey((theKey - DOM_VK_A) + Aspect_VKey_A);
|
||||||
|
}
|
||||||
|
if (theKey >= DOM_VK_F1
|
||||||
|
&& theKey <= DOM_VK_F24)
|
||||||
|
{
|
||||||
|
// special keys
|
||||||
|
if (theKey <= DOM_VK_F12)
|
||||||
|
{
|
||||||
|
return Aspect_VKey((theKey - DOM_VK_F1) + Aspect_VKey_F1);
|
||||||
|
}
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
}
|
||||||
|
if (theKey >= DOM_VK_NUMPAD0
|
||||||
|
&& theKey <= DOM_VK_NUMPAD9)
|
||||||
|
{
|
||||||
|
// numpad keys
|
||||||
|
return Aspect_VKey((theKey - DOM_VK_NUMPAD0) + Aspect_VKey_Numpad0);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (theKey)
|
||||||
|
{
|
||||||
|
case DOM_VK_CANCEL:
|
||||||
|
case DOM_VK_HELP:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_BACK_SPACE:
|
||||||
|
return Aspect_VKey_Backspace;
|
||||||
|
case DOM_VK_TAB:
|
||||||
|
return Aspect_VKey_Tab;
|
||||||
|
case DOM_VK_CLEAR:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_RETURN:
|
||||||
|
case DOM_VK_ENTER:
|
||||||
|
return Aspect_VKey_Enter;
|
||||||
|
case DOM_VK_SHIFT:
|
||||||
|
return Aspect_VKey_Shift;
|
||||||
|
case DOM_VK_CONTROL:
|
||||||
|
return Aspect_VKey_Control;
|
||||||
|
case DOM_VK_ALT:
|
||||||
|
return Aspect_VKey_Alt;
|
||||||
|
case DOM_VK_PAUSE:
|
||||||
|
case DOM_VK_CAPS_LOCK:
|
||||||
|
case DOM_VK_KANA:
|
||||||
|
//case DOM_VK_HANGUL:
|
||||||
|
case DOM_VK_EISU:
|
||||||
|
case DOM_VK_JUNJA:
|
||||||
|
case DOM_VK_FINAL:
|
||||||
|
case DOM_VK_HANJA:
|
||||||
|
//case DOM_VK_KANJI:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_ESCAPE:
|
||||||
|
return Aspect_VKey_Escape;
|
||||||
|
case DOM_VK_CONVERT:
|
||||||
|
case DOM_VK_NONCONVERT:
|
||||||
|
case DOM_VK_ACCEPT:
|
||||||
|
case DOM_VK_MODECHANGE:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_SPACE:
|
||||||
|
return Aspect_VKey_Space;
|
||||||
|
case DOM_VK_PAGE_UP:
|
||||||
|
return Aspect_VKey_PageUp;
|
||||||
|
case DOM_VK_PAGE_DOWN:
|
||||||
|
return Aspect_VKey_PageDown;
|
||||||
|
case DOM_VK_END:
|
||||||
|
return Aspect_VKey_End;
|
||||||
|
case DOM_VK_HOME:
|
||||||
|
return Aspect_VKey_Home;
|
||||||
|
case DOM_VK_LEFT:
|
||||||
|
return Aspect_VKey_Left;
|
||||||
|
case DOM_VK_UP:
|
||||||
|
return Aspect_VKey_Up;
|
||||||
|
case DOM_VK_RIGHT:
|
||||||
|
return Aspect_VKey_Right;
|
||||||
|
case DOM_VK_DOWN:
|
||||||
|
return Aspect_VKey_Down;
|
||||||
|
case DOM_VK_SELECT:
|
||||||
|
case DOM_VK_PRINT:
|
||||||
|
case DOM_VK_EXECUTE:
|
||||||
|
case DOM_VK_PRINTSCREEN:
|
||||||
|
case DOM_VK_INSERT:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_DELETE:
|
||||||
|
return Aspect_VKey_Delete;
|
||||||
|
case DOM_VK_COLON:
|
||||||
|
return Aspect_VKey_Comma;
|
||||||
|
case DOM_VK_SEMICOLON:
|
||||||
|
return Aspect_VKey_Semicolon;
|
||||||
|
case DOM_VK_LESS_THAN:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_EQUALS:
|
||||||
|
return Aspect_VKey_Equal;
|
||||||
|
case DOM_VK_GREATER_THAN:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_QUESTION_MARK:
|
||||||
|
return Aspect_VKey_Slash;
|
||||||
|
case DOM_VK_AT: // @ key
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_WIN:
|
||||||
|
return Aspect_VKey_Meta;
|
||||||
|
case DOM_VK_CONTEXT_MENU:
|
||||||
|
case DOM_VK_SLEEP:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_MULTIPLY:
|
||||||
|
return Aspect_VKey_NumpadMultiply;
|
||||||
|
case DOM_VK_ADD:
|
||||||
|
return Aspect_VKey_NumpadAdd;
|
||||||
|
case DOM_VK_SEPARATOR:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_SUBTRACT:
|
||||||
|
return Aspect_VKey_NumpadSubtract;
|
||||||
|
case DOM_VK_DECIMAL:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_DIVIDE:
|
||||||
|
return Aspect_VKey_NumpadDivide;
|
||||||
|
case DOM_VK_NUM_LOCK:
|
||||||
|
return Aspect_VKey_Numlock;
|
||||||
|
case DOM_VK_SCROLL_LOCK:
|
||||||
|
return Aspect_VKey_Scroll;
|
||||||
|
case DOM_VK_WIN_OEM_FJ_JISHO:
|
||||||
|
case DOM_VK_WIN_OEM_FJ_MASSHOU:
|
||||||
|
case DOM_VK_WIN_OEM_FJ_TOUROKU:
|
||||||
|
case DOM_VK_WIN_OEM_FJ_LOYA:
|
||||||
|
case DOM_VK_WIN_OEM_FJ_ROYA:
|
||||||
|
case DOM_VK_CIRCUMFLEX:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_EXCLAMATION:
|
||||||
|
case DOM_VK_DOUBLE_QUOTE:
|
||||||
|
//case DOM_VK_HASH:
|
||||||
|
case DOM_VK_DOLLAR:
|
||||||
|
case DOM_VK_PERCENT:
|
||||||
|
case DOM_VK_AMPERSAND:
|
||||||
|
case DOM_VK_UNDERSCORE:
|
||||||
|
case DOM_VK_OPEN_PAREN:
|
||||||
|
case DOM_VK_CLOSE_PAREN:
|
||||||
|
case DOM_VK_ASTERISK:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_PLUS:
|
||||||
|
return Aspect_VKey_Plus;
|
||||||
|
case DOM_VK_PIPE:
|
||||||
|
case DOM_VK_HYPHEN_MINUS:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_OPEN_CURLY_BRACKET:
|
||||||
|
return Aspect_VKey_BracketLeft;
|
||||||
|
case DOM_VK_CLOSE_CURLY_BRACKET:
|
||||||
|
return Aspect_VKey_BracketRight;
|
||||||
|
case DOM_VK_TILDE:
|
||||||
|
return Aspect_VKey_Tilde;
|
||||||
|
case DOM_VK_VOLUME_MUTE:
|
||||||
|
return Aspect_VKey_VolumeMute;
|
||||||
|
case DOM_VK_VOLUME_DOWN:
|
||||||
|
return Aspect_VKey_VolumeDown;
|
||||||
|
case DOM_VK_VOLUME_UP:
|
||||||
|
return Aspect_VKey_VolumeUp;
|
||||||
|
case DOM_VK_COMMA:
|
||||||
|
return Aspect_VKey_Comma;
|
||||||
|
case DOM_VK_PERIOD:
|
||||||
|
return Aspect_VKey_Period;
|
||||||
|
case DOM_VK_SLASH:
|
||||||
|
return Aspect_VKey_Slash;
|
||||||
|
case DOM_VK_BACK_QUOTE:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_OPEN_BRACKET:
|
||||||
|
return Aspect_VKey_BracketLeft;
|
||||||
|
case DOM_VK_BACK_SLASH:
|
||||||
|
return Aspect_VKey_Backslash;
|
||||||
|
case DOM_VK_CLOSE_BRACKET:
|
||||||
|
return Aspect_VKey_BracketRight;
|
||||||
|
case DOM_VK_QUOTE:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_META:
|
||||||
|
return Aspect_VKey_Meta;
|
||||||
|
case DOM_VK_ALTGR:
|
||||||
|
return Aspect_VKey_Alt;
|
||||||
|
case DOM_VK_WIN_ICO_HELP:
|
||||||
|
case DOM_VK_WIN_ICO_00:
|
||||||
|
case DOM_VK_WIN_ICO_CLEAR:
|
||||||
|
case DOM_VK_WIN_OEM_RESET:
|
||||||
|
case DOM_VK_WIN_OEM_JUMP:
|
||||||
|
case DOM_VK_WIN_OEM_PA1:
|
||||||
|
case DOM_VK_WIN_OEM_PA2:
|
||||||
|
case DOM_VK_WIN_OEM_PA3:
|
||||||
|
case DOM_VK_WIN_OEM_WSCTRL:
|
||||||
|
case DOM_VK_WIN_OEM_CUSEL:
|
||||||
|
case DOM_VK_WIN_OEM_ATTN:
|
||||||
|
case DOM_VK_WIN_OEM_FINISH:
|
||||||
|
case DOM_VK_WIN_OEM_COPY:
|
||||||
|
case DOM_VK_WIN_OEM_AUTO:
|
||||||
|
case DOM_VK_WIN_OEM_ENLW:
|
||||||
|
case DOM_VK_WIN_OEM_BACKTAB:
|
||||||
|
case DOM_VK_ATTN:
|
||||||
|
case DOM_VK_CRSEL:
|
||||||
|
case DOM_VK_EXSEL:
|
||||||
|
case DOM_VK_EREOF:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
case DOM_VK_PLAY:
|
||||||
|
return Aspect_VKey_MediaPlayPause;
|
||||||
|
case DOM_VK_ZOOM:
|
||||||
|
case DOM_VK_PA1:
|
||||||
|
case DOM_VK_WIN_OEM_CLEAR:
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
}
|
||||||
|
return Aspect_VKey_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _WasmVKeys_HeaderFile
|
69
samples/webgl/main.cpp
Normal file
69
samples/webgl/main.cpp
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "WasmOcctView.h"
|
||||||
|
|
||||||
|
#include <Message.hxx>
|
||||||
|
#include <Message_Messenger.hxx>
|
||||||
|
#include <Message_PrinterSystemLog.hxx>
|
||||||
|
#include <OSD_MemInfo.hxx>
|
||||||
|
#include <OSD_Parallel.hxx>
|
||||||
|
|
||||||
|
#include <AIS_Shape.hxx>
|
||||||
|
#include <BRepTools.hxx>
|
||||||
|
#include <BRep_Builder.hxx>
|
||||||
|
#include <Standard_ArrayStreamBuffer.hxx>
|
||||||
|
|
||||||
|
#include <emscripten.h>
|
||||||
|
#include <emscripten/html5.h>
|
||||||
|
|
||||||
|
//! Global viewer instance.
|
||||||
|
static WasmOcctView aViewer;
|
||||||
|
|
||||||
|
//! File data read event.
|
||||||
|
extern "C" void onFileDataRead (void* theOpaque, void* theBuffer, int theDataLen)
|
||||||
|
{
|
||||||
|
const char* aName = theOpaque != NULL ? (const char* )theOpaque : "";
|
||||||
|
{
|
||||||
|
AIS_ListOfInteractive aShapes;
|
||||||
|
aViewer.Context()->DisplayedObjects (AIS_KOI_Shape, -1, aShapes);
|
||||||
|
for (AIS_ListOfInteractive::Iterator aShapeIter (aShapes); aShapeIter.More(); aShapeIter.Next())
|
||||||
|
{
|
||||||
|
aViewer.Context()->Remove (aShapeIter.Value(), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_ArrayStreamBuffer aStreamBuffer ((const char* )theBuffer, theDataLen);
|
||||||
|
std::istream aStream (&aStreamBuffer);
|
||||||
|
TopoDS_Shape aShape;
|
||||||
|
BRep_Builder aBuilder;
|
||||||
|
BRepTools::Read (aShape, aStream, aBuilder);
|
||||||
|
|
||||||
|
Handle(AIS_Shape) aShapePrs = new AIS_Shape (aShape);
|
||||||
|
aShapePrs->SetMaterial (Graphic3d_NOM_SILVER);
|
||||||
|
aViewer.Context()->Display (aShapePrs, AIS_Shaded, 0, false);
|
||||||
|
aViewer.View()->FitAll (0.01, false);
|
||||||
|
aViewer.View()->Redraw();
|
||||||
|
Message::DefaultMessenger()->Send (TCollection_AsciiString("Loaded file ") + aName, Message_Info);
|
||||||
|
Message::DefaultMessenger()->Send (OSD_MemInfo::PrintInfo(), Message_Trace);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! File read error event.
|
||||||
|
static void onFileReadFailed (void* theOpaque)
|
||||||
|
{
|
||||||
|
const char* aName = (const char* )theOpaque;
|
||||||
|
Message::DefaultMessenger()->Send (TCollection_AsciiString("Error: unable to load file ") + aName, Message_Fail);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
Message::DefaultMessenger()->Printers().First()->SetTraceLevel (Message_Trace);
|
||||||
|
Handle(Message_PrinterSystemLog) aJSConsolePrinter = new Message_PrinterSystemLog ("webgl-sample", Message_Trace);
|
||||||
|
Message::DefaultMessenger()->AddPrinter (aJSConsolePrinter); // open JavaScript console within the Browser to see this output
|
||||||
|
Message::DefaultMessenger()->Send (TCollection_AsciiString("NbLogicalProcessors: ") + OSD_Parallel::NbLogicalProcessors(), Message_Trace);
|
||||||
|
aViewer.run();
|
||||||
|
Message::DefaultMessenger()->Send (OSD_MemInfo::PrintInfo(), Message_Trace);
|
||||||
|
|
||||||
|
// load some file
|
||||||
|
emscripten_async_wget_data ("samples/Ball.brep", (void* )"samples/Ball.brep", onFileDataRead, onFileReadFailed);
|
||||||
|
return 0;
|
||||||
|
}
|
133
samples/webgl/occt-webgl-sample.html
Normal file
133
samples/webgl/occt-webgl-sample.html
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang=en-us>
|
||||||
|
<head>
|
||||||
|
<meta charset=utf-8><meta content="text/html; charset=utf-8" http-equiv=Content-Type>
|
||||||
|
<link rel="shortcut icon" href="lamp.ico" type="image/x-icon" />
|
||||||
|
<title>OCCT WebGL Viewer Sample</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h2>OCCT WebGL Viewer Sample</h2>
|
||||||
|
<div>
|
||||||
|
<canvas id=canvas oncontextmenu=event.preventDefault() tabindex=-1 style="border:0 none;background-color:#000" width="409" height="409"></canvas>
|
||||||
|
<img id=occlogo src="OCC_logo.png" style="position: absolute; left: 20px; top: 0px; z-index: 2;" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div><label for="fileInput">Choose BREP file to upload: </label><input type="file" id="fileInput" accept=".brep"></div>
|
||||||
|
<h4>Console output:</h4>
|
||||||
|
<p id="output"></p>
|
||||||
|
<script>
|
||||||
|
//! Resize canvas to fit into window.
|
||||||
|
function updateCanvasSize()
|
||||||
|
{
|
||||||
|
// size of canvas in logical (density-independent) units
|
||||||
|
var aSizeX = Math.min (window.innerWidth, window.screen.availWidth);
|
||||||
|
var aSizeY = Math.min (window.innerHeight, window.screen.availHeight);
|
||||||
|
aSizeX = Math.max (300, aSizeX - 30);
|
||||||
|
aSizeY = Math.max (300, aSizeY / 2);
|
||||||
|
canvas.style.width = aSizeX + "px";
|
||||||
|
canvas.style.height = aSizeY + "px";
|
||||||
|
|
||||||
|
// drawing buffer size (aka backing store)
|
||||||
|
var aDevicePixelRatio = window.devicePixelRatio || 1;
|
||||||
|
canvas.width = aSizeX * aDevicePixelRatio;
|
||||||
|
canvas.height = aSizeY * aDevicePixelRatio;
|
||||||
|
|
||||||
|
occlogo.style.top = (aSizeY - 30) + "px";
|
||||||
|
}
|
||||||
|
window.onresize = updateCanvasSize;
|
||||||
|
updateCanvasSize();
|
||||||
|
|
||||||
|
//! Check browser support.
|
||||||
|
function isWasmSupported()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (typeof WebAssembly === "object"
|
||||||
|
&& typeof WebAssembly.instantiate === "function") {
|
||||||
|
const aDummyModule = new WebAssembly.Module (Uint8Array.of (0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
|
||||||
|
if (aDummyModule instanceof WebAssembly.Module)
|
||||||
|
{
|
||||||
|
return new WebAssembly.Instance(aDummyModule) instanceof WebAssembly.Instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isWasmSupported())
|
||||||
|
{
|
||||||
|
var anElement = document.getElementById('output');
|
||||||
|
anElement.innerHTML += "Browser is too old - WebAssembly support is missing!<br>Please check updates or install a modern browser.<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Define OCCT WebGL Viewer module.
|
||||||
|
var Module =
|
||||||
|
{
|
||||||
|
print: (function() {
|
||||||
|
var anElement = document.getElementById('output');
|
||||||
|
return function(theText) { anElement.innerHTML += theText + "<br>"; };
|
||||||
|
})(),
|
||||||
|
printErr: function(theText) {
|
||||||
|
//var anElement = document.getElementById('output');
|
||||||
|
//anElement.innerHTML += theText + "<br>";
|
||||||
|
},
|
||||||
|
canvas: (function() {
|
||||||
|
var aCanvas = document.getElementById('canvas');
|
||||||
|
return aCanvas;
|
||||||
|
})()
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Handle file uploading.
|
||||||
|
fileInput.onchange = function()
|
||||||
|
{
|
||||||
|
if (fileInput.files.length == 0) { return; }
|
||||||
|
// Warning! Entire file is pre-loaded into memory.
|
||||||
|
var aFile = fileInput.files[0];
|
||||||
|
var aReader = new FileReader();
|
||||||
|
aReader.onload = function()
|
||||||
|
{
|
||||||
|
var aDataArray = new Uint8Array (aReader.result);
|
||||||
|
var aNameArray = new Uint8Array (toUtf8Array (aFile.name));
|
||||||
|
const aDataBuffer = Module._malloc(aDataArray.length);
|
||||||
|
const aNameBuffer = Module._malloc(aNameArray.length);
|
||||||
|
Module.HEAPU8.set(aNameArray, aNameBuffer);
|
||||||
|
Module.HEAPU8.set(aDataArray, aDataBuffer);
|
||||||
|
Module.ccall('onFileDataRead', null, ['number', 'number', 'number'], [aNameBuffer, aDataBuffer, aDataArray.length]);
|
||||||
|
Module._free(aDataBuffer);
|
||||||
|
Module._free(aNameBuffer);
|
||||||
|
fileInput.value = '';
|
||||||
|
};
|
||||||
|
aReader.readAsArrayBuffer(aFile);
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Convert string into UTF-8 array.
|
||||||
|
function toUtf8Array (theText)
|
||||||
|
{
|
||||||
|
var aRes = [];
|
||||||
|
for (var aCharIter = 0; aCharIter < theText.length; ++aCharIter)
|
||||||
|
{
|
||||||
|
var aCharCode = theText.charCodeAt (aCharIter);
|
||||||
|
if (aCharCode < 0x80)
|
||||||
|
{
|
||||||
|
aRes.push (aCharCode);
|
||||||
|
}
|
||||||
|
else if (aCharCode < 0x800)
|
||||||
|
{
|
||||||
|
aRes.push (0xc0 | (aCharCode >> 6), 0x80 | (aCharCode & 0x3f));
|
||||||
|
}
|
||||||
|
else if (aCharCode < 0xd800 || aCharCode >= 0xe000)
|
||||||
|
{
|
||||||
|
aRes.push (0xe0 | (aCharCode >> 12), 0x80 | ((aCharCode>>6) & 0x3f), 0x80 | (aCharCode & 0x3f));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++aCharIter;
|
||||||
|
aCharCode = 0x10000 + (((aCharCode & 0x3ff)<<10) | (theText.charCodeAt (aCharIter) & 0x3ff));
|
||||||
|
aRes.push(0xf0 | (aCharCode >>18), 0x80 | ((aCharCode>>12) & 0x3f), 0x80 | ((aCharCode>>6) & 0x3f), 0x80 | (aCharCode & 0x3f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return aRes;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript" src="occt-webgl-sample.js" charset="utf-8"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -197,7 +197,7 @@ void AIS_Circle::UnsetColor()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Quantity_Color CC = Quantity_NOC_YELLOW;;
|
Quantity_Color CC = Quantity_NOC_YELLOW;
|
||||||
if( HasColor() ) CC = myDrawer->Color();
|
if( HasColor() ) CC = myDrawer->Color();
|
||||||
else if (myDrawer->HasLink()) AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
|
else if (myDrawer->HasLink()) AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
|
||||||
myDrawer->LineAspect()->SetColor(CC);
|
myDrawer->LineAspect()->SetColor(CC);
|
||||||
|
@@ -415,11 +415,6 @@ Standard_Boolean AIS_ColorScale::FindColor (const Standard_Real theValue,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer AIS_ColorScale::computeMaxLabelWidth (const TColStd_SequenceOfExtendedString& theLabels) const
|
Standard_Integer AIS_ColorScale::computeMaxLabelWidth (const TColStd_SequenceOfExtendedString& theLabels) const
|
||||||
{
|
{
|
||||||
{
|
|
||||||
Handle(V3d_Viewer) aViewer = GetContext()->CurrentViewer();
|
|
||||||
aViewer->InitActiveViews(); // for AIS_ColorScale::TextSize()
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer aWidthMax = 0;
|
Standard_Integer aWidthMax = 0;
|
||||||
for (TColStd_SequenceOfExtendedString::Iterator aLabIter (theLabels); aLabIter.More(); aLabIter.Next())
|
for (TColStd_SequenceOfExtendedString::Iterator aLabIter (theLabels); aLabIter.More(); aLabIter.Next())
|
||||||
{
|
{
|
||||||
|
@@ -26,6 +26,7 @@ public:
|
|||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
AIS_ColoredDrawer (const Handle(Prs3d_Drawer)& theLink)
|
AIS_ColoredDrawer (const Handle(Prs3d_Drawer)& theLink)
|
||||||
: myIsHidden (false),
|
: myIsHidden (false),
|
||||||
|
myHasOwnMaterial(false),
|
||||||
myHasOwnColor (false),
|
myHasOwnColor (false),
|
||||||
myHasOwnTransp(false),
|
myHasOwnTransp(false),
|
||||||
myHasOwnWidth (false)
|
myHasOwnWidth (false)
|
||||||
@@ -36,6 +37,10 @@ public:
|
|||||||
bool IsHidden() const { return myIsHidden; }
|
bool IsHidden() const { return myIsHidden; }
|
||||||
void SetHidden (const bool theToHide) { myIsHidden = theToHide;}
|
void SetHidden (const bool theToHide) { myIsHidden = theToHide;}
|
||||||
|
|
||||||
|
bool HasOwnMaterial() const { return myHasOwnMaterial; }
|
||||||
|
void UnsetOwnMaterial() { myHasOwnMaterial = false; }
|
||||||
|
void SetOwnMaterial() { myHasOwnMaterial = true; }
|
||||||
|
|
||||||
bool HasOwnColor() const { return myHasOwnColor; }
|
bool HasOwnColor() const { return myHasOwnColor; }
|
||||||
void UnsetOwnColor() { myHasOwnColor = false; }
|
void UnsetOwnColor() { myHasOwnColor = false; }
|
||||||
void SetOwnColor (const Quantity_Color& /*theColor*/) { myHasOwnColor = true; }
|
void SetOwnColor (const Quantity_Color& /*theColor*/) { myHasOwnColor = true; }
|
||||||
@@ -51,6 +56,7 @@ public:
|
|||||||
public: //! @name list of overridden properties
|
public: //! @name list of overridden properties
|
||||||
|
|
||||||
bool myIsHidden;
|
bool myIsHidden;
|
||||||
|
bool myHasOwnMaterial;
|
||||||
bool myHasOwnColor;
|
bool myHasOwnColor;
|
||||||
bool myHasOwnTransp;
|
bool myHasOwnTransp;
|
||||||
bool myHasOwnWidth;
|
bool myHasOwnWidth;
|
||||||
|
@@ -333,7 +333,11 @@ void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
|
|||||||
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
|
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
|
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
|
||||||
//if (aDrawer->HasOwnMaterial()) continue;
|
if (aDrawer->HasOwnMaterial())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (aDrawer->HasOwnShadingAspect())
|
if (aDrawer->HasOwnShadingAspect())
|
||||||
{
|
{
|
||||||
setMaterial (aDrawer, theMaterial, aDrawer->HasOwnColor(), aDrawer->HasOwnTransparency());
|
setMaterial (aDrawer, theMaterial, aDrawer->HasOwnColor(), aDrawer->HasOwnTransparency());
|
||||||
|
@@ -79,6 +79,12 @@ void AIS_ConnectedInteractive::connect (const Handle(AIS_InteractiveObject)& the
|
|||||||
|
|
||||||
if (!myReference.IsNull())
|
if (!myReference.IsNull())
|
||||||
{
|
{
|
||||||
|
if (myReference->HasInteractiveContext()
|
||||||
|
&& myReference->GetContext()->DisplayStatus (myReference) != AIS_DS_None)
|
||||||
|
{
|
||||||
|
myReference.Nullify();
|
||||||
|
throw Standard_ProgramError("AIS_ConnectedInteractive::Connect() - connected object should NOT be displayed in context");
|
||||||
|
}
|
||||||
myTypeOfPresentation3d = myReference->TypeOfPresentation3d();
|
myTypeOfPresentation3d = myReference->TypeOfPresentation3d();
|
||||||
}
|
}
|
||||||
setLocalTransformation (theLocation);
|
setLocalTransformation (theLocation);
|
||||||
|
@@ -300,7 +300,7 @@ void AIS_FixRelation::ComputeVertex(const TopoDS_Vertex& /*FixVertex*/,
|
|||||||
gp_Pln pln(myPlane->Pln());
|
gp_Pln pln(myPlane->Pln());
|
||||||
gp_Dir dir(pln.XAxis().Direction());
|
gp_Dir dir(pln.XAxis().Direction());
|
||||||
gp_Vec transvec = gp_Vec(dir)*myArrowSize;
|
gp_Vec transvec = gp_Vec(dir)*myArrowSize;
|
||||||
curpos = myPntAttach.Translated(transvec);;
|
curpos = myPntAttach.Translated(transvec);
|
||||||
myPosition = curpos;
|
myPosition = curpos;
|
||||||
myAutomaticPosition = Standard_True;
|
myAutomaticPosition = Standard_True;
|
||||||
}
|
}
|
||||||
|
@@ -65,7 +65,7 @@ public:
|
|||||||
|
|
||||||
//! Returns true if the Interactive Objects in the relation
|
//! Returns true if the Interactive Objects in the relation
|
||||||
//! are movable.
|
//! are movable.
|
||||||
virtual Standard_Boolean IsMovable() const Standard_OVERRIDE;
|
virtual Standard_Boolean IsMovable() const Standard_OVERRIDE { return Standard_True; }
|
||||||
|
|
||||||
//! computes the presentation according to a point of view
|
//! computes the presentation according to a point of view
|
||||||
//! given by <aProjector>.
|
//! given by <aProjector>.
|
||||||
@@ -109,6 +109,4 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <AIS_FixRelation.lxx>
|
|
||||||
|
|
||||||
#endif // _AIS_FixRelation_HeaderFile
|
#endif // _AIS_FixRelation_HeaderFile
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
// Created on: 1997-02-28
|
|
||||||
// Created by: Jean-Pierre COMBE
|
|
||||||
// Copyright (c) 1997-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsMovable
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
inline Standard_Boolean AIS_FixRelation::IsMovable() const
|
|
||||||
{
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
@@ -92,7 +92,7 @@ Aspect_TypeOfLine AIS_GraphicTool::GetLineType (const Handle(Prs3d_Drawer)& Dr,
|
|||||||
const AIS_TypeOfAttribute Att)
|
const AIS_TypeOfAttribute Att)
|
||||||
{
|
{
|
||||||
Handle(Prs3d_LineAspect) LA = GetLineAspect(Dr,Att);
|
Handle(Prs3d_LineAspect) LA = GetLineAspect(Dr,Att);
|
||||||
return LA->Aspect()->Type();;
|
return LA->Aspect()->Type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -560,7 +560,7 @@ void AIS_IdenticRelation::ComputeTwoLinesPresentation(const Handle(Prs3d_Present
|
|||||||
gp_Pln pln(myPlane->Pln());
|
gp_Pln pln(myPlane->Pln());
|
||||||
gp_Dir dir(pln.XAxis().Direction());
|
gp_Dir dir(pln.XAxis().Direction());
|
||||||
gp_Vec transvec = gp_Vec(dir)*myArrowSize;
|
gp_Vec transvec = gp_Vec(dir)*myArrowSize;
|
||||||
curpos = myFAttach.Translated(transvec);;
|
curpos = myFAttach.Translated(transvec);
|
||||||
myPosition = curpos;
|
myPosition = curpos;
|
||||||
myAutomaticPosition = Standard_True;
|
myAutomaticPosition = Standard_True;
|
||||||
}
|
}
|
||||||
|
@@ -58,7 +58,7 @@ public:
|
|||||||
void ClearUsers() { myUsers.Clear(); }
|
void ClearUsers() { myUsers.Clear(); }
|
||||||
|
|
||||||
//! Returns true if the interactive object is movable.
|
//! Returns true if the interactive object is movable.
|
||||||
virtual Standard_Boolean IsMovable() const Standard_OVERRIDE;
|
virtual Standard_Boolean IsMovable() const Standard_OVERRIDE { return Standard_True; }
|
||||||
|
|
||||||
//! computes the presentation according to a point of view
|
//! computes the presentation according to a point of view
|
||||||
//! given by <aProjector>.
|
//! given by <aProjector>.
|
||||||
@@ -134,11 +134,4 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#include <AIS_IdenticRelation.lxx>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _AIS_IdenticRelation_HeaderFile
|
#endif // _AIS_IdenticRelation_HeaderFile
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
// Created on: 1997-03-04
|
|
||||||
// Created by: Jean-Pierre COMBE
|
|
||||||
// Copyright (c) 1997-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsMovable
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
inline Standard_Boolean AIS_IdenticRelation::IsMovable() const
|
|
||||||
{
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
@@ -65,13 +65,15 @@ namespace
|
|||||||
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), Handle(SelectMgr_IndexedMapOfOwner)>::Iterator AIS_MapIteratorOfMapOfObjectOwners;
|
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), Handle(SelectMgr_IndexedMapOfOwner)>::Iterator AIS_MapIteratorOfMapOfObjectOwners;
|
||||||
|
|
||||||
//! Initialize default highlighting attributes.
|
//! Initialize default highlighting attributes.
|
||||||
static void initDefaultHilightAttributes (const Handle(Prs3d_Drawer)& theDrawer)
|
static void initDefaultHilightAttributes (const Handle(Prs3d_Drawer)& theDrawer,
|
||||||
|
const Quantity_Color& theColor)
|
||||||
{
|
{
|
||||||
theDrawer->SetMethod (Aspect_TOHM_COLOR);
|
theDrawer->SetMethod (Aspect_TOHM_COLOR);
|
||||||
theDrawer->SetDisplayMode (0);
|
theDrawer->SetDisplayMode (0);
|
||||||
|
theDrawer->SetColor (theColor);
|
||||||
|
|
||||||
theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_BLACK, 1.0));
|
theDrawer->SetupOwnShadingAspect();
|
||||||
*theDrawer->PointAspect()->Aspect() = *theDrawer->Link()->PointAspect()->Aspect();
|
theDrawer->SetupOwnPointAspect();
|
||||||
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||||
*theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
|
*theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
|
||||||
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||||
@@ -82,6 +84,24 @@ namespace
|
|||||||
*theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect();
|
*theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect();
|
||||||
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||||
*theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect();
|
*theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect();
|
||||||
|
theDrawer->SetDatumAspect (new Prs3d_DatumAspect());
|
||||||
|
|
||||||
|
theDrawer->ShadingAspect()->SetColor (theColor);
|
||||||
|
theDrawer->WireAspect()->SetColor (theColor);
|
||||||
|
theDrawer->LineAspect()->SetColor (theColor);
|
||||||
|
theDrawer->PlaneAspect()->ArrowAspect()->SetColor (theColor);
|
||||||
|
theDrawer->PlaneAspect()->IsoAspect()->SetColor (theColor);
|
||||||
|
theDrawer->PlaneAspect()->EdgesAspect()->SetColor (theColor);
|
||||||
|
theDrawer->FreeBoundaryAspect()->SetColor (theColor);
|
||||||
|
theDrawer->UnFreeBoundaryAspect()->SetColor (theColor);
|
||||||
|
theDrawer->PointAspect()->SetColor (theColor);
|
||||||
|
for (Standard_Integer aPartIter = 0; aPartIter < Prs3d_DP_None; ++aPartIter)
|
||||||
|
{
|
||||||
|
if (Handle(Prs3d_LineAspect) aLineAsp = theDrawer->DatumAspect()->LineAspect ((Prs3d_DatumParts )aPartIter))
|
||||||
|
{
|
||||||
|
aLineAsp->SetColor (theColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
theDrawer->WireAspect()->SetWidth (2.0);
|
theDrawer->WireAspect()->SetWidth (2.0);
|
||||||
theDrawer->LineAspect()->SetWidth (2.0);
|
theDrawer->LineAspect()->SetWidth (2.0);
|
||||||
@@ -130,30 +150,26 @@ myIsAutoActivateSelMode(Standard_True)
|
|||||||
{
|
{
|
||||||
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_Dynamic];
|
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_Dynamic];
|
||||||
aStyle->Link (myDefaultDrawer);
|
aStyle->Link (myDefaultDrawer);
|
||||||
initDefaultHilightAttributes (aStyle);
|
initDefaultHilightAttributes (aStyle, Quantity_NOC_CYAN1);
|
||||||
aStyle->SetZLayer(Graphic3d_ZLayerId_Top);
|
aStyle->SetZLayer(Graphic3d_ZLayerId_Top);
|
||||||
aStyle->SetColor (Quantity_NOC_CYAN1);
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_LocalDynamic];
|
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_LocalDynamic];
|
||||||
aStyle->Link (myDefaultDrawer);
|
aStyle->Link (myDefaultDrawer);
|
||||||
initDefaultHilightAttributes (aStyle);
|
initDefaultHilightAttributes (aStyle, Quantity_NOC_CYAN1);
|
||||||
aStyle->SetZLayer(Graphic3d_ZLayerId_Topmost);
|
aStyle->SetZLayer(Graphic3d_ZLayerId_Topmost);
|
||||||
aStyle->SetColor (Quantity_NOC_CYAN1);
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_Selected];
|
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_Selected];
|
||||||
aStyle->Link (myDefaultDrawer);
|
aStyle->Link (myDefaultDrawer);
|
||||||
initDefaultHilightAttributes (aStyle);
|
initDefaultHilightAttributes (aStyle, Quantity_NOC_GRAY80);
|
||||||
aStyle->SetZLayer(Graphic3d_ZLayerId_UNKNOWN);
|
aStyle->SetZLayer(Graphic3d_ZLayerId_UNKNOWN);
|
||||||
aStyle->SetColor (Quantity_NOC_GRAY80);
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_LocalSelected];
|
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_LocalSelected];
|
||||||
aStyle->Link (myDefaultDrawer);
|
aStyle->Link (myDefaultDrawer);
|
||||||
initDefaultHilightAttributes (aStyle);
|
initDefaultHilightAttributes (aStyle, Quantity_NOC_GRAY80);
|
||||||
aStyle->SetZLayer(Graphic3d_ZLayerId_UNKNOWN);
|
aStyle->SetZLayer(Graphic3d_ZLayerId_UNKNOWN);
|
||||||
aStyle->SetColor (Quantity_NOC_GRAY80);
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_SubIntensity];
|
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_SubIntensity];
|
||||||
|
@@ -1216,6 +1216,9 @@ public: //! @name sub-intensity management (deprecated)
|
|||||||
//! @param theSelection an instance of the selection
|
//! @param theSelection an instance of the selection
|
||||||
void SetSelection (const Handle(AIS_Selection)& theSelection) { mySelection = theSelection; }
|
void SetSelection (const Handle(AIS_Selection)& theSelection) { mySelection = theSelection; }
|
||||||
|
|
||||||
|
//! Dumps the content of me into the stream
|
||||||
|
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
||||||
|
|
||||||
protected: //! @name internal methods
|
protected: //! @name internal methods
|
||||||
|
|
||||||
Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
|
Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
|
||||||
|
@@ -86,3 +86,42 @@ void AIS_InteractiveContext::PolygonOffsets(
|
|||||||
anObj->PolygonOffsets( aMode, aFactor, aUnits );
|
anObj->PolygonOffsets( aMode, aFactor, aUnits );
|
||||||
}
|
}
|
||||||
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : DumpJson
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_InteractiveContext::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
|
||||||
|
{
|
||||||
|
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||||
|
|
||||||
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myObjects.Size())
|
||||||
|
|
||||||
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, mgrSelector.get())
|
||||||
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainPM.get())
|
||||||
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainVwr.get())
|
||||||
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myMainSel.get())
|
||||||
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myLastActiveView)
|
||||||
|
|
||||||
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myLastPicked.get())
|
||||||
|
|
||||||
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToHilightSelected)
|
||||||
|
|
||||||
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, mySelection.get())
|
||||||
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myFilters.get())
|
||||||
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myDefaultDrawer.get())
|
||||||
|
|
||||||
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_Selected])
|
||||||
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_Dynamic])
|
||||||
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_LocalSelected])
|
||||||
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_LocalDynamic])
|
||||||
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStyles[Prs3d_TypeOfHighlight_SubIntensity])
|
||||||
|
|
||||||
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDetectedSeq.Size())
|
||||||
|
|
||||||
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurDetected)
|
||||||
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurHighlighted)
|
||||||
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPickingStrategy)
|
||||||
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAutoHilight)
|
||||||
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsAutoActivateSelMode)
|
||||||
|
}
|
||||||
|
@@ -148,11 +148,11 @@ void AIS_InteractiveObject::SetAspect(const Handle(Prs3d_BasicAspect)& theAspect
|
|||||||
//function : DumpJson
|
//function : DumpJson
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_InteractiveObject::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
|
void AIS_InteractiveObject::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||||
{
|
{
|
||||||
OCCT_DUMP_CLASS_BEGIN (theOStream, AIS_InteractiveObject);
|
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||||
|
|
||||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, SelectMgr_SelectableObject);
|
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, SelectMgr_SelectableObject)
|
||||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myCTXPtr);
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myCTXPtr)
|
||||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myOwner);
|
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myOwner)
|
||||||
}
|
}
|
||||||
|
@@ -119,7 +119,7 @@ public:
|
|||||||
Standard_EXPORT void SetAspect (const Handle(Prs3d_BasicAspect)& anAspect);
|
Standard_EXPORT void SetAspect (const Handle(Prs3d_BasicAspect)& anAspect);
|
||||||
|
|
||||||
//! Dumps the content of me into the stream
|
//! Dumps the content of me into the stream
|
||||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! The TypeOfPresention3d means that the interactive object
|
//! The TypeOfPresention3d means that the interactive object
|
||||||
|
@@ -30,7 +30,8 @@
|
|||||||
#include <V3d_View.hxx>
|
#include <V3d_View.hxx>
|
||||||
#include <Standard_Version.hxx>
|
#include <Standard_Version.hxx>
|
||||||
#include <Standard_DefineHandle.hxx>
|
#include <Standard_DefineHandle.hxx>
|
||||||
NCOLLECTION_HSEQUENCE(AIS_ManipulatorObjectSequence, Handle(AIS_InteractiveObject));
|
|
||||||
|
NCOLLECTION_HSEQUENCE(AIS_ManipulatorObjectSequence, Handle(AIS_InteractiveObject))
|
||||||
|
|
||||||
DEFINE_STANDARD_HANDLE (AIS_Manipulator, AIS_InteractiveObject)
|
DEFINE_STANDARD_HANDLE (AIS_Manipulator, AIS_InteractiveObject)
|
||||||
|
|
||||||
|
@@ -168,7 +168,7 @@ void AIS_OffsetDimension::ComputeSelection(const Handle(SelectMgr_Selection)& aS
|
|||||||
gp_Pnt myTSAttach = mySAttach.Transformed (myRelativePos);
|
gp_Pnt myTSAttach = mySAttach.Transformed (myRelativePos);
|
||||||
gp_Dir myTDirAttach = myDirAttach.Transformed (myRelativePos);
|
gp_Dir myTDirAttach = myDirAttach.Transformed (myRelativePos);
|
||||||
gp_Dir myTDirAttach2 = myDirAttach2.Transformed (myRelativePos);
|
gp_Dir myTDirAttach2 = myDirAttach2.Transformed (myRelativePos);
|
||||||
gp_Pnt Tcurpos = myPosition.Transformed (myRelativePos);;
|
gp_Pnt Tcurpos = myPosition.Transformed (myRelativePos);
|
||||||
|
|
||||||
gp_Lin L1 (myTFAttach,myTDirAttach);
|
gp_Lin L1 (myTFAttach,myTDirAttach);
|
||||||
gp_Lin L2 (myTSAttach,myTDirAttach2);
|
gp_Lin L2 (myTSAttach,myTDirAttach2);
|
||||||
|
@@ -990,3 +990,19 @@ Standard_Boolean AIS_Shape::OwnHLRDeviationAngle ( Standard_Real & anAngle,
|
|||||||
aPreviousAngle = myDrawer->PreviousHLRDeviationAngle ();
|
aPreviousAngle = myDrawer->PreviousHLRDeviationAngle ();
|
||||||
return myDrawer->HasOwnHLRDeviationAngle();
|
return myDrawer->HasOwnHLRDeviationAngle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : DumpJson
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_Shape::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||||
|
{
|
||||||
|
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||||
|
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, AIS_InteractiveObject)
|
||||||
|
|
||||||
|
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myshape)
|
||||||
|
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBB)
|
||||||
|
|
||||||
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myInitAng)
|
||||||
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCompBB)
|
||||||
|
}
|
||||||
|
@@ -325,6 +325,9 @@ public:
|
|||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
const Handle(Prs3d_Drawer)& theDrawer);
|
const Handle(Prs3d_Drawer)& theDrawer);
|
||||||
|
|
||||||
|
//! Dumps the content of me into the stream
|
||||||
|
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
TopoDS_Shape myshape; //!< shape to display
|
TopoDS_Shape myshape; //!< shape to display
|
||||||
|
@@ -44,8 +44,7 @@ AIS_TextLabel::AIS_TextLabel()
|
|||||||
myHasFlipping (Standard_False)
|
myHasFlipping (Standard_False)
|
||||||
{
|
{
|
||||||
myDrawer->SetTextAspect (new Prs3d_TextAspect());
|
myDrawer->SetTextAspect (new Prs3d_TextAspect());
|
||||||
|
myDrawer->SetDisplayMode (0);
|
||||||
SetDisplayMode (0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@@ -32,6 +32,9 @@ public:
|
|||||||
//! Default constructor
|
//! Default constructor
|
||||||
Standard_EXPORT AIS_TextLabel();
|
Standard_EXPORT AIS_TextLabel();
|
||||||
|
|
||||||
|
//! Return TRUE for supported display mode.
|
||||||
|
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
|
||||||
|
|
||||||
//! Setup color of entire text.
|
//! Setup color of entire text.
|
||||||
Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
|
Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
#include <Prs3d_DatumAspect.hxx>
|
#include <Prs3d_DatumAspect.hxx>
|
||||||
#include <Prs3d_Drawer.hxx>
|
#include <Prs3d_Drawer.hxx>
|
||||||
#include <Prs3d_LineAspect.hxx>
|
#include <Prs3d_LineAspect.hxx>
|
||||||
|
#include <Prs3d_PointAspect.hxx>
|
||||||
#include <Prs3d_Presentation.hxx>
|
#include <Prs3d_Presentation.hxx>
|
||||||
#include <Prs3d_Projector.hxx>
|
#include <Prs3d_Projector.hxx>
|
||||||
#include <Prs3d_ShadingAspect.hxx>
|
#include <Prs3d_ShadingAspect.hxx>
|
||||||
@@ -59,6 +60,8 @@ AIS_Trihedron::AIS_Trihedron (const Handle(Geom_Axis2Placement)& theComponent)
|
|||||||
myTrihDispMode (Prs3d_DM_WireFrame),
|
myTrihDispMode (Prs3d_DM_WireFrame),
|
||||||
myComponent (theComponent)
|
myComponent (theComponent)
|
||||||
{
|
{
|
||||||
|
myAutoHilight = Standard_False;
|
||||||
|
|
||||||
// selection priorities
|
// selection priorities
|
||||||
mySelectionPriority.Bind (Prs3d_DP_None, 5); // complete triedron: priority 5 (same as faces)
|
mySelectionPriority.Bind (Prs3d_DP_None, 5); // complete triedron: priority 5 (same as faces)
|
||||||
mySelectionPriority.Bind (Prs3d_DP_Origin, 8); // origin: priority 8
|
mySelectionPriority.Bind (Prs3d_DP_Origin, 8); // origin: priority 8
|
||||||
@@ -70,6 +73,7 @@ AIS_Trihedron::AIS_Trihedron (const Handle(Geom_Axis2Placement)& theComponent)
|
|||||||
{
|
{
|
||||||
mySelectionPriority.Bind ((Prs3d_DatumParts )aPartIter, 5); // planes: priority: 5
|
mySelectionPriority.Bind ((Prs3d_DatumParts )aPartIter, 5); // planes: priority: 5
|
||||||
}
|
}
|
||||||
|
myHiddenLineAspect = new Graphic3d_AspectLine3d (Quantity_NOC_WHITE, Aspect_TOL_EMPTY, 1.0f);
|
||||||
|
|
||||||
// trihedron labels
|
// trihedron labels
|
||||||
myLabel.Bind (Prs3d_DP_XAxis, "X");
|
myLabel.Bind (Prs3d_DP_XAxis, "X");
|
||||||
@@ -135,7 +139,6 @@ void AIS_Trihedron::SetSize(const Standard_Real aValue)
|
|||||||
myDrawer->DatumAspect()->SetAxisLength(aValue, aValue, aValue);
|
myDrawer->DatumAspect()->SetAxisLength(aValue, aValue, aValue);
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
UpdatePresentations();
|
|
||||||
UpdateSelection();
|
UpdateSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +166,6 @@ void AIS_Trihedron::UnsetSize()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
UpdatePresentations();
|
|
||||||
}
|
}
|
||||||
UpdateSelection();
|
UpdateSelection();
|
||||||
}
|
}
|
||||||
@@ -310,36 +312,37 @@ void AIS_Trihedron::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManag
|
|||||||
aPresentation->Clear();
|
aPresentation->Clear();
|
||||||
const Prs3d_DatumParts aPart = anOwner->DatumPart();
|
const Prs3d_DatumParts aPart = anOwner->DatumPart();
|
||||||
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPresentation);
|
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPresentation);
|
||||||
Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect();
|
|
||||||
if (aPart >= Prs3d_DP_XOYAxis && aPart <= Prs3d_DP_XOZAxis)
|
if (aPart >= Prs3d_DP_XOYAxis && aPart <= Prs3d_DP_XOZAxis)
|
||||||
{
|
{
|
||||||
// planes selection is equal in both shading and wireframe mode
|
// planes selection is equal in both shading and wireframe mode
|
||||||
aGroup->SetGroupPrimitivesAspect (getHighlightLineAspect()->Aspect());
|
aGroup->SetGroupPrimitivesAspect (theStyle->LineAspect()->Aspect());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (myTrihDispMode == Prs3d_DM_Shaded)
|
if (myTrihDispMode == Prs3d_DM_Shaded)
|
||||||
{
|
{
|
||||||
aGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect(aPart)->Aspect());
|
aGroup->SetGroupPrimitivesAspect (theStyle->ShadingAspect()->Aspect());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (aPart == Prs3d_DP_Origin)
|
if (aPart == Prs3d_DP_Origin)
|
||||||
{
|
{
|
||||||
aGroup->SetGroupPrimitivesAspect (getHighlightPointAspect()->Aspect());
|
aGroup->SetGroupPrimitivesAspect (theStyle->PointAspect()->Aspect());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aGroup->SetGroupPrimitivesAspect (anAspect->LineAspect(aPart)->Aspect());
|
aGroup->SetGroupPrimitivesAspect(theStyle->LineAspect()->Aspect());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aGroup->AddPrimitiveArray (arrayOfPrimitives(aPart));
|
aGroup->AddPrimitiveArray (arrayOfPrimitives(aPart));
|
||||||
|
|
||||||
if (aPresentation->GetZLayer() != theStyle->ZLayer())
|
const Graphic3d_ZLayerId aLayer = theStyle->ZLayer() != Graphic3d_ZLayerId_UNKNOWN ? theStyle->ZLayer() : myDrawer->ZLayer();
|
||||||
|
if (aPresentation->GetZLayer() != aLayer)
|
||||||
{
|
{
|
||||||
aPresentation->SetZLayer (theStyle->ZLayer());
|
aPresentation->SetZLayer (aLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
aPresentation->Highlight (theStyle);
|
aPresentation->Highlight (theStyle);
|
||||||
thePM->AddToImmediateList (aPresentation);
|
thePM->AddToImmediateList (aPresentation);
|
||||||
}
|
}
|
||||||
@@ -356,25 +359,22 @@ void AIS_Trihedron::HilightSelected (const Handle(PrsMgr_PresentationManager3d)&
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect();
|
|
||||||
const bool isShadingMode = myTrihDispMode == Prs3d_DM_Shaded;
|
const bool isShadingMode = myTrihDispMode == Prs3d_DM_Shaded;
|
||||||
|
|
||||||
const Handle(Prs3d_Drawer)& aContextSelStyle = GetContext()->SelectionStyle();
|
Handle(Prs3d_Drawer) anAspect = !myHilightDrawer.IsNull() ? myHilightDrawer : GetContext()->SelectionStyle();
|
||||||
const Quantity_Color& aSelectionColor = aContextSelStyle->Color();
|
|
||||||
for (SelectMgr_SequenceOfOwner::Iterator anIterator (theOwners); anIterator.More(); anIterator.Next())
|
for (SelectMgr_SequenceOfOwner::Iterator anIterator (theOwners); anIterator.More(); anIterator.Next())
|
||||||
{
|
{
|
||||||
const Handle(SelectMgr_EntityOwner)& anOwner = anIterator.Value();
|
const Handle(SelectMgr_EntityOwner)& anOwner = anIterator.Value();
|
||||||
Handle(AIS_TrihedronOwner) aTrihedronOwner = Handle(AIS_TrihedronOwner)::DownCast(anOwner);
|
Handle(AIS_TrihedronOwner) aTrihedronOwner = Handle(AIS_TrihedronOwner)::DownCast(anOwner);
|
||||||
if (aTrihedronOwner.IsNull())
|
if (aTrihedronOwner.IsNull())
|
||||||
{
|
{
|
||||||
thePM->Color (this, aContextSelStyle, 0);
|
thePM->Color (this, anAspect, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Prs3d_DatumParts aPart = aTrihedronOwner->DatumPart();
|
const Prs3d_DatumParts aPart = aTrihedronOwner->DatumPart();
|
||||||
Handle(Graphic3d_Group) aGroup;
|
Handle(Graphic3d_Group) aGroup;
|
||||||
if (mySelectedParts.Contains (aPart)
|
if (mySelectedParts.Contains (aPart) || !myPartToGroup.Find (aPart, aGroup))
|
||||||
|| !myPartToGroup.Find (aPart, aGroup))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -382,27 +382,23 @@ void AIS_Trihedron::HilightSelected (const Handle(PrsMgr_PresentationManager3d)&
|
|||||||
if (aPart >= Prs3d_DP_XOYAxis
|
if (aPart >= Prs3d_DP_XOYAxis
|
||||||
&& aPart <= Prs3d_DP_XOZAxis)
|
&& aPart <= Prs3d_DP_XOZAxis)
|
||||||
{
|
{
|
||||||
getHighlightLineAspect()->SetColor (aSelectionColor);
|
aGroup->SetGroupPrimitivesAspect (anAspect->LineAspect()->Aspect());
|
||||||
aGroup->SetGroupPrimitivesAspect (getHighlightLineAspect()->Aspect());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isShadingMode)
|
if (isShadingMode)
|
||||||
{
|
{
|
||||||
getHighlightAspect()->SetColor (aSelectionColor);
|
aGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect()->Aspect());
|
||||||
aGroup->SetGroupPrimitivesAspect (getHighlightAspect()->Aspect());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (aPart == Prs3d_DP_Origin)
|
if (aPart == Prs3d_DP_Origin)
|
||||||
{
|
{
|
||||||
getHighlightPointAspect()->SetColor (aSelectionColor);
|
aGroup->SetGroupPrimitivesAspect (anAspect->PointAspect()->Aspect());
|
||||||
aGroup->SetGroupPrimitivesAspect (getHighlightPointAspect()->Aspect());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getHighlightLineAspect()->SetColor (aSelectionColor);
|
aGroup->SetGroupPrimitivesAspect (anAspect->LineAspect()->Aspect());
|
||||||
aGroup->SetGroupPrimitivesAspect (getHighlightLineAspect()->Aspect());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -426,9 +422,9 @@ void AIS_Trihedron::ClearSelected()
|
|||||||
if (aPart >= Prs3d_DP_XOYAxis
|
if (aPart >= Prs3d_DP_XOYAxis
|
||||||
&& aPart <= Prs3d_DP_XOZAxis)
|
&& aPart <= Prs3d_DP_XOZAxis)
|
||||||
{
|
{
|
||||||
aGroup->SetGroupPrimitivesAspect (anAspect->LineAspect (aPart)->Aspect());
|
aGroup->SetGroupPrimitivesAspect (myHiddenLineAspect);
|
||||||
}
|
}
|
||||||
if (isShadingMode)
|
else if (isShadingMode)
|
||||||
{
|
{
|
||||||
aGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect (aPart)->Aspect());
|
aGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect (aPart)->Aspect());
|
||||||
}
|
}
|
||||||
@@ -553,11 +549,8 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager
|
|||||||
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePrs);
|
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePrs);
|
||||||
myPartToGroup.Bind (aPart, aGroup);
|
myPartToGroup.Bind (aPart, aGroup);
|
||||||
|
|
||||||
const Handle(Graphic3d_AspectLine3d)& aLineAspect = anAspect->LineAspect (aPart)->Aspect();
|
|
||||||
aLineAspect->SetType (Aspect_TOL_EMPTY);
|
|
||||||
|
|
||||||
aGroup->AddPrimitiveArray (arrayOfPrimitives (aPart));
|
aGroup->AddPrimitiveArray (arrayOfPrimitives (aPart));
|
||||||
aGroup->SetGroupPrimitivesAspect (aLineAspect);
|
aGroup->SetGroupPrimitivesAspect (myHiddenLineAspect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -934,64 +927,19 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
//=======================================================================
|
||||||
// function : getHighlightAspect
|
//function : DumpJson
|
||||||
// purpose :
|
//purpose :
|
||||||
// =======================================================================
|
//=======================================================================
|
||||||
Handle(Prs3d_ShadingAspect) AIS_Trihedron::getHighlightAspect()
|
void AIS_Trihedron::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||||
{
|
{
|
||||||
if (!myHighlightAspect.IsNull())
|
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||||
return myHighlightAspect;
|
|
||||||
|
|
||||||
Quantity_Color aHighlightColor = Quantity_NOC_GRAY80;
|
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, AIS_InteractiveObject)
|
||||||
if (!myHilightDrawer.IsNull())
|
|
||||||
aHighlightColor = myHilightDrawer->Color();
|
|
||||||
|
|
||||||
myHighlightAspect = new Prs3d_ShadingAspect();
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnSize)
|
||||||
myHighlightAspect->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnTextColor)
|
||||||
myHighlightAspect->SetColor (aHighlightColor);
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnArrowColor)
|
||||||
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDatumAspect)
|
||||||
Graphic3d_MaterialAspect aHighlightMaterial;
|
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTrihDispMode)
|
||||||
aHighlightMaterial.SetColor (aHighlightColor);
|
|
||||||
myHighlightAspect->SetMaterial (aHighlightMaterial);
|
|
||||||
|
|
||||||
return myHighlightAspect;
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : getHighlightLineAspect
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
Handle(Prs3d_LineAspect) AIS_Trihedron::getHighlightLineAspect()
|
|
||||||
{
|
|
||||||
if (!myHighlightLineAspect.IsNull())
|
|
||||||
return myHighlightLineAspect;
|
|
||||||
|
|
||||||
Quantity_Color aHighlightColor = Quantity_NOC_GRAY80;
|
|
||||||
if (!myHilightDrawer.IsNull())
|
|
||||||
aHighlightColor = myHilightDrawer->Color();
|
|
||||||
|
|
||||||
Handle(Prs3d_DatumAspect) aDatumAspect = Attributes()->DatumAspect();
|
|
||||||
Handle(Prs3d_LineAspect) aLineAspect = aDatumAspect->LineAspect(Prs3d_DP_XAxis);
|
|
||||||
myHighlightLineAspect = new Prs3d_LineAspect (aHighlightColor, aLineAspect->Aspect()->Type(),
|
|
||||||
aLineAspect->Aspect()->Width());
|
|
||||||
|
|
||||||
return myHighlightLineAspect;
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : getHighlightPointAspect
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
Handle(Prs3d_PointAspect) AIS_Trihedron::getHighlightPointAspect()
|
|
||||||
{
|
|
||||||
if (!myHighlightPointAspect.IsNull())
|
|
||||||
return myHighlightPointAspect;
|
|
||||||
|
|
||||||
Quantity_Color aHighlightColor = Quantity_NOC_GRAY80;
|
|
||||||
if (!myHilightDrawer.IsNull())
|
|
||||||
aHighlightColor = myHilightDrawer->Color();
|
|
||||||
myHighlightPointAspect = new Prs3d_PointAspect (Aspect_TOM_PLUS, aHighlightColor, 1.0);
|
|
||||||
|
|
||||||
return myHighlightPointAspect;
|
|
||||||
}
|
}
|
||||||
|
@@ -186,9 +186,6 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden methods.
|
|
||||||
virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE { return false; }
|
|
||||||
|
|
||||||
//! Method which clear all selected owners belonging
|
//! Method which clear all selected owners belonging
|
||||||
//! to this selectable object ( for fast presentation draw ).
|
//! to this selectable object ( for fast presentation draw ).
|
||||||
Standard_EXPORT virtual void ClearSelected() Standard_OVERRIDE;
|
Standard_EXPORT virtual void ClearSelected() Standard_OVERRIDE;
|
||||||
@@ -222,6 +219,9 @@ protected:
|
|||||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Dumps the content of me into the stream
|
||||||
|
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! Creates a sensitive entity for the datum part that will be used in selection owner creation.
|
//! Creates a sensitive entity for the datum part that will be used in selection owner creation.
|
||||||
@@ -248,13 +248,6 @@ protected:
|
|||||||
const gp_Dir& theYDir,
|
const gp_Dir& theYDir,
|
||||||
const gp_Dir& theZDir);
|
const gp_Dir& theZDir);
|
||||||
|
|
||||||
//! Returns highlight line aspect , create if it is the first call
|
|
||||||
Handle(Prs3d_ShadingAspect) getHighlightAspect();
|
|
||||||
//! Returns highlight line aspect , create if it is the first call
|
|
||||||
Handle(Prs3d_LineAspect) getHighlightLineAspect();
|
|
||||||
//! Returns highlight line aspect , create if it is the first call
|
|
||||||
Handle(Prs3d_PointAspect) getHighlightPointAspect();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Standard_Boolean myHasOwnSize;
|
Standard_Boolean myHasOwnSize;
|
||||||
Standard_Boolean myHasOwnTextColor;
|
Standard_Boolean myHasOwnTextColor;
|
||||||
@@ -269,10 +262,7 @@ protected:
|
|||||||
|
|
||||||
NCollection_DataMap<Prs3d_DatumParts, Handle(Graphic3d_Group)> myPartToGroup;
|
NCollection_DataMap<Prs3d_DatumParts, Handle(Graphic3d_Group)> myPartToGroup;
|
||||||
NCollection_List<Prs3d_DatumParts> mySelectedParts;
|
NCollection_List<Prs3d_DatumParts> mySelectedParts;
|
||||||
|
Handle(Graphic3d_AspectLine3d) myHiddenLineAspect;
|
||||||
Handle(Prs3d_ShadingAspect) myHighlightAspect;
|
|
||||||
Handle(Prs3d_LineAspect) myHighlightLineAspect;
|
|
||||||
Handle(Prs3d_PointAspect) myHighlightPointAspect;
|
|
||||||
|
|
||||||
NCollection_DataMap<Prs3d_DatumParts, Handle(Graphic3d_ArrayOfPrimitives)> myPrimitives;
|
NCollection_DataMap<Prs3d_DatumParts, Handle(Graphic3d_ArrayOfPrimitives)> myPrimitives;
|
||||||
};
|
};
|
||||||
|
@@ -69,6 +69,7 @@ AIS_ViewController::AIS_ViewController()
|
|||||||
myMousePressed (Aspect_VKeyMouse_NONE),
|
myMousePressed (Aspect_VKeyMouse_NONE),
|
||||||
myMouseModifiers (Aspect_VKeyFlags_NONE),
|
myMouseModifiers (Aspect_VKeyFlags_NONE),
|
||||||
myMouseSingleButton (-1),
|
myMouseSingleButton (-1),
|
||||||
|
myMouseStopDragOnUnclick (false),
|
||||||
//
|
//
|
||||||
myTouchToleranceScale (1.0f),
|
myTouchToleranceScale (1.0f),
|
||||||
myTouchRotationThresholdPx (6.0f),
|
myTouchRotationThresholdPx (6.0f),
|
||||||
@@ -112,6 +113,15 @@ AIS_ViewController::AIS_ViewController()
|
|||||||
myMouseGestureMap.Bind (Aspect_VKeyMouse_MiddleButton | Aspect_VKeyFlags_CTRL, AIS_MouseGesture_Pan);
|
myMouseGestureMap.Bind (Aspect_VKeyMouse_MiddleButton | Aspect_VKeyFlags_CTRL, AIS_MouseGesture_Pan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : ~AIS_ViewController
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
AIS_ViewController::~AIS_ViewController()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : ResetViewInput
|
// function : ResetViewInput
|
||||||
// purpose :
|
// purpose :
|
||||||
@@ -611,6 +621,7 @@ bool AIS_ViewController::UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
|
|||||||
{
|
{
|
||||||
myMouseClickTimer.Stop();
|
myMouseClickTimer.Stop();
|
||||||
myMouseClickCounter = 0;
|
myMouseClickCounter = 0;
|
||||||
|
myMouseStopDragOnUnclick = false;
|
||||||
myUI.Dragging.ToStop = true;
|
myUI.Dragging.ToStop = true;
|
||||||
toUpdateView = true;
|
toUpdateView = true;
|
||||||
}
|
}
|
||||||
@@ -619,6 +630,12 @@ bool AIS_ViewController::UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
|
|||||||
else if (theButtons == Aspect_VKeyMouse_NONE)
|
else if (theButtons == Aspect_VKeyMouse_NONE)
|
||||||
{
|
{
|
||||||
myMouseSingleButton = -1;
|
myMouseSingleButton = -1;
|
||||||
|
if (myMouseStopDragOnUnclick)
|
||||||
|
{
|
||||||
|
myMouseStopDragOnUnclick = false;
|
||||||
|
myUI.Dragging.ToStop = true;
|
||||||
|
toUpdateView = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (myMouseSingleButton == -1)
|
else if (myMouseSingleButton == -1)
|
||||||
{
|
{
|
||||||
@@ -769,6 +786,7 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
|
|||||||
myMouseClickTimer.Stop();
|
myMouseClickTimer.Stop();
|
||||||
myMouseClickCounter = 0;
|
myMouseClickCounter = 0;
|
||||||
myMouseSingleButton = -1;
|
myMouseSingleButton = -1;
|
||||||
|
myMouseStopDragOnUnclick = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,6 +51,9 @@ public:
|
|||||||
//! Empty constructor.
|
//! Empty constructor.
|
||||||
Standard_EXPORT AIS_ViewController();
|
Standard_EXPORT AIS_ViewController();
|
||||||
|
|
||||||
|
//! Destructor.
|
||||||
|
Standard_EXPORT virtual ~AIS_ViewController();
|
||||||
|
|
||||||
//! Return input buffer.
|
//! Return input buffer.
|
||||||
const AIS_ViewInputBuffer& InputBuffer (AIS_ViewInputBufferType theType) const { return theType == AIS_ViewInputBufferType_UI ? myUI : myGL; }
|
const AIS_ViewInputBuffer& InputBuffer (AIS_ViewInputBufferType theType) const { return theType == AIS_ViewInputBufferType_UI ? myUI : myGL; }
|
||||||
|
|
||||||
@@ -647,6 +650,7 @@ protected: //! @name mouse input variables
|
|||||||
Aspect_VKeyMouse myMousePressed; //!< active mouse buttons
|
Aspect_VKeyMouse myMousePressed; //!< active mouse buttons
|
||||||
Aspect_VKeyFlags myMouseModifiers; //!< active key modifiers passed with last mouse event
|
Aspect_VKeyFlags myMouseModifiers; //!< active key modifiers passed with last mouse event
|
||||||
Standard_Integer myMouseSingleButton; //!< index of mouse button pressed alone (>0)
|
Standard_Integer myMouseSingleButton; //!< index of mouse button pressed alone (>0)
|
||||||
|
Standard_Boolean myMouseStopDragOnUnclick; //!< queue stop dragging even with at next mouse unclick
|
||||||
|
|
||||||
protected: //! @name multi-touch input variables
|
protected: //! @name multi-touch input variables
|
||||||
|
|
||||||
|
@@ -137,6 +137,9 @@ AIS_ViewCube::AIS_ViewCube()
|
|||||||
myBoxEdgeGap (0.0),
|
myBoxEdgeGap (0.0),
|
||||||
myBoxFacetExtension (1.0),
|
myBoxFacetExtension (1.0),
|
||||||
myAxesPadding (1.0),
|
myAxesPadding (1.0),
|
||||||
|
myAxesRadius (1.0),
|
||||||
|
myAxesConeRadius (3.0),
|
||||||
|
myAxesSphereRadius (4.0),
|
||||||
myCornerMinSize (2.0),
|
myCornerMinSize (2.0),
|
||||||
myRoundRadius (0.0),
|
myRoundRadius (0.0),
|
||||||
myToDisplayAxes (true),
|
myToDisplayAxes (true),
|
||||||
@@ -599,7 +602,7 @@ void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
|||||||
anAxisGroup->SetGroupPrimitivesAspect (aDatumAspect->ShadingAspect (aPart)->Aspect());
|
anAxisGroup->SetGroupPrimitivesAspect (aDatumAspect->ShadingAspect (aPart)->Aspect());
|
||||||
|
|
||||||
const Standard_Real anArrowLength = 0.2 * anAxisSize;
|
const Standard_Real anArrowLength = 0.2 * anAxisSize;
|
||||||
Handle(Graphic3d_ArrayOfTriangles) aTriangleArray = Prs3d_Arrow::DrawShaded (anAx1, 1.0, anAxisSize, 3.0, anArrowLength, THE_NB_ARROW_FACETTES);
|
Handle(Graphic3d_ArrayOfTriangles) aTriangleArray = Prs3d_Arrow::DrawShaded (anAx1, myAxesRadius, anAxisSize, myAxesConeRadius, anArrowLength, THE_NB_ARROW_FACETTES);
|
||||||
anAxisGroup->AddPrimitiveArray (aTriangleArray);
|
anAxisGroup->AddPrimitiveArray (aTriangleArray);
|
||||||
|
|
||||||
TCollection_AsciiString anAxisLabel;
|
TCollection_AsciiString anAxisLabel;
|
||||||
@@ -621,7 +624,7 @@ void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
|||||||
Handle(Prs3d_ShadingAspect) anAspectCen = new Prs3d_ShadingAspect();
|
Handle(Prs3d_ShadingAspect) anAspectCen = new Prs3d_ShadingAspect();
|
||||||
anAspectCen->SetColor (Quantity_NOC_WHITE);
|
anAspectCen->SetColor (Quantity_NOC_WHITE);
|
||||||
aGroup->SetGroupPrimitivesAspect (anAspectCen->Aspect());
|
aGroup->SetGroupPrimitivesAspect (anAspectCen->Aspect());
|
||||||
Prs3d_ToolSphere aTool (4.0, THE_NB_DISK_SLICES, THE_NB_DISK_SLICES);
|
Prs3d_ToolSphere aTool (myAxesSphereRadius, THE_NB_DISK_SLICES, THE_NB_DISK_SLICES);
|
||||||
gp_Trsf aTrsf;
|
gp_Trsf aTrsf;
|
||||||
aTrsf.SetTranslation (gp_Vec (gp::Origin(), aLocation));
|
aTrsf.SetTranslation (gp_Vec (gp::Origin(), aLocation));
|
||||||
Handle(Graphic3d_ArrayOfTriangles) aCenterArray;
|
Handle(Graphic3d_ArrayOfTriangles) aCenterArray;
|
||||||
|
@@ -189,6 +189,45 @@ public: //! @name Geometry management API
|
|||||||
//! The value should be within [0, 0.5] range.
|
//! The value should be within [0, 0.5] range.
|
||||||
Standard_EXPORT void SetRoundRadius (const Standard_Real theValue);
|
Standard_EXPORT void SetRoundRadius (const Standard_Real theValue);
|
||||||
|
|
||||||
|
//! Returns radius of axes of the trihedron; 1.0 by default.
|
||||||
|
Standard_Real AxesRadius() const { return myAxesRadius; }
|
||||||
|
|
||||||
|
//! Sets radius of axes of the trihedron.
|
||||||
|
void SetAxesRadius (const Standard_Real theRadius)
|
||||||
|
{
|
||||||
|
if (Abs (myAxesRadius - theRadius) > Precision::Confusion())
|
||||||
|
{
|
||||||
|
myAxesRadius = theRadius;
|
||||||
|
SetToUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns radius of cone of axes of the trihedron; 3.0 by default.
|
||||||
|
Standard_Real AxesConeRadius() const { return myAxesConeRadius; }
|
||||||
|
|
||||||
|
//! Sets radius of cone of axes of the trihedron.
|
||||||
|
void SetAxesConeRadius (Standard_Real theRadius)
|
||||||
|
{
|
||||||
|
if (Abs (myAxesConeRadius - theRadius) > Precision::Confusion())
|
||||||
|
{
|
||||||
|
myAxesConeRadius = theRadius;
|
||||||
|
SetToUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns radius of sphere (central point) of the trihedron; 4.0 by default.
|
||||||
|
Standard_Real AxesSphereRadius() const { return myAxesSphereRadius; }
|
||||||
|
|
||||||
|
//! Sets radius of sphere (central point) of the trihedron.
|
||||||
|
void SetAxesSphereRadius (Standard_Real theRadius)
|
||||||
|
{
|
||||||
|
if (Abs (myAxesSphereRadius - theRadius) > Precision::Confusion())
|
||||||
|
{
|
||||||
|
myAxesSphereRadius = theRadius;
|
||||||
|
SetToUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//! @return TRUE if trihedron is drawn; TRUE by default.
|
//! @return TRUE if trihedron is drawn; TRUE by default.
|
||||||
Standard_Boolean ToDrawAxes() const { return myToDisplayAxes; }
|
Standard_Boolean ToDrawAxes() const { return myToDisplayAxes; }
|
||||||
|
|
||||||
@@ -621,6 +660,9 @@ protected:
|
|||||||
Standard_Real myBoxEdgeGap; //!< gap between box side and box edge
|
Standard_Real myBoxEdgeGap; //!< gap between box side and box edge
|
||||||
Standard_Real myBoxFacetExtension; //!< box facet extension
|
Standard_Real myBoxFacetExtension; //!< box facet extension
|
||||||
Standard_Real myAxesPadding; //!< Padding between box and axes
|
Standard_Real myAxesPadding; //!< Padding between box and axes
|
||||||
|
Standard_Real myAxesRadius; //!< radius of axes of the trihedron; 1.0 by default
|
||||||
|
Standard_Real myAxesConeRadius; //!< radius of cone of axes of the trihedron; 3.0 by default
|
||||||
|
Standard_Real myAxesSphereRadius; //!< radius of sphere (central point) of the trihedron; 4.0 by default
|
||||||
Standard_Real myCornerMinSize; //!< minimal size of box corner
|
Standard_Real myCornerMinSize; //!< minimal size of box corner
|
||||||
Standard_Real myRoundRadius; //!< relative round radius within [0; 0.5] range
|
Standard_Real myRoundRadius; //!< relative round radius within [0; 0.5] range
|
||||||
Standard_Boolean myToDisplayAxes; //!< trihedron visibility
|
Standard_Boolean myToDisplayAxes; //!< trihedron visibility
|
||||||
|
@@ -69,14 +69,12 @@ AIS_ExclusionFilter.hxx
|
|||||||
AIS_ExclusionFilter.lxx
|
AIS_ExclusionFilter.lxx
|
||||||
AIS_FixRelation.cxx
|
AIS_FixRelation.cxx
|
||||||
AIS_FixRelation.hxx
|
AIS_FixRelation.hxx
|
||||||
AIS_FixRelation.lxx
|
|
||||||
AIS_GlobalStatus.cxx
|
AIS_GlobalStatus.cxx
|
||||||
AIS_GlobalStatus.hxx
|
AIS_GlobalStatus.hxx
|
||||||
AIS_GraphicTool.cxx
|
AIS_GraphicTool.cxx
|
||||||
AIS_GraphicTool.hxx
|
AIS_GraphicTool.hxx
|
||||||
AIS_IdenticRelation.cxx
|
AIS_IdenticRelation.cxx
|
||||||
AIS_IdenticRelation.hxx
|
AIS_IdenticRelation.hxx
|
||||||
AIS_IdenticRelation.lxx
|
|
||||||
AIS_IndexedDataMapOfOwnerPrs.hxx
|
AIS_IndexedDataMapOfOwnerPrs.hxx
|
||||||
AIS_InteractiveContext.cxx
|
AIS_InteractiveContext.cxx
|
||||||
AIS_InteractiveContext.hxx
|
AIS_InteractiveContext.hxx
|
||||||
|
@@ -530,7 +530,7 @@ gp_Circ2d Adaptor2d_OffsetCurve::Circle() const
|
|||||||
gp_Elips2d Adaptor2d_OffsetCurve::Ellipse() const
|
gp_Elips2d Adaptor2d_OffsetCurve::Ellipse() const
|
||||||
{
|
{
|
||||||
if (myCurve->GetType() == GeomAbs_Ellipse && myOffset == 0.) {
|
if (myCurve->GetType() == GeomAbs_Ellipse && myOffset == 0.) {
|
||||||
return myCurve->Ellipse();;
|
return myCurve->Ellipse();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw Standard_NoSuchObject("Adaptor2d_OffsetCurve:Ellipse");
|
throw Standard_NoSuchObject("Adaptor2d_OffsetCurve:Ellipse");
|
||||||
@@ -656,19 +656,16 @@ static Standard_Integer nbPoints(const Handle(Adaptor2d_HCurve2d)& theCurve)
|
|||||||
|
|
||||||
Standard_Integer nbs = 20;
|
Standard_Integer nbs = 20;
|
||||||
|
|
||||||
if (theCurve->GetType() == GeomAbs_Line)
|
if (theCurve->GetType() == GeomAbs_BezierCurve)
|
||||||
nbs = 2;
|
|
||||||
else if (theCurve->GetType() == GeomAbs_BezierCurve)
|
|
||||||
{
|
{
|
||||||
nbs = 3 + theCurve->NbPoles();
|
nbs = Max(nbs, 3 + theCurve->NbPoles());
|
||||||
}
|
}
|
||||||
else if (theCurve->GetType() == GeomAbs_BSplineCurve) {
|
else if (theCurve->GetType() == GeomAbs_BSplineCurve) {
|
||||||
nbs = theCurve->NbKnots();
|
nbs = Max(nbs, theCurve->NbKnots() * theCurve->Degree());
|
||||||
nbs *= theCurve->Degree();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbs > 200)
|
if (nbs > 300)
|
||||||
nbs = 200;
|
nbs = 300;
|
||||||
return nbs;
|
return nbs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -540,7 +540,7 @@ Standard_Boolean Adaptor3d_TopolTool::IsThePointOn(const gp_Pnt2d& P,
|
|||||||
if (surumin || survmin || surumax || survmax) {
|
if (surumin || survmin || surumax || survmax) {
|
||||||
return(Standard_True);
|
return(Standard_True);
|
||||||
}
|
}
|
||||||
return(Standard_False);;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -933,6 +933,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
|
|||||||
const Standard_Integer theNUmin,
|
const Standard_Integer theNUmin,
|
||||||
const Standard_Integer theNVmin)
|
const Standard_Integer theNVmin)
|
||||||
{
|
{
|
||||||
|
const Standard_Integer aMaxPnts = 1001;
|
||||||
const Handle(Geom_BSplineSurface)& aBS = myS->BSpline();
|
const Handle(Geom_BSplineSurface)& aBS = myS->BSpline();
|
||||||
Standard_Real uinf,usup,vinf,vsup;
|
Standard_Real uinf,usup,vinf,vsup;
|
||||||
uinf = myS->FirstUParameter(); usup = myS->LastUParameter();
|
uinf = myS->FirstUParameter(); usup = myS->LastUParameter();
|
||||||
@@ -999,11 +1000,20 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
|
|||||||
nbsu = theNUmin;
|
nbsu = theNUmin;
|
||||||
bUuniform = Standard_True;
|
bUuniform = Standard_True;
|
||||||
}
|
}
|
||||||
|
else if (nbsu > aMaxPnts)
|
||||||
|
{
|
||||||
|
nbsu = aMaxPnts;
|
||||||
|
bUuniform = Standard_True;
|
||||||
|
}
|
||||||
if(nbsv < theNVmin) {
|
if(nbsv < theNVmin) {
|
||||||
nbsv = theNVmin;
|
nbsv = theNVmin;
|
||||||
bVuniform = Standard_True;
|
bVuniform = Standard_True;
|
||||||
}
|
}
|
||||||
|
else if (nbsv > aMaxPnts)
|
||||||
|
{
|
||||||
|
nbsv = aMaxPnts;
|
||||||
|
bVuniform = Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
TColStd_Array1OfReal anUPars(1, nbsu);
|
TColStd_Array1OfReal anUPars(1, nbsu);
|
||||||
TColStd_Array1OfBoolean anUFlg(1, nbsu);
|
TColStd_Array1OfBoolean anUFlg(1, nbsu);
|
||||||
|
@@ -16,12 +16,8 @@
|
|||||||
#define AdvApp2Var_SysBase_HeaderFile
|
#define AdvApp2Var_SysBase_HeaderFile
|
||||||
|
|
||||||
#include <Standard_Macro.hxx>
|
#include <Standard_Macro.hxx>
|
||||||
|
#include <Standard_TypeDef.hxx>
|
||||||
#include <AdvApp2Var_Data_f2c.hxx>
|
#include <AdvApp2Var_Data_f2c.hxx>
|
||||||
#if _MSC_VER
|
|
||||||
#include <stddef.h>
|
|
||||||
#else
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class AdvApp2Var_SysBase {
|
class AdvApp2Var_SysBase {
|
||||||
public:
|
public:
|
||||||
|
@@ -374,7 +374,7 @@ void AppBlend_AppSurf::InternalPerform(const Handle(TheLine)& Lin,
|
|||||||
Standard_Real Uf = F.Parameter(Lin->Point(1));
|
Standard_Real Uf = F.Parameter(Lin->Point(1));
|
||||||
Standard_Real Ul = F.Parameter(Lin->Point(NbPoint))-Uf;
|
Standard_Real Ul = F.Parameter(Lin->Point(NbPoint))-Uf;
|
||||||
for (i=2; i<NbPoint; i++) {
|
for (i=2; i<NbPoint; i++) {
|
||||||
theParams(i) = (F.Parameter(Lin->Point(i))-Uf)/Ul;;
|
theParams(i) = (F.Parameter(Lin->Point(i))-Uf)/Ul;
|
||||||
}
|
}
|
||||||
AppDef_Compute theAppDef(theParams,dmin,dmax,tol3d,tol2d,nbit,
|
AppDef_Compute theAppDef(theParams,dmin,dmax,tol3d,tol2d,nbit,
|
||||||
Standard_True, Standard_True);
|
Standard_True, Standard_True);
|
||||||
@@ -426,7 +426,7 @@ void AppBlend_AppSurf::InternalPerform(const Handle(TheLine)& Lin,
|
|||||||
Standard_Real Uf = F.Parameter(Lin->Point(1));
|
Standard_Real Uf = F.Parameter(Lin->Point(1));
|
||||||
Standard_Real Ul = F.Parameter(Lin->Point(NbPoint))-Uf;
|
Standard_Real Ul = F.Parameter(Lin->Point(NbPoint))-Uf;
|
||||||
for (i=2; i<NbPoint; i++) {
|
for (i=2; i<NbPoint; i++) {
|
||||||
theParams(i) = (F.Parameter(Lin->Point(i))-Uf)/Ul;;
|
theParams(i) = (F.Parameter(Lin->Point(i))-Uf)/Ul;
|
||||||
}
|
}
|
||||||
|
|
||||||
theapprox.Init(dmin,dmax,tol3d,tol2d,nbit,Standard_True,
|
theapprox.Init(dmin,dmax,tol3d,tol2d,nbit,Standard_True,
|
||||||
|
@@ -452,7 +452,7 @@ AppCont_LeastSquare::AppCont_LeastSquare(const AppCont_Function& SSP,
|
|||||||
myDone = Standard_True;
|
myDone = Standard_True;
|
||||||
for (i = bdeb; i <= bfin; i++) {
|
for (i = bdeb; i <= bfin; i++) {
|
||||||
for (j = bdeb; j <= bfin; j++) {
|
for (j = bdeb; j <= bfin; j++) {
|
||||||
IBPij = IBP(i, j);;
|
IBPij = IBP(i, j);
|
||||||
for (k = 1; k<= nbcol; k++) {
|
for (k = 1; k<= nbcol; k++) {
|
||||||
myPoles(i, k) += IBPij * B2(j, k);
|
myPoles(i, k) += IBPij * B2(j, k);
|
||||||
}
|
}
|
||||||
|
@@ -65,7 +65,7 @@ void AppParCurves::Bernstein(const Standard_Integer NbPoles,
|
|||||||
math_Matrix& DA) {
|
math_Matrix& DA) {
|
||||||
|
|
||||||
Standard_Integer i, j, id, Ndeg = NbPoles-1;
|
Standard_Integer i, j, id, Ndeg = NbPoles-1;
|
||||||
Standard_Real u0, u1, y0, y1, xs, bj, bj1;;
|
Standard_Real u0, u1, y0, y1, xs, bj, bj1;
|
||||||
Standard_Integer first = U.Lower(), last = U.Upper();
|
Standard_Integer first = U.Lower(), last = U.Upper();
|
||||||
math_Vector B(1, NbPoles-1);
|
math_Vector B(1, NbPoles-1);
|
||||||
|
|
||||||
|
@@ -1272,7 +1272,7 @@ const AppParCurves_MultiBSpCurve& AppParCurves_LeastSquare::BSplineValue()
|
|||||||
{
|
{
|
||||||
if (!done) {throw StdFail_NotDone();}
|
if (!done) {throw StdFail_NotDone();}
|
||||||
|
|
||||||
Standard_Integer i, j, j2, npoints = nbP+nbP2d;;
|
Standard_Integer i, j, j2, npoints = nbP+nbP2d;
|
||||||
gp_Pnt Pt;
|
gp_Pnt Pt;
|
||||||
gp_Pnt2d Pt2d;
|
gp_Pnt2d Pt2d;
|
||||||
Standard_Integer ideb = resinit, ifin = resfin;
|
Standard_Integer ideb = resinit, ifin = resfin;
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
//AGV 15/10/01 : Add XmlOcaf support; add MessageDriver support
|
//AGV 15/10/01 : Add XmlOcaf support; add MessageDriver support
|
||||||
|
|
||||||
#include <AppStd_Application.hxx>
|
#include <AppStd_Application.hxx>
|
||||||
|
#include <Standard_Dump.hxx>
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(AppStd_Application,TDocStd_Application)
|
IMPLEMENT_STANDARD_RTTIEXT(AppStd_Application,TDocStd_Application)
|
||||||
|
|
||||||
@@ -29,3 +30,13 @@ Standard_CString AppStd_Application::ResourcesName() {
|
|||||||
return aRes;
|
return aRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : DumpJson
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AppStd_Application::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||||
|
{
|
||||||
|
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||||
|
|
||||||
|
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDocStd_Application)
|
||||||
|
}
|
||||||
|
@@ -35,6 +35,9 @@ public:
|
|||||||
//! resources
|
//! resources
|
||||||
Standard_EXPORT Standard_CString ResourcesName() Standard_OVERRIDE;
|
Standard_EXPORT Standard_CString ResourcesName() Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Dumps the content of me into the stream
|
||||||
|
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(AppStd_Application,TDocStd_Application)
|
DEFINE_STANDARD_RTTIEXT(AppStd_Application,TDocStd_Application)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
//AGV 15/10/01 : Add XmlOcaf support; add MessageDriver support
|
//AGV 15/10/01 : Add XmlOcaf support; add MessageDriver support
|
||||||
|
|
||||||
#include <AppStdL_Application.hxx>
|
#include <AppStdL_Application.hxx>
|
||||||
|
#include <Standard_Dump.hxx>
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(AppStdL_Application,TDocStd_Application)
|
IMPLEMENT_STANDARD_RTTIEXT(AppStdL_Application,TDocStd_Application)
|
||||||
|
|
||||||
@@ -30,3 +31,13 @@ Standard_CString AppStdL_Application::ResourcesName()
|
|||||||
return aRes;
|
return aRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : DumpJson
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AppStdL_Application::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
|
||||||
|
{
|
||||||
|
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||||
|
|
||||||
|
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDocStd_Application)
|
||||||
|
}
|
||||||
|
@@ -34,6 +34,9 @@ public:
|
|||||||
//! resources
|
//! resources
|
||||||
Standard_EXPORT Standard_CString ResourcesName() Standard_OVERRIDE;
|
Standard_EXPORT Standard_CString ResourcesName() Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Dumps the content of me into the stream
|
||||||
|
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(AppStdL_Application,TDocStd_Application)
|
DEFINE_STANDARD_RTTIEXT(AppStdL_Application,TDocStd_Application)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -27,8 +27,11 @@
|
|||||||
#include <Geom2d_BSplineCurve.hxx>
|
#include <Geom2d_BSplineCurve.hxx>
|
||||||
#include <Geom2dAdaptor_HCurve.hxx>
|
#include <Geom2dAdaptor_HCurve.hxx>
|
||||||
#include <Geom_BSplineCurve.hxx>
|
#include <Geom_BSplineCurve.hxx>
|
||||||
|
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||||
|
#include <Geom_TrimmedCurve.hxx>
|
||||||
#include <GeomAdaptor_HCurve.hxx>
|
#include <GeomAdaptor_HCurve.hxx>
|
||||||
#include <GeomAdaptor_HSurface.hxx>
|
#include <GeomAdaptor_HSurface.hxx>
|
||||||
|
#include <GeomConvert.hxx>
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
#include <gp_Vec.hxx>
|
#include <gp_Vec.hxx>
|
||||||
#include <Precision.hxx>
|
#include <Precision.hxx>
|
||||||
@@ -300,6 +303,10 @@ void Approx_CurveOnSurface_Eval2d::Evaluate (Standard_Integer *Dimension,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//function : Approx_CurveOnSurface
|
||||||
|
//purpose : Constructor
|
||||||
|
//=============================================================================
|
||||||
Approx_CurveOnSurface::Approx_CurveOnSurface(const Handle(Adaptor2d_HCurve2d)& C2D,
|
Approx_CurveOnSurface::Approx_CurveOnSurface(const Handle(Adaptor2d_HCurve2d)& C2D,
|
||||||
const Handle(Adaptor3d_HSurface)& Surf,
|
const Handle(Adaptor3d_HSurface)& Surf,
|
||||||
const Standard_Real First,
|
const Standard_Real First,
|
||||||
@@ -310,14 +317,75 @@ void Approx_CurveOnSurface_Eval2d::Evaluate (Standard_Integer *Dimension,
|
|||||||
const Standard_Integer MaxSegments,
|
const Standard_Integer MaxSegments,
|
||||||
const Standard_Boolean only3d,
|
const Standard_Boolean only3d,
|
||||||
const Standard_Boolean only2d)
|
const Standard_Boolean only2d)
|
||||||
|
: myC2D(C2D),
|
||||||
|
mySurf(Surf),
|
||||||
|
myFirst(First),
|
||||||
|
myLast(Last),
|
||||||
|
myTol(Tol),
|
||||||
|
myIsDone(Standard_False),
|
||||||
|
myHasResult(Standard_False),
|
||||||
|
myError3d(0.0),
|
||||||
|
myError2dU(0.0),
|
||||||
|
myError2dV(0.0)
|
||||||
|
{
|
||||||
|
Perform(MaxSegments, MaxDegree, S, only3d, only2d);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//function : Approx_CurveOnSurface
|
||||||
|
//purpose : Constructor
|
||||||
|
//=============================================================================
|
||||||
|
Approx_CurveOnSurface::Approx_CurveOnSurface(const Handle(Adaptor2d_HCurve2d)& theC2D,
|
||||||
|
const Handle(Adaptor3d_HSurface)& theSurf,
|
||||||
|
const Standard_Real theFirst,
|
||||||
|
const Standard_Real theLast,
|
||||||
|
const Standard_Real theTol)
|
||||||
|
: myC2D(theC2D),
|
||||||
|
mySurf(theSurf),
|
||||||
|
myFirst(theFirst),
|
||||||
|
myLast(theLast),
|
||||||
|
myTol(theTol),
|
||||||
|
myIsDone(Standard_False),
|
||||||
|
myHasResult(Standard_False),
|
||||||
|
myError3d(0.0),
|
||||||
|
myError2dU(0.0),
|
||||||
|
myError2dV(0.0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//function : Perform
|
||||||
|
//purpose :
|
||||||
|
//=============================================================================
|
||||||
|
void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
|
||||||
|
const Standard_Integer theMaxDegree,
|
||||||
|
const GeomAbs_Shape theContinuity,
|
||||||
|
const Standard_Boolean theOnly3d,
|
||||||
|
const Standard_Boolean theOnly2d)
|
||||||
{
|
{
|
||||||
myIsDone = Standard_False;
|
myIsDone = Standard_False;
|
||||||
if(only3d && only2d) throw Standard_ConstructionError();
|
myHasResult = Standard_False;
|
||||||
GeomAbs_Shape Order = S;
|
myError2dU = 0.0;
|
||||||
|
myError2dV = 0.0;
|
||||||
|
myError3d = 0.0;
|
||||||
|
|
||||||
Handle( Adaptor2d_HCurve2d ) TrimmedC2D = C2D->Trim( First, Last, Precision::PConfusion() );
|
if(theOnly3d && theOnly2d) throw Standard_ConstructionError();
|
||||||
|
|
||||||
Adaptor3d_CurveOnSurface COnS( TrimmedC2D, Surf );
|
Handle( Adaptor2d_HCurve2d ) TrimmedC2D = myC2D->Trim( myFirst, myLast, Precision::PConfusion() );
|
||||||
|
|
||||||
|
Standard_Boolean isU, isForward;
|
||||||
|
Standard_Real aParam;
|
||||||
|
if (theOnly3d && isIsoLine(TrimmedC2D, isU, aParam, isForward))
|
||||||
|
{
|
||||||
|
if (buildC3dOnIsoLine(TrimmedC2D, isU, aParam, isForward))
|
||||||
|
{
|
||||||
|
myIsDone = Standard_True;
|
||||||
|
myHasResult = Standard_True;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Adaptor3d_CurveOnSurface COnS( TrimmedC2D, mySurf );
|
||||||
Handle(Adaptor3d_HCurveOnSurface) HCOnS = new Adaptor3d_HCurveOnSurface();
|
Handle(Adaptor3d_HCurveOnSurface) HCOnS = new Adaptor3d_HCurveOnSurface();
|
||||||
HCOnS->Set(COnS);
|
HCOnS->Set(COnS);
|
||||||
|
|
||||||
@@ -327,37 +395,34 @@ void Approx_CurveOnSurface_Eval2d::Evaluate (Standard_Integer *Dimension,
|
|||||||
Handle(TColStd_HArray1OfReal) ThreeDTol;
|
Handle(TColStd_HArray1OfReal) ThreeDTol;
|
||||||
|
|
||||||
// create evaluators and choose appropriate one
|
// create evaluators and choose appropriate one
|
||||||
Approx_CurveOnSurface_Eval3d Eval3dCvOnSurf (HCOnS, First, Last);
|
Approx_CurveOnSurface_Eval3d Eval3dCvOnSurf (HCOnS, myFirst, myLast);
|
||||||
Approx_CurveOnSurface_Eval2d Eval2dCvOnSurf ( TrimmedC2D, First, Last);
|
Approx_CurveOnSurface_Eval2d Eval2dCvOnSurf ( TrimmedC2D, myFirst, myLast);
|
||||||
Approx_CurveOnSurface_Eval EvalCvOnSurf (HCOnS, TrimmedC2D, First, Last);
|
Approx_CurveOnSurface_Eval EvalCvOnSurf (HCOnS, TrimmedC2D, myFirst, myLast);
|
||||||
AdvApprox_EvaluatorFunction* EvalPtr;
|
AdvApprox_EvaluatorFunction* EvalPtr;
|
||||||
if ( only3d ) EvalPtr = &Eval3dCvOnSurf;
|
if ( theOnly3d ) EvalPtr = &Eval3dCvOnSurf;
|
||||||
else if ( only2d ) EvalPtr = &Eval2dCvOnSurf;
|
else if ( theOnly2d ) EvalPtr = &Eval2dCvOnSurf;
|
||||||
else EvalPtr = &EvalCvOnSurf;
|
else EvalPtr = &EvalCvOnSurf;
|
||||||
|
|
||||||
// Initialization for 2d approximation
|
// Initialization for 2d approximation
|
||||||
if(!only3d) {
|
if(!theOnly3d) {
|
||||||
Num1DSS = 2;
|
Num1DSS = 2;
|
||||||
OneDTol = new TColStd_HArray1OfReal(1,Num1DSS);
|
OneDTol = new TColStd_HArray1OfReal(1,Num1DSS);
|
||||||
|
|
||||||
Standard_Real TolU, TolV;
|
Standard_Real TolU, TolV;
|
||||||
|
|
||||||
TolU = Surf->UResolution(Tol)/2;
|
TolU = mySurf->UResolution(myTol)/2;
|
||||||
TolV = Surf->VResolution(Tol)/2;
|
TolV = mySurf->VResolution(myTol)/2;
|
||||||
|
|
||||||
OneDTol->SetValue(1,TolU);
|
OneDTol->SetValue(1,TolU);
|
||||||
OneDTol->SetValue(2,TolV);
|
OneDTol->SetValue(2,TolV);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!only2d) {
|
if(!theOnly2d) {
|
||||||
Num3DSS=1;
|
Num3DSS=1;
|
||||||
ThreeDTol = new TColStd_HArray1OfReal(1,Num3DSS);
|
ThreeDTol = new TColStd_HArray1OfReal(1,Num3DSS);
|
||||||
ThreeDTol->Init(Tol/2);
|
ThreeDTol->Init(myTol/2);
|
||||||
}
|
}
|
||||||
|
|
||||||
myError2dU = 0;
|
|
||||||
myError2dV = 0;
|
|
||||||
myError3d = 0;
|
|
||||||
|
|
||||||
Standard_Integer NbInterv_C2 = HCOnS->NbIntervals(GeomAbs_C2);
|
Standard_Integer NbInterv_C2 = HCOnS->NbIntervals(GeomAbs_C2);
|
||||||
TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
|
TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
|
||||||
@@ -369,8 +434,8 @@ void Approx_CurveOnSurface_Eval2d::Evaluate (Standard_Integer *Dimension,
|
|||||||
AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);
|
AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);
|
||||||
AdvApprox_ApproxAFunction aApprox (Num1DSS, Num2DSS, Num3DSS,
|
AdvApprox_ApproxAFunction aApprox (Num1DSS, Num2DSS, Num3DSS,
|
||||||
OneDTol, TwoDTolNul, ThreeDTol,
|
OneDTol, TwoDTolNul, ThreeDTol,
|
||||||
First, Last, Order,
|
myFirst, myLast, theContinuity,
|
||||||
MaxDegree, MaxSegments,
|
theMaxDegree, theMaxSegments,
|
||||||
*EvalPtr, CutTool);
|
*EvalPtr, CutTool);
|
||||||
|
|
||||||
myIsDone = aApprox.IsDone();
|
myIsDone = aApprox.IsDone();
|
||||||
@@ -381,14 +446,14 @@ void Approx_CurveOnSurface_Eval2d::Evaluate (Standard_Integer *Dimension,
|
|||||||
Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
|
Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
|
||||||
Standard_Integer Degree = aApprox.Degree();
|
Standard_Integer Degree = aApprox.Degree();
|
||||||
|
|
||||||
if(!only2d)
|
if(!theOnly2d)
|
||||||
{
|
{
|
||||||
TColgp_Array1OfPnt Poles(1,aApprox.NbPoles());
|
TColgp_Array1OfPnt Poles(1,aApprox.NbPoles());
|
||||||
aApprox.Poles(1,Poles);
|
aApprox.Poles(1,Poles);
|
||||||
myCurve3d = new Geom_BSplineCurve(Poles, Knots->Array1(), Mults->Array1(), Degree);
|
myCurve3d = new Geom_BSplineCurve(Poles, Knots->Array1(), Mults->Array1(), Degree);
|
||||||
myError3d = aApprox.MaxError(3, 1);
|
myError3d = aApprox.MaxError(3, 1);
|
||||||
}
|
}
|
||||||
if(!only3d)
|
if(!theOnly3d)
|
||||||
{
|
{
|
||||||
TColgp_Array1OfPnt2d Poles2d(1,aApprox.NbPoles());
|
TColgp_Array1OfPnt2d Poles2d(1,aApprox.NbPoles());
|
||||||
TColStd_Array1OfReal Poles1dU(1,aApprox.NbPoles());
|
TColStd_Array1OfReal Poles1dU(1,aApprox.NbPoles());
|
||||||
@@ -404,8 +469,6 @@ void Approx_CurveOnSurface_Eval2d::Evaluate (Standard_Integer *Dimension,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Boolean Approx_CurveOnSurface::IsDone() const
|
Standard_Boolean Approx_CurveOnSurface::IsDone() const
|
||||||
@@ -443,3 +506,215 @@ void Approx_CurveOnSurface_Eval2d::Evaluate (Standard_Integer *Dimension,
|
|||||||
return myError2dV;
|
return myError2dV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//function : isIsoLine
|
||||||
|
//purpose :
|
||||||
|
//=============================================================================
|
||||||
|
Standard_Boolean Approx_CurveOnSurface::isIsoLine(const Handle(Adaptor2d_HCurve2d) theC2D,
|
||||||
|
Standard_Boolean& theIsU,
|
||||||
|
Standard_Real& theParam,
|
||||||
|
Standard_Boolean& theIsForward) const
|
||||||
|
{
|
||||||
|
// These variables are used to check line state (vertical or horizontal).
|
||||||
|
Standard_Boolean isAppropriateType = Standard_False;
|
||||||
|
gp_Pnt2d aLoc2d;
|
||||||
|
gp_Dir2d aDir2d;
|
||||||
|
|
||||||
|
// Test type.
|
||||||
|
const GeomAbs_CurveType aType = theC2D->GetType();
|
||||||
|
if (aType == GeomAbs_Line)
|
||||||
|
{
|
||||||
|
gp_Lin2d aLin2d = theC2D->Line();
|
||||||
|
aLoc2d = aLin2d.Location();
|
||||||
|
aDir2d = aLin2d.Direction();
|
||||||
|
isAppropriateType = Standard_True;
|
||||||
|
}
|
||||||
|
else if (aType == GeomAbs_BSplineCurve)
|
||||||
|
{
|
||||||
|
Handle(Geom2d_BSplineCurve) aBSpline2d = theC2D->BSpline();
|
||||||
|
if (aBSpline2d->Degree() != 1 || aBSpline2d->NbPoles() != 2)
|
||||||
|
return Standard_False; // Not a line or uneven parameterization.
|
||||||
|
|
||||||
|
aLoc2d = aBSpline2d->Pole(1);
|
||||||
|
|
||||||
|
// Vector should be non-degenerated.
|
||||||
|
gp_Vec2d aVec2d(aBSpline2d->Pole(1), aBSpline2d->Pole(2));
|
||||||
|
if (aVec2d.SquareMagnitude() < Precision::Confusion())
|
||||||
|
return Standard_False; // Degenerated spline.
|
||||||
|
aDir2d = aVec2d;
|
||||||
|
|
||||||
|
isAppropriateType = Standard_True;
|
||||||
|
}
|
||||||
|
else if (aType == GeomAbs_BezierCurve)
|
||||||
|
{
|
||||||
|
Handle(Geom2d_BezierCurve) aBezier2d = theC2D->Bezier();
|
||||||
|
if (aBezier2d->Degree() != 1 || aBezier2d->NbPoles() != 2)
|
||||||
|
return Standard_False; // Not a line or uneven parameterization.
|
||||||
|
|
||||||
|
aLoc2d = aBezier2d->Pole(1);
|
||||||
|
|
||||||
|
// Vector should be non-degenerated.
|
||||||
|
gp_Vec2d aVec2d(aBezier2d->Pole(1), aBezier2d->Pole(2));
|
||||||
|
if (aVec2d.SquareMagnitude() < Precision::Confusion())
|
||||||
|
return Standard_False; // Degenerated spline.
|
||||||
|
aDir2d = aVec2d;
|
||||||
|
|
||||||
|
isAppropriateType = Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isAppropriateType)
|
||||||
|
return Standard_False;
|
||||||
|
|
||||||
|
// Check line to be vertical or horizontal.
|
||||||
|
if (aDir2d.IsParallel(gp::DX2d(), Precision::Angular()))
|
||||||
|
{
|
||||||
|
// Horizontal line. V = const.
|
||||||
|
theIsU = Standard_False;
|
||||||
|
theParam = aLoc2d.Y();
|
||||||
|
theIsForward = aDir2d.Dot(gp::DX2d()) > 0.0;
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
else if (aDir2d.IsParallel(gp::DY2d(), Precision::Angular()))
|
||||||
|
{
|
||||||
|
// Vertical line. U = const.
|
||||||
|
theIsU = Standard_True;
|
||||||
|
theParam = aLoc2d.X();
|
||||||
|
theIsForward = aDir2d.Dot(gp::DY2d()) > 0.0;
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <GeomLib.hxx>
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//function : buildC3dOnIsoLine
|
||||||
|
//purpose :
|
||||||
|
//=============================================================================
|
||||||
|
Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d_HCurve2d) theC2D,
|
||||||
|
const Standard_Boolean theIsU,
|
||||||
|
const Standard_Real theParam,
|
||||||
|
const Standard_Boolean theIsForward)
|
||||||
|
{
|
||||||
|
// Convert adapter to the appropriate type.
|
||||||
|
Handle(GeomAdaptor_HSurface) aGeomAdapter = Handle(GeomAdaptor_HSurface)::DownCast(mySurf);
|
||||||
|
if (aGeomAdapter.IsNull())
|
||||||
|
return Standard_False;
|
||||||
|
|
||||||
|
if (mySurf->GetType() == GeomAbs_Sphere)
|
||||||
|
return Standard_False;
|
||||||
|
|
||||||
|
// Extract isoline
|
||||||
|
Handle(Geom_Surface) aSurf = aGeomAdapter->ChangeSurface().Surface();
|
||||||
|
Handle(Geom_Curve) aC3d;
|
||||||
|
|
||||||
|
gp_Pnt2d aF2d = theC2D->Value(theC2D->FirstParameter());
|
||||||
|
gp_Pnt2d aL2d = theC2D->Value(theC2D->LastParameter());
|
||||||
|
|
||||||
|
Standard_Boolean isToTrim = Standard_True;
|
||||||
|
Standard_Real U1, U2, V1, V2;
|
||||||
|
aSurf->Bounds(U1, U2, V1, V2);
|
||||||
|
|
||||||
|
if (theIsU)
|
||||||
|
{
|
||||||
|
Standard_Real aV1Param = Min(aF2d.Y(), aL2d.Y());
|
||||||
|
Standard_Real aV2Param = Max(aF2d.Y(), aL2d.Y());
|
||||||
|
if (aV2Param < V1 - myTol || aV1Param > V2 + myTol)
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
else if (Precision::IsInfinite(V1) || Precision::IsInfinite(V2))
|
||||||
|
{
|
||||||
|
if (Abs(aV2Param - aV1Param) < Precision::PConfusion())
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
aSurf = new Geom_RectangularTrimmedSurface(aSurf, U1, U2, aV1Param, aV2Param);
|
||||||
|
isToTrim = Standard_False;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aV1Param = Max(aV1Param, V1);
|
||||||
|
aV2Param = Min(aV2Param, V2);
|
||||||
|
if (Abs(aV2Param - aV1Param) < Precision::PConfusion())
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aC3d = aSurf->UIso(theParam);
|
||||||
|
if (isToTrim)
|
||||||
|
aC3d = new Geom_TrimmedCurve(aC3d, aV1Param, aV2Param);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Standard_Real aU1Param = Min(aF2d.X(), aL2d.X());
|
||||||
|
Standard_Real aU2Param = Max(aF2d.X(), aL2d.X());
|
||||||
|
if (aU2Param < U1 - myTol || aU1Param > U2 + myTol)
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
else if (Precision::IsInfinite(U1) || Precision::IsInfinite(U2))
|
||||||
|
{
|
||||||
|
if (Abs(aU2Param - aU1Param) < Precision::PConfusion())
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
aSurf = new Geom_RectangularTrimmedSurface(aSurf, aU1Param, aU2Param, V1, V2);
|
||||||
|
isToTrim = Standard_False;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aU1Param = Max(aU1Param, U1);
|
||||||
|
aU2Param = Min(aU2Param, U2);
|
||||||
|
if (Abs(aU2Param - aU1Param) < Precision::PConfusion())
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aC3d = aSurf->VIso(theParam);
|
||||||
|
if (isToTrim)
|
||||||
|
aC3d = new Geom_TrimmedCurve(aC3d, aU1Param, aU2Param);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert arbitrary curve type to the b-spline.
|
||||||
|
myCurve3d = GeomConvert::CurveToBSplineCurve(aC3d, Convert_QuasiAngular);
|
||||||
|
if (!theIsForward)
|
||||||
|
myCurve3d->Reverse();
|
||||||
|
|
||||||
|
// Rebuild parameterization for the 3d curve to have the same parameterization with
|
||||||
|
// a two-dimensional curve.
|
||||||
|
TColStd_Array1OfReal aKnots = myCurve3d->Knots();
|
||||||
|
BSplCLib::Reparametrize(theC2D->FirstParameter(), theC2D->LastParameter(), aKnots);
|
||||||
|
myCurve3d->SetKnots(aKnots);
|
||||||
|
|
||||||
|
// Evaluate error.
|
||||||
|
myError3d = 0.0;
|
||||||
|
|
||||||
|
const Standard_Real aParF = myFirst;
|
||||||
|
const Standard_Real aParL = myLast;
|
||||||
|
const Standard_Integer aNbPnt = 23;
|
||||||
|
for(Standard_Integer anIdx = 0; anIdx <= aNbPnt; ++anIdx)
|
||||||
|
{
|
||||||
|
const Standard_Real aPar = aParF + ((aParL - aParF) * anIdx) / aNbPnt;
|
||||||
|
|
||||||
|
const gp_Pnt2d aPnt2d = theC2D->Value(aPar);
|
||||||
|
|
||||||
|
const gp_Pnt aPntC3D = myCurve3d->Value(aPar);
|
||||||
|
const gp_Pnt aPntC2D = mySurf->Value(aPnt2d.X(), aPnt2d.Y());
|
||||||
|
|
||||||
|
const Standard_Real aSqDeviation = aPntC3D.SquareDistance(aPntC2D);
|
||||||
|
myError3d = Max(aSqDeviation, myError3d);
|
||||||
|
}
|
||||||
|
|
||||||
|
myError3d = Sqrt(myError3d);
|
||||||
|
|
||||||
|
// Target tolerance is not obtained. This situation happens for isolines on the sphere.
|
||||||
|
// OCCT is unable to convert it keeping original parameterization, while the geometric
|
||||||
|
// form of the result is entirely identical. In that case, it is better to utilize
|
||||||
|
// a general-purpose approach.
|
||||||
|
if (myError3d > myTol)
|
||||||
|
return Standard_False;
|
||||||
|
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
@@ -40,9 +40,22 @@ public:
|
|||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
DEFINE_STANDARD_ALLOC
|
||||||
|
|
||||||
|
//! This constructor calls perform method. This constructor is deprecated.
|
||||||
|
Standard_DEPRECATED("This constructor is deprecated. Use other constructor and perform method instead.")
|
||||||
Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_HCurve2d)& C2D, const Handle(Adaptor3d_HSurface)& Surf, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol, const GeomAbs_Shape Continuity, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments, const Standard_Boolean Only3d = Standard_False, const Standard_Boolean Only2d = Standard_False);
|
Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_HCurve2d)& C2D, const Handle(Adaptor3d_HSurface)& Surf, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol, const GeomAbs_Shape Continuity, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments, const Standard_Boolean Only3d = Standard_False, const Standard_Boolean Only2d = Standard_False);
|
||||||
|
|
||||||
|
//! This constructor does not call perform method.
|
||||||
|
//! @param theC2D 2D Curve to be approximated in 3D.
|
||||||
|
//! @param theSurf Surface where 2D curve is located.
|
||||||
|
//! @param theFirst First parameter of resulting curve.
|
||||||
|
//! @param theFirst Last parameter of resulting curve.
|
||||||
|
//! @param theTol Computation tolerance.
|
||||||
|
Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_HCurve2d)& theC2D,
|
||||||
|
const Handle(Adaptor3d_HSurface)& theSurf,
|
||||||
|
const Standard_Real theFirst,
|
||||||
|
const Standard_Real theLast,
|
||||||
|
const Standard_Real theTol);
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean HasResult() const;
|
Standard_EXPORT Standard_Boolean HasResult() const;
|
||||||
@@ -59,18 +72,64 @@ public:
|
|||||||
//! 2d Curve
|
//! 2d Curve
|
||||||
Standard_EXPORT Standard_Real MaxError2dV() const;
|
Standard_EXPORT Standard_Real MaxError2dV() const;
|
||||||
|
|
||||||
|
//! Constructs the 3d curve. Input parameters are ignored when the input curve is
|
||||||
|
//! U-isoline or V-isoline.
|
||||||
|
//! @param theMaxSegments Maximal number of segments in the resulting spline.
|
||||||
|
//! @param theMaxDegree Maximal degree of the result.
|
||||||
|
//! @param theContinuity Resulting continuity.
|
||||||
|
//! @param theOnly3d Determines building only 3D curve.
|
||||||
|
//! @param theOnly2d Determines building only 2D curve.
|
||||||
|
Standard_EXPORT void Perform(const Standard_Integer theMaxSegments,
|
||||||
|
const Standard_Integer theMaxDegree,
|
||||||
|
const GeomAbs_Shape theContinuity,
|
||||||
|
const Standard_Boolean theOnly3d = Standard_False,
|
||||||
|
const Standard_Boolean theOnly2d = Standard_False);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
//! Checks whether the 2d curve is a isoline. It can be represented by b-spline, bezier,
|
||||||
|
//! or geometric line. This line should have natural parameterization.
|
||||||
|
//! @param theC2D Trimmed curve to be checked.
|
||||||
|
//! @param theIsU Flag indicating that line is u const.
|
||||||
|
//! @param theParam Line parameter.
|
||||||
|
//! @param theIsForward Flag indicating forward parameterization on a isoline.
|
||||||
|
//! @return Standard_True when 2d curve is a line and Standard_False otherwise.
|
||||||
|
Standard_Boolean isIsoLine(const Handle(Adaptor2d_HCurve2d) theC2D,
|
||||||
|
Standard_Boolean& theIsU,
|
||||||
|
Standard_Real& theParam,
|
||||||
|
Standard_Boolean& theIsForward) const;
|
||||||
|
|
||||||
|
//! Builds 3D curve for a isoline. This method takes corresponding isoline from
|
||||||
|
//! the input surface.
|
||||||
|
//! @param theC2D Trimmed curve to be approximated.
|
||||||
|
//! @param theIsU Flag indicating that line is u const.
|
||||||
|
//! @param theParam Line parameter.
|
||||||
|
//! @param theIsForward Flag indicating forward parameterization on a isoline.
|
||||||
|
//! @return Standard_True when 3d curve is built and Standard_False otherwise.
|
||||||
|
Standard_Boolean buildC3dOnIsoLine(const Handle(Adaptor2d_HCurve2d) theC2D,
|
||||||
|
const Standard_Boolean theIsU,
|
||||||
|
const Standard_Real theParam,
|
||||||
|
const Standard_Boolean theIsForward);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Approx_CurveOnSurface& operator= (const Approx_CurveOnSurface&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
//! Input curve.
|
||||||
|
const Handle(Adaptor2d_HCurve2d) myC2D;
|
||||||
|
|
||||||
|
//! Input surface.
|
||||||
|
const Handle(Adaptor3d_HSurface) mySurf;
|
||||||
|
|
||||||
|
//! First parameter of the result.
|
||||||
|
const Standard_Real myFirst;
|
||||||
|
|
||||||
|
//! Last parameter of the result.
|
||||||
|
const Standard_Real myLast;
|
||||||
|
|
||||||
|
//! Tolerance.
|
||||||
|
Standard_Real myTol;
|
||||||
|
|
||||||
Handle(Geom2d_BSplineCurve) myCurve2d;
|
Handle(Geom2d_BSplineCurve) myCurve2d;
|
||||||
Handle(Geom_BSplineCurve) myCurve3d;
|
Handle(Geom_BSplineCurve) myCurve3d;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -20,21 +20,17 @@
|
|||||||
#include <Standard.hxx>
|
#include <Standard.hxx>
|
||||||
#include <Standard_DefineAlloc.hxx>
|
#include <Standard_DefineAlloc.hxx>
|
||||||
#include <Standard_Handle.hxx>
|
#include <Standard_Handle.hxx>
|
||||||
|
#include <Adaptor3d_CurveOnSurface.hxx>
|
||||||
#include <Standard_Boolean.hxx>
|
#include <Standard_Boolean.hxx>
|
||||||
#include <Standard_Real.hxx>
|
#include <Standard_Real.hxx>
|
||||||
class Geom2d_BSplineCurve;
|
|
||||||
class Adaptor2d_HCurve2d;
|
class Adaptor2d_HCurve2d;
|
||||||
class Adaptor3d_HCurve;
|
class Adaptor3d_HCurve;
|
||||||
class Adaptor3d_HSurface;
|
class Adaptor3d_HSurface;
|
||||||
class Standard_OutOfRange;
|
|
||||||
class Standard_ConstructionError;
|
|
||||||
class Geom_Curve;
|
class Geom_Curve;
|
||||||
class Geom2d_Curve;
|
class Geom2d_Curve;
|
||||||
class Geom_Surface;
|
class Geom_Surface;
|
||||||
|
|
||||||
|
//! Approximation of a PCurve on a surface to make its
|
||||||
//! Approximation of a PCurve on a surface to make its
|
|
||||||
//! parameter be the same that the parameter of a given 3d
|
//! parameter be the same that the parameter of a given 3d
|
||||||
//! reference curve.
|
//! reference curve.
|
||||||
class Approx_SameParameter
|
class Approx_SameParameter
|
||||||
@@ -43,63 +39,149 @@ public:
|
|||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
DEFINE_STANDARD_ALLOC
|
||||||
|
|
||||||
|
//! Warning: the C3D and C2D must have the same parametric domain.
|
||||||
|
Standard_EXPORT Approx_SameParameter(const Handle(Geom_Curve)& C3D,
|
||||||
|
const Handle(Geom2d_Curve)& C2D,
|
||||||
|
const Handle(Geom_Surface)& S,
|
||||||
|
const Standard_Real Tol);
|
||||||
|
|
||||||
//! Warning: the C3D and C2D must have the same parametric domain.
|
//! Warning: the C3D and C2D must have the same parametric domain.
|
||||||
Standard_EXPORT Approx_SameParameter(const Handle(Geom_Curve)& C3D, const Handle(Geom2d_Curve)& C2D, const Handle(Geom_Surface)& S, const Standard_Real Tol);
|
Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_HCurve)& C3D,
|
||||||
|
const Handle(Geom2d_Curve)& C2D,
|
||||||
Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_HCurve)& C3D, const Handle(Geom2d_Curve)& C2D, const Handle(Adaptor3d_HSurface)& S, const Standard_Real Tol);
|
const Handle(Adaptor3d_HSurface)& S,
|
||||||
|
const Standard_Real Tol);
|
||||||
|
|
||||||
//! Warning: the C3D and C2D must have the same parametric domain.
|
//! Warning: the C3D and C2D must have the same parametric domain.
|
||||||
Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_HCurve)& C3D, const Handle(Adaptor2d_HCurve2d)& C2D, const Handle(Adaptor3d_HSurface)& S, const Standard_Real Tol);
|
Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_HCurve)& C3D,
|
||||||
|
const Handle(Adaptor2d_HCurve2d)& C2D,
|
||||||
Standard_Boolean IsDone() const;
|
const Handle(Adaptor3d_HSurface)& S,
|
||||||
|
const Standard_Real Tol);
|
||||||
Standard_Real TolReached() const;
|
|
||||||
|
//!@Returns .false. if calculations failed,
|
||||||
//! Tells whether the original data had already the same
|
//! .true. if calculations succeed
|
||||||
//! parameter up to the tolerance : in that case nothing
|
Standard_Boolean IsDone() const
|
||||||
|
{
|
||||||
|
return myDone;
|
||||||
|
}
|
||||||
|
|
||||||
|
//!@Returns tolerance (maximal distance) between 3d curve
|
||||||
|
//! and curve on surface, generated by 2d curve and surface.
|
||||||
|
Standard_Real TolReached() const
|
||||||
|
{
|
||||||
|
return myTolReached;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Tells whether the original data had already the same
|
||||||
|
//! parameter up to the tolerance : in that case nothing
|
||||||
//! is done.
|
//! is done.
|
||||||
Standard_Boolean IsSameParameter() const;
|
Standard_Boolean IsSameParameter() const
|
||||||
|
{
|
||||||
//! Returns the 2D curve that has the same parameter as
|
return mySameParameter;
|
||||||
//! the 3D curve once evaluated on the surface up to the
|
}
|
||||||
//! specified tolerance
|
|
||||||
Handle(Geom2d_BSplineCurve) Curve2d() const;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//! Returns the 2D curve that has the same parameter as
|
||||||
|
//! the 3D curve once evaluated on the surface up to the
|
||||||
|
//! specified tolerance.
|
||||||
|
Handle(Geom2d_Curve) Curve2d() const
|
||||||
|
{
|
||||||
|
return myCurve2d;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
//! Internal data structure to unify access to the most actively used data.
|
||||||
//! Compute the Pcurve (internal use only).
|
//! This structure is not intended to be class field since
|
||||||
|
//! a lot of memory is used in intermediate computations.
|
||||||
|
struct Approx_SameParameter_Data
|
||||||
|
{
|
||||||
|
Adaptor3d_CurveOnSurface myCOnS; // Curve on surface.
|
||||||
|
Standard_Integer myNbPnt; // Number of points.
|
||||||
|
Standard_Real *myPC3d; // Parameters on 3d curve.
|
||||||
|
Standard_Real *myPC2d; // Parameters on 2d curve.
|
||||||
|
|
||||||
|
// Second data arrays. Used in loop over poles.
|
||||||
|
Standard_Real *myNewPC3d; // Parameters on 3d curve.
|
||||||
|
Standard_Real *myNewPC2d; // Parameters on 2d curve.
|
||||||
|
|
||||||
|
// Parameters ranges.
|
||||||
|
Standard_Real myC3dPF; // Curve 3d Parameter First.
|
||||||
|
Standard_Real myC3dPL; // Curve 3d Parameter Last.
|
||||||
|
Standard_Real myC2dPF; // Curve 2d Parameter First.
|
||||||
|
Standard_Real myC2dPL; // Curve 2d Parameter Last.
|
||||||
|
|
||||||
|
Standard_Real myTol; // Working tolerance.
|
||||||
|
|
||||||
|
// Swap data arrays and update number of points.
|
||||||
|
void Swap(const Standard_Integer theNewNbPoints)
|
||||||
|
{
|
||||||
|
myNbPnt = theNewNbPoints;
|
||||||
|
Standard_Real * temp;
|
||||||
|
|
||||||
|
// 3-D
|
||||||
|
temp = myPC3d;
|
||||||
|
myPC3d = myNewPC3d;
|
||||||
|
myNewPC3d = temp;
|
||||||
|
|
||||||
|
// 2-D
|
||||||
|
temp = myPC2d;
|
||||||
|
myPC2d = myNewPC2d;
|
||||||
|
myNewPC2d = temp;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Approx_SameParameter(const Approx_SameParameter &);
|
||||||
|
Approx_SameParameter& operator=(const Approx_SameParameter &);
|
||||||
|
|
||||||
|
//! Computes the pcurve (internal use only).
|
||||||
Standard_EXPORT void Build (const Standard_Real Tol);
|
Standard_EXPORT void Build (const Standard_Real Tol);
|
||||||
|
|
||||||
|
//! Computes initial point distribution.
|
||||||
|
Standard_Boolean BuildInitialDistribution(Approx_SameParameter_Data &theData) const;
|
||||||
|
|
||||||
|
//! Increases initial number of samples in case of the C0 continuity.
|
||||||
|
//! Return new number of points and corresponding data arrays.
|
||||||
|
//@return true if new number of samples is good and false otherwise.
|
||||||
|
Standard_Boolean IncreaseInitialNbSamples(Approx_SameParameter_Data &theData) const;
|
||||||
|
|
||||||
|
//! Computes tangents on boundary points.
|
||||||
|
//@return true if tangents are not null and false otherwise.
|
||||||
|
Standard_Boolean ComputeTangents(const Adaptor3d_CurveOnSurface & theCOnS,
|
||||||
|
Standard_Real &theFirstTangent,
|
||||||
|
Standard_Real &theLastTangent) const;
|
||||||
|
|
||||||
|
//! Method to check same parameter state
|
||||||
|
//! and build dependency between 2d and 3d curves.
|
||||||
|
//@return true if 2d and 3d curves have same parameter state and false otherwise.
|
||||||
|
Standard_Boolean CheckSameParameter(Approx_SameParameter_Data &theData,
|
||||||
|
Standard_Real &theSqDist) const;
|
||||||
|
|
||||||
|
//! Computes interpolated values.
|
||||||
|
//!@Returns .false. if computations failed;
|
||||||
|
Standard_Boolean Interpolate(const Approx_SameParameter_Data & theData,
|
||||||
|
const Standard_Real aTangFirst,
|
||||||
|
const Standard_Real aTangLast,
|
||||||
|
TColStd_Array1OfReal & thePoles,
|
||||||
|
TColStd_Array1OfReal & theFlatKnots) const;
|
||||||
|
|
||||||
|
//! Increases number of poles in poles loop.
|
||||||
|
//@return true if poles is changed and false otherwise.
|
||||||
|
Standard_Boolean IncreaseNbPoles(const TColStd_Array1OfReal & thePoles,
|
||||||
|
const TColStd_Array1OfReal & theFlatKnots,
|
||||||
|
Approx_SameParameter_Data & theData,
|
||||||
|
Standard_Real &theBestSqTol) const;
|
||||||
|
|
||||||
|
static const Standard_Integer myNbSamples = 22; // To be consistent with "checkshape".
|
||||||
|
static const Standard_Integer myMaxArraySize = 1000;
|
||||||
|
const Standard_Real myDeltaMin; // Initialization is allowed only for integral types.
|
||||||
|
|
||||||
Standard_Boolean mySameParameter;
|
Standard_Boolean mySameParameter;
|
||||||
Standard_Boolean myDone;
|
Standard_Boolean myDone;
|
||||||
Standard_Real myTolReached;
|
Standard_Real myTolReached;
|
||||||
Handle(Geom2d_BSplineCurve) myCurve2d;
|
Handle(Geom2d_Curve) myCurve2d;
|
||||||
Handle(Adaptor2d_HCurve2d) myHCurve2d;
|
Handle(Adaptor2d_HCurve2d) myHCurve2d;
|
||||||
Handle(Adaptor3d_HCurve) myC3d;
|
Handle(Adaptor3d_HCurve) myC3d;
|
||||||
Handle(Adaptor3d_HSurface) mySurf;
|
Handle(Adaptor3d_HSurface) mySurf;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#include <Approx_SameParameter.lxx>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _Approx_SameParameter_HeaderFile
|
#endif // _Approx_SameParameter_HeaderFile
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user