mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
Compare commits
114 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
828a75f228 | ||
|
59515ca600 | ||
|
fa1710b567 | ||
|
9460f8c0b9 | ||
|
a3a3ff3d33 | ||
|
2108d9a25b | ||
|
e8dec5e171 | ||
|
0dab581700 | ||
|
1c728f2d6d | ||
|
6b9b7e3c92 | ||
|
7c08e3ac6e | ||
|
718d07fe5e | ||
|
bc28da5c3a | ||
|
2fb08f0132 | ||
|
b8d92a7f8f | ||
|
f6abd02cdc | ||
|
943b4e5b95 | ||
|
c55c8fe929 | ||
|
4c04741d4c | ||
|
0d56f7433b | ||
|
acc6542a1b | ||
|
803bdcdf2b | ||
|
b6c113d0eb | ||
|
82c59511b4 | ||
|
d9dd07545d | ||
|
88c3accd1a | ||
|
3c1b70842d | ||
|
62810a3c51 | ||
|
bbf3fcdecd | ||
|
e05d8d90c0 | ||
|
841aa8c47b | ||
|
95bde2af7f | ||
|
64a4475285 | ||
|
0c33a0bf4d | ||
|
4151c94d20 | ||
|
0a419c51ed | ||
|
eec6e810f1 | ||
|
c2a25d522b | ||
|
fe525c6f7c | ||
|
3b739e69c9 | ||
|
c9983ee863 | ||
|
912761ea17 | ||
|
1bb67d3844 | ||
|
6b41f0f335 | ||
|
d6b200e03a | ||
|
7f662bf4ef | ||
|
13c556d9de | ||
|
49582f9dbf | ||
|
61aef3ce05 | ||
|
d31fb73a09 | ||
|
8d2c79f4e3 | ||
|
fc552d842e | ||
|
5771d380b1 | ||
|
78005ffefe | ||
|
9324aa2d0d | ||
|
0616aa9ecf | ||
|
0ae9ac2179 | ||
|
b30b2c1381 | ||
|
edc4ba21c4 | ||
|
9aceb23df6 | ||
|
8e6ce38cf4 | ||
|
7c1a821000 | ||
|
1b827f0484 | ||
|
e3249d8e5a | ||
|
48ba181118 | ||
|
f6973d9054 | ||
|
9369e98a62 | ||
|
7783ba1120 | ||
|
47cd8af2d2 | ||
|
a4d594cbda | ||
|
0ef04197f7 | ||
|
547fcc76b2 | ||
|
98eb4489d7 | ||
|
a9080ef924 | ||
|
8cf3bf84ce | ||
|
8fd45ae74f | ||
|
4811214cc0 | ||
|
52c38ce17d | ||
|
b271edb092 | ||
|
cca36b6b21 | ||
|
853af31fb1 | ||
|
ab1f458034 | ||
|
49dfdb7a97 | ||
|
43070f2fd8 | ||
|
77bc2ad1e0 | ||
|
858435884d | ||
|
1ac1059961 | ||
|
b44bf0f8fe | ||
|
6f2411378b | ||
|
7dd7c146e8 | ||
|
faa0a91133 | ||
|
42451ec057 | ||
|
66278500db | ||
|
245cbf9441 | ||
|
2b88626548 | ||
|
2506cf29b3 | ||
|
6fd9bdf2cc | ||
|
d1775ee992 | ||
|
293211aee0 | ||
|
1bbd7c793c | ||
|
ba7f665dce | ||
|
130bc3c097 | ||
|
1ec17fb48a | ||
|
2b2be3fb82 | ||
|
833034f301 | ||
|
f9b30c0db3 | ||
|
a5278fc126 | ||
|
74413ca7d3 | ||
|
98e6c6d17b | ||
|
9491df8c1b | ||
|
d325cb7f57 | ||
|
24ee60ffd7 | ||
|
cea8d5c1ab | ||
|
fc867b96a5 |
@@ -633,6 +633,26 @@ else()
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
|
||||
endif()
|
||||
|
||||
# RapidJSON
|
||||
# search for CSF_RapidJSON variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_RapidJSON CAN_USE_RAPIDJSON)
|
||||
if (CAN_USE_RAPIDJSON)
|
||||
set (USE_RAPIDJSON OFF CACHE BOOL "${USE_RAPIDJSON_DESCR}")
|
||||
|
||||
if (USE_RAPIDJSON)
|
||||
add_definitions (-DHAVE_RAPIDJSON)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/rapidjson")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_RAPIDJSON")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_RAPIDJSON")
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_RAPIDJSON")
|
||||
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_RAPIDJSON")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_RAPIDJSON")
|
||||
endif()
|
||||
|
||||
# EIGEN
|
||||
if (CAN_USE_EIGEN)
|
||||
set (USE_EIGEN OFF CACHE BOOL "${USE_EIGEN_DESCR}")
|
||||
|
@@ -1,7 +1,7 @@
|
||||
FoundationClasses TKernel TKMath
|
||||
ModelingData TKG2d TKG3d TKGeomBase TKBRep
|
||||
ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
|
||||
Visualization TKService TKV3d TKOpenGl TKMeshVS TKIVtk TKD3DHost TKVulkan
|
||||
Visualization TKService TKV3d TKOpenGl TKMeshVS TKIVtk TKD3DHost
|
||||
ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF
|
||||
DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF
|
||||
DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh
|
||||
Draw TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
|
||||
|
@@ -203,10 +203,10 @@ n Aspect
|
||||
n DsgPrs
|
||||
n Graphic3d
|
||||
n Image
|
||||
n Media
|
||||
n MeshVS
|
||||
n OpenGl
|
||||
n D3DHost
|
||||
n Vulkan
|
||||
n Prs3d
|
||||
n PrsMgr
|
||||
n Select3D
|
||||
@@ -224,7 +224,6 @@ r Shaders
|
||||
t TKMeshVS
|
||||
t TKOpenGl
|
||||
t TKD3DHost
|
||||
t TKVulkan
|
||||
t TKService
|
||||
t TKV3d
|
||||
n BinTObjDrivers
|
||||
@@ -440,3 +439,7 @@ n Geom2dEvaluator
|
||||
t TKVCAF
|
||||
n XCAFView
|
||||
n XCAFNoteObjects
|
||||
t TKRWMesh
|
||||
n RWGltf
|
||||
n RWMesh
|
||||
n RWObj
|
||||
|
@@ -133,7 +133,7 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
|
||||
# set 3RDPARTY_${PRODUCT_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_LIBRARY
|
||||
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} "3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" FORCE)
|
||||
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
|
||||
if ((3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}") OR (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME}}"))
|
||||
find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} NAMES ${LIBRARY_NAME}
|
||||
PATHS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME}}" "${3RDPARTY_${PRODUCT_NAME}_DIR}"
|
||||
PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
|
||||
@@ -181,9 +181,9 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
|
||||
# set 3RDPARTY_${PRODUCT_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_DLL
|
||||
set (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} "3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"" FORCE)
|
||||
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
|
||||
if ((3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}") OR (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME}}"))
|
||||
find_library (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} NAMES ${LIBRARY_NAME}
|
||||
PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}"
|
||||
PATHS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME}}" "${3RDPARTY_${PRODUCT_NAME}_DIR}"
|
||||
PATH_SUFFIXES bin win${COMPILER_BITNESS}/${COMPILER}/bin
|
||||
NO_DEFAULT_PATH)
|
||||
if (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} STREQUAL "3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}-NOTFOUND")
|
||||
|
@@ -58,9 +58,6 @@ if (USE_TCL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Vulkan
|
||||
set (CSF_vulkan "vulkan-1")
|
||||
|
||||
if (WIN32)
|
||||
set (CSF_advapi32 "advapi32.lib")
|
||||
set (CSF_gdi32 "gdi32.lib")
|
||||
@@ -68,6 +65,7 @@ if (WIN32)
|
||||
set (CSF_shell32 "shell32.lib")
|
||||
set (CSF_wsock32 "wsock32.lib")
|
||||
set (CSF_psapi "psapi.lib")
|
||||
set (CSF_winmm "winmm.lib")
|
||||
set (CSF_d3d9 "D3D9.lib")
|
||||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" OR USE_GLES2)
|
||||
set (CSF_OpenGlLibs "libEGL libGLESv2")
|
||||
@@ -75,28 +73,35 @@ if (WIN32)
|
||||
set (CSF_OpenGlLibs "opengl32.lib")
|
||||
endif()
|
||||
|
||||
else()
|
||||
else()
|
||||
|
||||
if (APPLE)
|
||||
set (CSF_objc "objc")
|
||||
|
||||
# frameworks
|
||||
find_library (Appkit_LIB NAMES AppKit)
|
||||
set (CSF_Appkit ${Appkit_LIB})
|
||||
if (IOS)
|
||||
find_library (Appkit_LIB NAMES UIKit)
|
||||
set (CSF_Appkit ${Appkit_LIB})
|
||||
else()
|
||||
find_library (Appkit_LIB NAMES AppKit)
|
||||
set (CSF_Appkit ${Appkit_LIB})
|
||||
endif()
|
||||
OCCT_CHECK_AND_UNSET (Appkit_LIB)
|
||||
|
||||
find_library (IOKit_LIB NAMES IOKit)
|
||||
set (CSF_IOKit ${IOKit_LIB})
|
||||
|
||||
OCCT_CHECK_AND_UNSET (Appkit_LIB)
|
||||
OCCT_CHECK_AND_UNSET (IOKit_LIB)
|
||||
|
||||
if (USE_GLX)
|
||||
if (IOS)
|
||||
find_library (OpenGlLibs_LIB NAMES OpenGLES)
|
||||
set (CSF_OpenGlLibs ${OpenGlLibs_LIB})
|
||||
OCCT_CHECK_AND_UNSET (OpenGlLibs_LIB)
|
||||
elseif (USE_GLX)
|
||||
set (CSF_OpenGlLibs GL)
|
||||
set (CSF_XwLibs "X11 Xext Xmu Xi")
|
||||
else()
|
||||
find_library (OpenGlLibs_LIB NAMES OpenGL)
|
||||
set (CSF_OpenGlLibs ${OpenGlLibs_LIB})
|
||||
|
||||
OCCT_CHECK_AND_UNSET (OpenGlLibs_LIB)
|
||||
endif()
|
||||
|
||||
@@ -112,5 +117,6 @@ if (WIN32)
|
||||
endif()
|
||||
set (CSF_XwLibs "X11 Xext Xmu Xi")
|
||||
set (CSF_dl "dl")
|
||||
set (CSF_fontconfig "fontconfig")
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -163,13 +163,18 @@ function (FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
|
||||
OCCT_MAKE_COMPILER_BITNESS()
|
||||
|
||||
string (TOLOWER "${PRODUCT_NAME}" lower_PRODUCT_NAME)
|
||||
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*${COMPILER}.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*")
|
||||
if ("${lower_PRODUCT_NAME}" STREQUAL "egl")
|
||||
string (SUBSTRING "${lower_PRODUCT_NAME}" 1 -1 lower_PRODUCT_NAME)
|
||||
list (APPEND SEARCH_TEMPLATES "[^gl]+${lower_PRODUCT_NAME}.*")
|
||||
else()
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*${COMPILER}.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[a-zA-Z]*[0-9]*-${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*")
|
||||
endif()
|
||||
|
||||
SUBDIRECTORY_NAMES ("${ROOT_DIR}" SUBDIR_NAME_LIST)
|
||||
|
||||
|
86
adm/cmake/rapidjson.cmake
Normal file
86
adm/cmake/rapidjson.cmake
Normal file
@@ -0,0 +1,86 @@
|
||||
# RapidJSON
|
||||
|
||||
if (NOT DEFINED INSTALL_RAPIDJSON)
|
||||
set (INSTALL_RAPIDJSON OFF CACHE BOOL "${INSTALL_RAPIDJSON_DESCR}")
|
||||
endif()
|
||||
|
||||
# RapidJSON directory
|
||||
if (NOT DEFINED 3RDPARTY_RAPIDJSON_DIR)
|
||||
set (3RDPARTY_RAPIDJSON_DIR "" CACHE PATH "The directory containing RapidJSON")
|
||||
endif()
|
||||
|
||||
# search for RapidJSON in user defined directory
|
||||
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
|
||||
if (NOT 3RDPARTY_RAPIDJSON_DIR OR NOT EXISTS "${3RDPARTY_RAPIDJSON_DIR}")
|
||||
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" RapidJSON RAPIDJSON_DIR_NAME)
|
||||
if (RAPIDJSON_DIR_NAME)
|
||||
set (3RDPARTY_RAPIDJSON_DIR "${3RDPARTY_DIR}/${RAPIDJSON_DIR_NAME}" CACHE PATH "The directory containing RapidJSON" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_RAPIDJSON_INCLUDE_DIR)
|
||||
set (3RDPARTY_RAPIDJSON_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of the RAPIDJSON")
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_RAPIDJSON_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_RAPIDJSON_INCLUDE_DIR}")
|
||||
|
||||
set (HEADER_NAMES rapidjson/rapidjson.h)
|
||||
|
||||
set (3RDPARTY_RAPIDJSON_INCLUDE_DIR "3RDPARTY_RAPIDJSON_INCLUDE_DIR-NOTFOUND" CACHE PATH "the path to RapidJSON header file" FORCE)
|
||||
|
||||
if (3RDPARTY_RAPIDJSON_DIR AND EXISTS "${3RDPARTY_RAPIDJSON_DIR}")
|
||||
find_path (3RDPARTY_RAPIDJSON_INCLUDE_DIR NAMES ${HEADER_NAMES}
|
||||
PATHS ${3RDPARTY_RAPIDJSON_DIR}
|
||||
PATH_SUFFIXES include rapidjson
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_path (3RDPARTY_RAPIDJSON_INCLUDE_DIR NAMES ${HEADER_NAMES}
|
||||
PATH_SUFFIXES include rapidjson
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
|
||||
# use default (CMake) RapidJSON search
|
||||
if (NOT 3RDPARTY_RAPIDJSON_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_RAPIDJSON_INCLUDE_DIR}")
|
||||
if (3RDPARTY_RAPIDJSON_DIR AND EXISTS "${3RDPARTY_RAPIDJSON_DIR}")
|
||||
set (CACHED_RAPIDJSON_DIR $ENV{RapidJSON_DIR})
|
||||
set (ENV{RapidJSON_DIR} "${3RDPARTY_RAPIDJSON_DIR}")
|
||||
endif()
|
||||
|
||||
find_package(RapidJSON QUIET)
|
||||
|
||||
# restore ENV{RapidJSON_DIR}
|
||||
if (3RDPARTY_RAPIDJSON_DIR AND EXISTS "${3RDPARTY_RAPIDJSON_DIR}")
|
||||
set (ENV{RapidJSON_DIR} ${CACHED_RAPIDJSON_DIR})
|
||||
endif()
|
||||
|
||||
if (${RAPIDJSON_FOUND})
|
||||
set (3RDPARTY_RAPIDJSON_INCLUDE_DIR "${RAPIDJSON_INCLUDE_DIR}" CACHE PATH "the path to RapidJSON header file" FORCE)
|
||||
set (3RDPARTY_RAPIDJSON_DIR "${RAPIDJSON_ROOT_DIR}" CACHE PATH "The directory containing RapidJSON" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_RAPIDJSON_INCLUDE_DIR AND EXISTS "${3RDPARTY_RAPIDJSON_INCLUDE_DIR}")
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_RAPIDJSON_INCLUDE_DIR}")
|
||||
|
||||
# Install header files
|
||||
if (INSTALL_RAPIDJSON)
|
||||
file(GLOB RAPIDJSON_SUBDIRS "${3RDPARTY_RAPIDJSON_INCLUDE_DIR}/*")
|
||||
foreach(SUBDIR ${RAPIDJSON_SUBDIRS})
|
||||
if(IS_DIRECTORY "${SUBDIR}")
|
||||
install (DIRECTORY "${SUBDIR}" DESTINATION "${INSTALL_DIR_INCLUDE}")
|
||||
else()
|
||||
install (FILES "${SUBDIR}" DESTINATION "${INSTALL_DIR_INCLUDE}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_RAPIDJSON_INCLUDE_DIR)
|
||||
|
||||
set (3RDPARTY_RAPIDJSON_INCLUDE_DIR "" CACHE PATH "the path to RapidJSON header file" FORCE)
|
||||
endif()
|
||||
|
||||
# unset all redundant variables
|
||||
OCCT_CHECK_AND_UNSET(RapidJSON_DIR)
|
@@ -94,6 +94,7 @@ INSTALL_MESSAGE (INSTALL_EGL "EGL binaries")
|
||||
INSTALL_MESSAGE (INSTALL_GLES2 "OpenGL ES 2.0 binaries")
|
||||
INSTALL_MESSAGE (INSTALL_FREETYPE "FreeType binaries")
|
||||
INSTALL_MESSAGE (INSTALL_TBB "TBB binaries")
|
||||
INSTALL_MESSAGE (INSTALL_RAPIDJSON "RapidJSON header files")
|
||||
INSTALL_MESSAGE (INSTALL_TCL "TCL binaries")
|
||||
INSTALL_MESSAGE (INSTALL_TK "TK binaries")
|
||||
INSTALL_MESSAGE (INSTALL_VTK "VTK binaries ")
|
||||
@@ -161,6 +162,10 @@ set (USE_FREEIMAGE_DESCR
|
||||
"Indicates whether Freeimage product should be used in OCCT visualization
|
||||
module for support of popular graphics image formats (PNG, BMP etc)")
|
||||
|
||||
set (USE_RAPIDJSON_DESCR
|
||||
"Indicates whether RapidJSON product should be used in OCCT DataExchange
|
||||
module for support of JSON-based formats like glTF")
|
||||
|
||||
set (USE_EGL_DESCR
|
||||
"Indicates whether EGL should be used in OCCT visualization
|
||||
module instead of conventional OpenGL context creation APIs")
|
||||
|
@@ -189,6 +189,9 @@ proc wokdep:gui:UpdateList {} {
|
||||
}
|
||||
wokdep:SearchStandardLibrary anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs "liblzma" "lzma.h" "$aCheckLib" {"lzma" "xz"}
|
||||
}
|
||||
if { "$::HAVE_RAPIDJSON" == "true" } {
|
||||
wokdep:SearchRapidJson anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
||||
}
|
||||
|
||||
if { "$::CHECK_QT4" == "true" } {
|
||||
wokdep:SearchQt4 anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
||||
@@ -456,6 +459,9 @@ ttk::label .myFrame.myChecks.myZLibLbl -text "Use zlib"
|
||||
checkbutton .myFrame.myChecks.myLzmaCheck -offvalue "false" -onvalue "true" -variable HAVE_LIBLZMA -command wokdep:gui:UpdateList
|
||||
ttk::label .myFrame.myChecks.myLzmaLbl -text "Use liblzma"
|
||||
|
||||
checkbutton .myFrame.myChecks.myRapidJsonCheck -offvalue "false" -onvalue "true" -variable HAVE_RAPIDJSON -command wokdep:gui:UpdateList
|
||||
ttk::label .myFrame.myChecks.myRapidJsonLbl -text "Use RapidJSON"
|
||||
|
||||
checkbutton .myFrame.myChecks.myQt4Check -offvalue "false" -onvalue "true" -variable CHECK_QT4 -command wokdep:gui:UpdateList
|
||||
ttk::label .myFrame.myChecks.myQt4Lbl -text "Search Qt4"
|
||||
checkbutton .myFrame.myChecks.myJDKCheck -offvalue "false" -onvalue "true" -variable CHECK_JDK -command wokdep:gui:UpdateList
|
||||
@@ -564,8 +570,8 @@ if { "$::tcl_platform(os)" != "Darwin" } {
|
||||
grid .myFrame.myChecks.myZLibCheck -row $aCheckRowIter -column 6 -sticky e
|
||||
grid .myFrame.myChecks.myZLibLbl -row $aCheckRowIter -column 7 -sticky w
|
||||
|
||||
grid .myFrame.myChecks.myQt4Check -row $aCheckRowIter -column 10 -sticky e
|
||||
grid .myFrame.myChecks.myQt4Lbl -row $aCheckRowIter -column 11 -sticky w
|
||||
grid .myFrame.myChecks.myQt4Check -row $aCheckRowIter -column 12 -sticky e
|
||||
grid .myFrame.myChecks.myQt4Lbl -row $aCheckRowIter -column 13 -sticky w
|
||||
|
||||
incr aCheckRowIter
|
||||
grid .myFrame.myChecks.myFFmpegCheck -row $aCheckRowIter -column 0 -sticky e
|
||||
@@ -578,8 +584,8 @@ if { "$::tcl_platform(platform)" == "windows" } {
|
||||
}
|
||||
grid .myFrame.myChecks.myLzmaCheck -row $aCheckRowIter -column 6 -sticky e
|
||||
grid .myFrame.myChecks.myLzmaLbl -row $aCheckRowIter -column 7 -sticky w
|
||||
grid .myFrame.myChecks.myJDKCheck -row $aCheckRowIter -column 10 -sticky e
|
||||
grid .myFrame.myChecks.myJDKLbl -row $aCheckRowIter -column 11 -sticky w
|
||||
grid .myFrame.myChecks.myJDKCheck -row $aCheckRowIter -column 12 -sticky e
|
||||
grid .myFrame.myChecks.myJDKLbl -row $aCheckRowIter -column 13 -sticky w
|
||||
|
||||
incr aCheckRowIter
|
||||
if { "$::tcl_platform(os)" == "Darwin" } {
|
||||
@@ -588,6 +594,10 @@ if { "$::tcl_platform(os)" == "Darwin" } {
|
||||
incr aCheckRowIter
|
||||
}
|
||||
|
||||
grid .myFrame.myChecks.myRapidJsonCheck -row $aCheckRowIter -column 6 -sticky e
|
||||
grid .myFrame.myChecks.myRapidJsonLbl -row $aCheckRowIter -column 7 -sticky w
|
||||
incr aCheckRowIter
|
||||
|
||||
# Additional headers search paths
|
||||
grid .myFrame.myIncLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
|
||||
incr aRowIter
|
||||
|
@@ -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
|
||||
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA 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_RAPIDJSON HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo}
|
||||
foreach anEnvIter $THE_ENV_VARIABLES {
|
||||
set ${anEnvIter} "false"
|
||||
if { [info exists ::env(${anEnvIter})] } {
|
||||
@@ -858,6 +858,25 @@ proc wokdep:SearchGLES {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin6
|
||||
return "$isFound"
|
||||
}
|
||||
|
||||
# Search RapidJSON headers
|
||||
proc wokdep:SearchRapidJson {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
|
||||
upvar $theErrInc anErrInc
|
||||
|
||||
set isFound "true"
|
||||
set aRJHPath [wokdep:SearchHeader "rapidjson/rapidjson.h"]
|
||||
if { "$aRJHPath" == "" } {
|
||||
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{rapidjson}*] "$::VCVER" "$::ARCH" ]
|
||||
if { "$aPath" != "" && [file exists "$aPath/include/rapidjson/rapidjson.h"] } {
|
||||
lappend ::CSF_OPT_INC "$aPath/include"
|
||||
} else {
|
||||
lappend anErrInc "Error: 'rapidjson/rapidjson.h' not found (RapidJSON)"
|
||||
set isFound "false"
|
||||
}
|
||||
}
|
||||
|
||||
return "$isFound"
|
||||
}
|
||||
|
||||
# Auxiliary function, gets VTK version to set default search directory
|
||||
proc wokdep:VtkVersion { thePath } {
|
||||
set aResult "6.1"
|
||||
@@ -1167,26 +1186,41 @@ proc wokdep:SaveCustom {} {
|
||||
}
|
||||
|
||||
set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
|
||||
if { "$::PRODUCTS_PATH" != "" } {
|
||||
set aStringInc [regsub -all "$::PRODUCTS_PATH" $aStringInc "%PRODUCTS_PATH%"]
|
||||
}
|
||||
puts $aFile ""
|
||||
puts $aFile "rem Additional headers search paths"
|
||||
puts $aFile "set \"CSF_OPT_INC=$aStringInc\""
|
||||
|
||||
set aStringLib32 [join $::CSF_OPT_LIB32 $::SYS_PATH_SPLITTER]
|
||||
if { "$::PRODUCTS_PATH" != "" } {
|
||||
set aStringLib32 [regsub -all "$::PRODUCTS_PATH" $aStringLib32 "%PRODUCTS_PATH%"]
|
||||
}
|
||||
puts $aFile ""
|
||||
puts $aFile "rem Additional libraries (32-bit) search paths"
|
||||
puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\""
|
||||
|
||||
set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER]
|
||||
if { "$::PRODUCTS_PATH" != "" } {
|
||||
set aStringLib64 [regsub -all "$::PRODUCTS_PATH" $aStringLib64 "%PRODUCTS_PATH%"]
|
||||
}
|
||||
puts $aFile ""
|
||||
puts $aFile "rem Additional libraries (64-bit) search paths"
|
||||
puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\""
|
||||
|
||||
set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER]
|
||||
if { "$::PRODUCTS_PATH" != "" } {
|
||||
set aStringBin32 [regsub -all "$::PRODUCTS_PATH" $aStringBin32 "%PRODUCTS_PATH%"]
|
||||
}
|
||||
puts $aFile ""
|
||||
puts $aFile "rem Additional (32-bit) search paths"
|
||||
puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\""
|
||||
|
||||
set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER]
|
||||
if { "$::PRODUCTS_PATH" != "" } {
|
||||
set aStringBin64 [regsub -all "$::PRODUCTS_PATH" $aStringBin64 "%PRODUCTS_PATH%"]
|
||||
}
|
||||
puts $aFile ""
|
||||
puts $aFile "rem Additional (64-bit) search paths"
|
||||
puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\""
|
||||
@@ -1217,25 +1251,36 @@ proc wokdep:SaveCustom {} {
|
||||
}
|
||||
|
||||
set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
|
||||
if { "$::PRODUCTS_PATH" != "" } {
|
||||
set aStringInc [regsub -all "$::PRODUCTS_PATH" $aStringInc "\${PRODUCTS_PATH}"]
|
||||
}
|
||||
puts $aFile ""
|
||||
puts $aFile "# Additional headers search paths"
|
||||
puts $aFile "export CSF_OPT_INC=\"$aStringInc\""
|
||||
|
||||
set aStringLib$::ARCH [join [set ::CSF_OPT_LIB$::ARCH] $::SYS_PATH_SPLITTER]
|
||||
set aStringLib [join [set ::CSF_OPT_LIB$::ARCH] $::SYS_PATH_SPLITTER]
|
||||
if { "$::PRODUCTS_PATH" != "" } {
|
||||
set aStringLib [regsub -all "$::PRODUCTS_PATH" $aStringLib "\${PRODUCTS_PATH}"]
|
||||
}
|
||||
puts $aFile ""
|
||||
puts $aFile "# Additional libraries ($::ARCH-bit) search paths"
|
||||
puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib$::ARCH]\""
|
||||
puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib]\""
|
||||
|
||||
set aStringBin$::ARCH [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER]
|
||||
set aStringBin [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER]
|
||||
if { "$::PRODUCTS_PATH" != "" } {
|
||||
set aStringBin [regsub -all "$::PRODUCTS_PATH" $aStringBin "\${PRODUCTS_PATH}"]
|
||||
}
|
||||
puts $aFile ""
|
||||
puts $aFile "# Additional ($::ARCH-bit) search paths"
|
||||
puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin$::ARCH]\""
|
||||
puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin]\""
|
||||
|
||||
close $aFile
|
||||
}
|
||||
puts "Configuration saved to file '$aCustomFilePath'"
|
||||
|
||||
if { "$::PRJFMT" == "pro" } {
|
||||
# generate custom.auto.pri
|
||||
set toExportCustomPri 1
|
||||
if { $toExportCustomPri == 1 } {
|
||||
set aCasVer [wokdep:DetectCasVersion]
|
||||
set aCustomFilePath "./adm/qmake/custom.auto.pri"
|
||||
set aFile [open $aCustomFilePath "w"]
|
||||
@@ -1260,12 +1305,18 @@ proc wokdep:SaveCustom {} {
|
||||
puts $aFile ""
|
||||
puts $aFile "# Additional headers search paths"
|
||||
foreach anIncPath $::CSF_OPT_INC {
|
||||
if { "$::PRODUCTS_PATH" != "" } {
|
||||
set anIncPath [regsub -all "$::PRODUCTS_PATH" $anIncPath "\$\$\{PRODUCTS_PATH\}"]
|
||||
}
|
||||
puts $aFile "INCLUDEPATH += \"${anIncPath}\""
|
||||
}
|
||||
|
||||
puts $aFile ""
|
||||
puts $aFile "# Additional libraries search paths"
|
||||
foreach aLibPath [set ::CSF_OPT_LIB$::ARCH] {
|
||||
if { "$::PRODUCTS_PATH" != "" } {
|
||||
set aLibPath [regsub -all "$::PRODUCTS_PATH" $aLibPath "\$\$\{PRODUCTS_PATH\}"]
|
||||
}
|
||||
puts $aFile "LIBS += -L\"${aLibPath}\""
|
||||
}
|
||||
|
||||
@@ -1273,6 +1324,9 @@ proc wokdep:SaveCustom {} {
|
||||
puts $aFile ""
|
||||
puts $aFile "# Additional DLLs search paths"
|
||||
foreach aDllPath [set ::CSF_OPT_BIN$::ARCH] {
|
||||
if { "$::PRODUCTS_PATH" != "" } {
|
||||
set aDllPath [regsub -all "$::PRODUCTS_PATH" $aDllPath "\$\$\{PRODUCTS_PATH\}"]
|
||||
}
|
||||
puts $aFile "LIBS += -L\"${aDllPath}\""
|
||||
}
|
||||
}
|
||||
|
@@ -1349,8 +1349,6 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
|
||||
set aLibsMap(CSF_LIBLZMA) "liblzma"
|
||||
}
|
||||
|
||||
set aLibsMap(CSF_vulkan) "vulkan-1"
|
||||
|
||||
if { "$theOS" == "wnt" } {
|
||||
# WinAPI libraries
|
||||
set aLibsMap(CSF_kernel32) "kernel32"
|
||||
@@ -1361,6 +1359,7 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
|
||||
set aLibsMap(CSF_opengl32) "opengl32"
|
||||
set aLibsMap(CSF_wsock32) "wsock32"
|
||||
set aLibsMap(CSF_netapi32) "netapi32"
|
||||
set aLibsMap(CSF_winmm) "winmm"
|
||||
set aLibsMap(CSF_OpenGlLibs) "opengl32"
|
||||
if { "$::HAVE_GLES2" == "true" } {
|
||||
set aLibsMap(CSF_OpenGlLibs) "libEGL libGLESv2"
|
||||
@@ -1378,17 +1377,23 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
|
||||
set aLibsMap(CSF_TBB) ""
|
||||
} else {
|
||||
set aLibsMap(CSF_dl) "dl"
|
||||
if { "$theOS" == "mac" } {
|
||||
if { "$theOS" == "mac" || "$theOS" == "ios" } {
|
||||
set aLibsMap(CSF_objc) "objc"
|
||||
set aFrmsMap(CSF_Appkit) "AppKit"
|
||||
if { "$theOS" == "ios" } {
|
||||
set aFrmsMap(CSF_Appkit) "UIKit"
|
||||
set aFrmsMap(CSF_OpenGlLibs) "OpenGLES"
|
||||
} else {
|
||||
set aFrmsMap(CSF_Appkit) "AppKit"
|
||||
set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
|
||||
}
|
||||
set aFrmsMap(CSF_IOKit) "IOKit"
|
||||
set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
|
||||
set aFrmsMap(CSF_TclLibs) "Tcl"
|
||||
set aLibsMap(CSF_TclLibs) ""
|
||||
set aFrmsMap(CSF_TclTkLibs) "Tk"
|
||||
set aLibsMap(CSF_TclTkLibs) ""
|
||||
set aLibsMap(CSF_QT) "QtCore QtGui"
|
||||
} else {
|
||||
set aLibsMap(CSF_fontconfig) "fontconfig"
|
||||
if { "$theOS" == "qnx" } {
|
||||
# CSF_ThreadLibs - pthread API is part of libc on QNX
|
||||
set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
|
||||
@@ -2671,7 +2676,7 @@ proc OS:xcodeproj { theModules theOutDir theGuidsMap theLibType thePlatform} {
|
||||
}
|
||||
|
||||
# Generates dependencies section for Xcode project files.
|
||||
proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection theDepsGuids theDepsRefGuids theIsStatic} {
|
||||
proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection theDepsGuids theDepsRefGuids thePlatform theIsStatic} {
|
||||
upvar $theGuidsMap aGuidsMap
|
||||
upvar $theFileRefSection aFileRefSection
|
||||
upvar $theDepsGuids aDepsGuids
|
||||
@@ -2695,7 +2700,7 @@ proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection
|
||||
}
|
||||
}
|
||||
|
||||
osutils:usedOsLibs $theToolKit "mac" aLibs aFrameworks
|
||||
osutils:usedOsLibs $theToolKit $thePlatform aLibs aFrameworks
|
||||
set aUsedLibs [concat $aUsedLibs $aLibs]
|
||||
set aUsedLibs [concat $aUsedLibs $aFrameworks]
|
||||
foreach tkx $aUsedLibs {
|
||||
@@ -2910,7 +2915,7 @@ proc osutils:xcdtk { theOutDir theToolKit theGuidsMap theIsStatic thePlatform {t
|
||||
}
|
||||
|
||||
puts $aPbxprojFile [osutils:xcdtk:sources $theToolKit $theTargetType aSrcFileRefSection aGroupSection aPackagesGuids aSrcFileGuids aGuidsMap anIncPaths]
|
||||
puts $aPbxprojFile [osutils:xcdtk:deps $theToolKit $theTargetType aGuidsMap aDepsFileRefSection aDepsGuids aDepsRefGuids $theIsStatic]
|
||||
puts $aPbxprojFile [osutils:xcdtk:deps $theToolKit $theTargetType aGuidsMap aDepsFileRefSection aDepsGuids aDepsRefGuids $thePlatform $theIsStatic]
|
||||
# End PBXBuildFile section
|
||||
|
||||
# Begin PBXFileReference section
|
||||
|
@@ -12,13 +12,11 @@ CONFIG -= debug_and_release
|
||||
OccGitRoot = $$_PRO_FILE_PWD_/../../../..
|
||||
|
||||
# Define compilation flags
|
||||
!win32 { DEFINES += OCC_CONVERT_SIGNALS }
|
||||
android {
|
||||
CONFIG += warn_off
|
||||
QMAKE_CFLAGS += -fexceptions -Wno-ignored-qualifiers -Wall
|
||||
QMAKE_CXXFLAGS += -fexceptions -Wno-ignored-qualifiers -Wall
|
||||
#android-g++ { QMAKE_CXXFLAGS += -Wno-strict-overflow }
|
||||
} else:win32 {
|
||||
CONFIG += warn_on
|
||||
QMAKE_CFLAGS_WARN_ON = -Wall
|
||||
QMAKE_CXXFLAGS_WARN_ON = -Wall
|
||||
win32 {
|
||||
QMAKE_CFLAGS_WARN_ON = -W4
|
||||
QMAKE_CXXFLAGS_WARN_ON = -W4
|
||||
QMAKE_CXXFLAGS_EXCEPTIONS_ON = /EHa
|
||||
QMAKE_CXXFLAGS_STL_ON = /EHa
|
||||
@@ -39,22 +37,37 @@ android {
|
||||
DEFINES += _CRT_SECURE_NO_WARNINGS
|
||||
DEFINES += _CRT_NONSTDC_NO_DEPRECATE
|
||||
DEFINES += _SCL_SECURE_NO_WARNINGS
|
||||
} else:mac {
|
||||
} else {
|
||||
CONFIG += c++11
|
||||
CONFIG += warn_off
|
||||
QMAKE_CXXFLAGS += -Wall
|
||||
QMAKE_CFLAGS += -fexceptions
|
||||
QMAKE_CXXFLAGS += -fexceptions
|
||||
QMAKE_CXXFLAGS += -fvisibility=default
|
||||
iphoneos {
|
||||
QMAKE_IOS_DEPLOYMENT_TARGET = 8.0
|
||||
} else {
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10
|
||||
DEFINES += OCC_CONVERT_SIGNALS
|
||||
mac {
|
||||
iphoneos {
|
||||
QMAKE_IOS_DEPLOYMENT_TARGET = 8.0
|
||||
} else {
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14
|
||||
}
|
||||
}
|
||||
}
|
||||
!CONFIG(debug, debug|release) {
|
||||
# disable exceptions in Release builds
|
||||
DEFINES += No_Exception
|
||||
HAVE_RelWithDebInfo {
|
||||
win32 {
|
||||
CONFIG += force_debug_info
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Define output folder depending on compiler name
|
||||
MY_BITNESS = 32
|
||||
|
||||
equals(QMAKE_TARGET.arch, x86_64) | equals(QMAKE_HOST.arch, x86_64) { MY_BITNESS = 64 }
|
||||
equals(ANDROID_TARGET_ARCH, arm64-v8a) { MY_BITNESS = 64 }
|
||||
has64Target = $$find(QMAKE_TARGET.arch, "x64")
|
||||
count(has64Target, 1) { MY_BITNESS = 64 }
|
||||
|
||||
MY_PLATFORM = platform
|
||||
CONFIG(iphonesimulator, iphoneos|iphonesimulator) { MY_PLATFORM = iphonesimulator
|
||||
@@ -89,11 +102,24 @@ android-g++ {
|
||||
} else:win32-msvc2017 {
|
||||
MY_COMPILER = vc14
|
||||
MY_VC_VER = 14
|
||||
} else:win32-msvc {
|
||||
MY_COMPILER = vc14
|
||||
MY_VC_VER = 14
|
||||
aMsvcVer = $$(VisualStudioVersion)
|
||||
equals(aMsvcVer, 14.0){
|
||||
# VS2015, vc140
|
||||
} else:equals(aMsvcVer, 15.0){
|
||||
# VS2015, vc141
|
||||
} else:equals(aMsvcVer, 16.0){
|
||||
# VS2019, vc142
|
||||
} else {
|
||||
warning (Unknown msvc version. "$$MY_COMPILER" is used)
|
||||
}
|
||||
} else {
|
||||
warning (Unknown compiler. "$$MY_COMPILER" is used)
|
||||
}
|
||||
MY_PLATFORM_AND_COMPILER = $$MY_PLATFORM/$$MY_COMPILER
|
||||
#message (The platform is "$$MY_PLATFORM"; bitness is "$$MY_BITNESS"; compiler is "$$MY_COMPILER")
|
||||
#warning (The platform is "$$MY_PLATFORM"; bitness is "$$MY_BITNESS"; compiler is "$$MY_COMPILER")
|
||||
|
||||
CONFIG(debug, debug|release) { MY_BUILDTYPE = d }
|
||||
|
||||
@@ -110,9 +136,6 @@ win32 {
|
||||
QMAKE_SUBSTITUTES += occtkgen_libfolder
|
||||
|
||||
LIBS += -L$$aLibDest
|
||||
HAVE_RelWithDebInfo {
|
||||
!CONFIG(debug, debug|release) { CONFIG += force_debug_info }
|
||||
}
|
||||
equals(TEMPLATE, lib) {
|
||||
QMAKE_CLEAN += $$DESTDIR/$${TARGET}.dll
|
||||
QMAKE_CLEAN += $$aLibDest/$${TARGET}.lib
|
||||
|
@@ -38,6 +38,7 @@ win32 {
|
||||
CSF_OpenGlLibs = -lopengl32
|
||||
HAVE_GLES2 { CSF_OpenGlLibs = -llibEGL -llibGLESv2 }
|
||||
CSF_psapi = -lPsapi
|
||||
CSF_winmm = -lwinmm
|
||||
CSF_d3d9 = -ld3d9
|
||||
CSF_TclLibs = -ltcl86
|
||||
CSF_TclTkLibs = -ltk86
|
||||
@@ -45,9 +46,14 @@ win32 {
|
||||
} else:mac {
|
||||
CSF_dl = -ldl
|
||||
CSF_objc = -lobjc
|
||||
CSF_Appkit = -framework AppKit
|
||||
iphoneos {
|
||||
CSF_Appkit = -framework UIKit
|
||||
CSF_OpenGlLibs = -framework OpenGLES
|
||||
} else {
|
||||
CSF_Appkit = -framework AppKit
|
||||
CSF_OpenGlLibs = -framework OpenGL
|
||||
}
|
||||
CSF_IOKit = -framework IOKit
|
||||
CSF_OpenGlLibs = -framework OpenGL
|
||||
CSF_TclLibs = -framework Tcl
|
||||
CSF_TclTkLibs = -framework Tk
|
||||
} else {
|
||||
@@ -57,6 +63,7 @@ win32 {
|
||||
CSF_TclTkLibs = -lX11 -ltk8.6
|
||||
CSF_XwLibs = -lX11 -lXext -lXmu -lXi
|
||||
CSF_MotifLibs = -lX11
|
||||
CSF_fontconfig = -lfontconfig
|
||||
HAVE_GLES2 { CSF_OpenGlLibs = -lEGL -lGLESv2 }
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@ set "HAVE_GLES2=false"
|
||||
set "HAVE_D3D=false"
|
||||
set "HAVE_ZLIB=false"
|
||||
set "HAVE_LIBLZMA=false"
|
||||
set "HAVE_RAPIDJSON=false"
|
||||
set "CSF_OPT_INC="
|
||||
set "CSF_OPT_LIB32="
|
||||
set "CSF_OPT_LIB64="
|
||||
@@ -163,6 +164,7 @@ if ["%HAVE_GLES2%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DH
|
||||
if ["%HAVE_D3D%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_D3D" & set "CSF_DEFINES=HAVE_D3D;%CSF_DEFINES%"
|
||||
if ["%HAVE_ZLIB%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_ZLIB" & set "CSF_DEFINES=HAVE_ZLIB;%CSF_DEFINES%"
|
||||
if ["%HAVE_LIBLZMA%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_LIBLZMA" & set "CSF_DEFINES=HAVE_LIBLZMA;%CSF_DEFINES%"
|
||||
if ["%HAVE_RAPIDJSON%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_RAPIDJSON" & set "CSF_DEFINES=HAVE_RAPIDJSON;%CSF_DEFINES%"
|
||||
|
||||
rem Eliminate VS warning
|
||||
if ["%CSF_DEFINES%"] == [""] set "CSF_DEFINES=;"
|
||||
|
@@ -878,7 +878,18 @@ The test grid name is constructed depending on the type of the tested chamfers.
|
||||
| dist_angle_complex | | Distance from edge and given angle |
|
||||
| dist_angle_sequence | | Distance from edge and given angle |
|
||||
|
||||
@subsubsection testmanual_5_1_7 demo
|
||||
@subsubsection testmanual_5_1_7 de
|
||||
|
||||
This group tests reading and writing of CAD data files (iges, step) to and from OCCT.
|
||||
|
||||
Test cases check transfer status, shape and attributes against expected reference values.
|
||||
|
||||
| Grid | Commands | Functionality |
|
||||
| :---- | :----- | :------- |
|
||||
| iges_1, iges_2, iges_3 | igesbrep, brepiges, ReadIges, WriteIges | IGES tests |
|
||||
| step_1, step_2, step_3, step_4, step_5 | stepread, stepwrite, ReadStep, WriteStep | STEP tests |
|
||||
|
||||
@subsubsection testmanual_5_1_8 demo
|
||||
|
||||
This group allows demonstrating how testing cases are created, and testing DRAW commands and the test system as a whole.
|
||||
|
||||
@@ -889,7 +900,7 @@ This group allows demonstrating how testing cases are created, and testing DRAW
|
||||
| samples | | OCCT samples |
|
||||
|
||||
|
||||
@subsubsection testmanual_5_1_8 draft
|
||||
@subsubsection testmanual_5_1_9 draft
|
||||
|
||||
This group allows testing draft operations.
|
||||
|
||||
@@ -900,7 +911,7 @@ DRAW module: MODELING.
|
||||
| Angle | depouille | Drafts with angle (inclined walls) |
|
||||
|
||||
|
||||
@subsubsection testmanual_5_1_9 feat
|
||||
@subsubsection testmanual_5_1_10 feat
|
||||
|
||||
This group allows testing creation of features on a shape.
|
||||
|
||||
@@ -914,7 +925,7 @@ DRAW module: MODELING (package *BRepTest*).
|
||||
| featrevol | | |
|
||||
| featrf | | |
|
||||
|
||||
@subsubsection testmanual_5_1_10 heal
|
||||
@subsubsection testmanual_5_1_11 heal
|
||||
|
||||
This group allows testing the functionality provided by *ShapeHealing* toolkit.
|
||||
|
||||
@@ -943,7 +954,7 @@ DRAW module: XSDRAW
|
||||
| surface_to_revolution_standard | DT_ShapeConvertRev | Convert elementary surfaces to revolutions, simple cases |
|
||||
| update_tolerance_locked | updatetolerance | Update the tolerance of shape so that it satisfy the rule: toler(face)<=toler(edge)<=toler(vertex) |
|
||||
|
||||
@subsubsection testmanual_5_1_11 mesh
|
||||
@subsubsection testmanual_5_1_12 mesh
|
||||
|
||||
This group allows testing shape tessellation (*BRepMesh*) and shading.
|
||||
|
||||
@@ -960,7 +971,7 @@ DRAW modules: MODELING (package *MeshTest*), VISUALIZATION (package *ViewerTest*
|
||||
| advanced_incmesh_parallel | incmesh | Meshing of complex shapes, parallel mode |
|
||||
| standard_incmesh_parallel | incmesh | Meshing of simple shapes, parallel mode |
|
||||
|
||||
@subsubsection testmanual_5_1_12 mkface
|
||||
@subsubsection testmanual_5_1_13 mkface
|
||||
|
||||
This group allows testing creation of simple surfaces.
|
||||
|
||||
@@ -975,7 +986,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| after_revsurf_and_offset | mkface | |
|
||||
| mkplane | mkplane | |
|
||||
|
||||
@subsubsection testmanual_5_1_13 nproject
|
||||
@subsubsection testmanual_5_1_14 nproject
|
||||
|
||||
This group allows testing normal projection of edges and wires onto a face.
|
||||
|
||||
@@ -985,7 +996,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| :---- | :----- | :------- |
|
||||
| Base | nproject | |
|
||||
|
||||
@subsubsection testmanual_5_1_14 offset
|
||||
@subsubsection testmanual_5_1_15 offset
|
||||
|
||||
This group allows testing offset functionality for curves and surfaces.
|
||||
|
||||
@@ -1001,7 +1012,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| shape | offsetshape | |
|
||||
| wire_closed_outside_0_005, wire_closed_outside_0_025, wire_closed_outside_0_075, wire_closed_inside_0_005, wire_closed_inside_0_025, wire_closed_inside_0_075, wire_unclosed_outside_0_005, wire_unclosed_outside_0_025, wire_unclosed_outside_0_075 | mkoffset | 2d offset of closed and unclosed planar wires with different offset step and directions of offset ( inside / outside ) |
|
||||
|
||||
@subsubsection testmanual_5_1_15 pipe
|
||||
@subsubsection testmanual_5_1_16 pipe
|
||||
|
||||
This group allows testing construction of pipes (sweeping of a contour along profile).
|
||||
|
||||
@@ -1011,7 +1022,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| :---- | :----- | :------- |
|
||||
| Standard | pipe | |
|
||||
|
||||
@subsubsection testmanual_5_1_16 prism
|
||||
@subsubsection testmanual_5_1_17 prism
|
||||
|
||||
This group allows testing construction of prisms.
|
||||
|
||||
@@ -1021,7 +1032,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| :---- | :----- | :------- |
|
||||
| seminf | prism | |
|
||||
|
||||
@subsubsection testmanual_5_1_17 sewing
|
||||
@subsubsection testmanual_5_1_18 sewing
|
||||
|
||||
This group allows testing sewing of faces by connecting edges.
|
||||
|
||||
@@ -1033,7 +1044,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| tol_1 | sewing | Sewing faces with tolerance 1 |
|
||||
| tol_100 | sewing | Sewing faces with tolerance 100 |
|
||||
|
||||
@subsubsection testmanual_5_1_18 thrusection
|
||||
@subsubsection testmanual_5_1_19 thrusection
|
||||
|
||||
This group allows testing construction of shell or a solid passing through a set of sections in a given sequence (loft).
|
||||
|
||||
@@ -1042,7 +1053,7 @@ This group allows testing construction of shell or a solid passing through a set
|
||||
| solids | thrusection | Lofting with resulting solid |
|
||||
| not_solids | thrusection | Lofting with resulting shell or face |
|
||||
|
||||
@subsubsection testmanual_5_1_19 xcaf
|
||||
@subsubsection testmanual_5_1_20 xcaf
|
||||
|
||||
This group allows testing extended data exchange packages.
|
||||
|
||||
|
@@ -1738,8 +1738,26 @@ or updating presentation without recomputation (see *AIS_InteractiveObject::Sync
|
||||
* *Aspect_IS_HIDDENLINE* does not implicitly enables drawing mesh edges anymore.
|
||||
Specify Graphic3d_AspectFillArea3d::SetDrawEdges(true) with Graphic3d_AspectFillArea3d::SetInteriorStyle(Aspect_IS_HIDDENLINE) to get previous behavior of Aspect_IS_HIDDENLINE style.
|
||||
|
||||
@subsection upgrade_740_modedprs PrsMgr and SelectMgr hierarchy clean up
|
||||
|
||||
Proxy classes *Prs3d_Presentation*, *PrsMgr_ModedPresentation* and *PrsMgr_Prs* have been removed.
|
||||
Code iterating through the list of low-level structures AIS_InteractiveObject::Presentations() should be updated to access PrsMgr_Presentation directly.
|
||||
Forward declarations of *Prs3d_Presentation* should be corrected, since it is now a typedef to *Graphic3d_Structure*.
|
||||
|
||||
Proxy classes *SelectBasics_SensitiveEntity* and *SelectBasics_EntityOwner* have been removed - *Select3D_SensitiveEntity* and *SelectMgr_EntityOwner* should be now used directly instead.
|
||||
|
||||
@subsection upgrade_740_geproj Custom defines within env.bat
|
||||
|
||||
*env.bat* produced by Visual Studio project generator *genproj.bat* has been modified so that *%CSF_DEFINES%* variable is reset to initial state.
|
||||
Custom building environment relying on old behavior and setting extra macros within *%CSF_DEFINES%* before env.bat should be updated
|
||||
to either modify custom.bat or setup new variable *%CSF_DEFINES_EXTRA%* instead.
|
||||
|
||||
@subsection upgrade_740_BVH_in_BOP Switching Boolean Operations algorithm to use BVH tree instead of UB tree
|
||||
|
||||
Since OCCT 7.4.0 Boolean Operations algorithm uses BVH tree instead of UBTree to find the pairs of entities with interfering bounding boxes.
|
||||
The following API changes have been made:
|
||||
* BOPTools_BoxBndTree and BOPTools_BoxBndTreeSelector have been removed. Use the BOPTools_BoxTree and BOPTools_BoxTreeSelector instead.
|
||||
* BOPTools_BoxSelector::SetBox() method now accepts the BVH_Box instead of Bnd_Box.
|
||||
* Methods BOPTools_BoxSelector::Reject and BOPTools_BoxSelector::Accept have been removed as unused.
|
||||
* The RunParallel flag has been removed from the list of parameters of BOPAlgo_Tools::IntersectVertices method. Earlier, it performed selection from the UB tree in parallel mode. Now all interfering pairs are found in one pass, using pair traverse of the same BVH tree.
|
||||
|
||||
|
@@ -222,6 +222,7 @@ for which OCCT is certified to work.
|
||||
| Freetype (for text rendering) | FreeType 2.4.11-2.7.1 https://sourceforge.net/projects/freetype/files/ |
|
||||
| FreeImage (optional, for support of common 2D graphic formats) | FreeImage 3.17.0+ https://sourceforge.net/projects/freeimage/files |
|
||||
| FFmpeg (optional, for video recording) | FFmpeg 3.1+ https://www.ffmpeg.org/download.html |
|
||||
| RapidJSON (optional, for reading glTF) | RapidJSON 1.1+ http://rapidjson.org/ |
|
||||
| Intel TBB (optional, for multithreaded algorithms) | TBB 4.x or 5.x https://www.threadingbuildingblocks.org/ |
|
||||
| VTK (for VTK Integration Services | VTK 6.1+ http://www.vtk.org/download/ |
|
||||
| Doxygen (optional for building documentation) | Doxygen 1.8.5+ https://www.stack.nl/~dimitri/doxygen/download.html |
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Draw Test Harness {#occt_user_guides__test_harness}
|
||||
Draw Test Harness {#occt_user_guides__test_harness}
|
||||
===============================
|
||||
|
||||
@tableofcontents
|
||||
@@ -5593,8 +5593,9 @@ Draw provides command to create curves and surfaces by approximation.
|
||||
|
||||
* **2dapprox** fits a curve through 2d points;
|
||||
* **appro** fits a curve through 3d points;
|
||||
* **surfapp** and **grilapp** fit a surface through 3d points;
|
||||
* **2dinterpolate** interpolates a curve.
|
||||
* **surfapp** and **grilapp** fit a surface through 3d points by approximation;
|
||||
* **surfint** fit a surface through 3d points by interpolation;
|
||||
* **2dinterpole** interpolates a curve.
|
||||
|
||||
@subsubsection occt_draw_6_8_1 appro, dapprox
|
||||
|
||||
@@ -5614,17 +5615,28 @@ Let us pick points and they will be fitted
|
||||
2dapprox c 10
|
||||
~~~~~
|
||||
|
||||
@subsubsection occt_draw_6_8_2 surfapp, grilapp
|
||||
@subsubsection occt_draw_6_8_2 surfapp, grilapp, surfint
|
||||
|
||||
|
||||
Syntax:
|
||||
~~~~~
|
||||
surfapp name nbupoints nbvpoints x y z ....
|
||||
or
|
||||
surfapp name nbupoints nbvpoints surf [periodic_flag = 0]
|
||||
grilapp name nbupoints nbvpoints xo dx yo dy z11 z12 ...
|
||||
surfint name surf nbupoints nbvpoints [periodic_flag = 0]
|
||||
~~~~~
|
||||
|
||||
* **surfapp** fits a surface through an array of u and v points, nbupoints*nbvpoints.
|
||||
* **grilapp** has the same function, but the x,y coordinates of the points are on a grid starting at x0,y0 with steps dx,dy.
|
||||
* **surfapp** can take array of points from other input surface, if alternative syntax
|
||||
**surfapp** name nbupoints nbvpoints surf [periodic_flag = 0]
|
||||
is used.
|
||||
Both command use for fitting approximation algorithm.
|
||||
**surfint** uses interpolation algorithm and can take array of point only from other input surface.
|
||||
Optional parameter **periodic_flag** allows to get correct periodical surfaces in U direction.
|
||||
U direction of result surface corresponds colums of initial array of points.
|
||||
If **periodic_flag** = 1, algorithm uses first row of array as last row and builds periodical surface.
|
||||
|
||||
**Example:**
|
||||
~~~~~
|
||||
|
BIN
dox/user_guides/modeling_data/images/modeling_data_obb_125K.png
Normal file
BIN
dox/user_guides/modeling_data/images/modeling_data_obb_125K.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
@@ -1341,7 +1341,26 @@ Further, let us consider the triangle \f$ T_{0}\left \langle p_{0}, p_{1}, p_{2}
|
||||
<span>10.</span> Compute the center of OBB and its half dimensions.<br>
|
||||
<span>11.</span> Create OBB using the center, axes and half dimensions.<br>
|
||||
|
||||
This algorithm is implemented in the *Bnd_OBB::ReBuild(...)* method.
|
||||
@subsubsection occt_modat_6_1_1_opt Creation of Optimal OBB from set of points
|
||||
|
||||
For creation of the optimal OBB from set of points the same algorithm as described above is used but with some simplifications in logic and increased computation time.
|
||||
For the optimal OBB it is necessary to check all possible axes which can be created by the extremal points. And since the extremal points are only valid for the initial axes it is necessary to project the whole set of points on each axis.
|
||||
This approach usually provides much tighter OBB but the performance is lower. The complexity of the algorithm is still linear and with use of BVH for the set of points it is O(N + C*log(N)).
|
||||
|
||||
Here is the example of optimal and not optimal OBB for the model using the set of 125K nodes:
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td>@figure{/user_guides/modeling_data/images/modeling_data_obb_125K.png,"Not optimal OBB by DiTo-14",160}</td>
|
||||
<td>@figure{/user_guides/modeling_data/images/modeling_data_opt_obb_125K.png,"Optimal OBB by DiTo-14",160}</td>
|
||||
<td>@figure{/user_guides/modeling_data/images/modeling_data_pca_obb_125K.png,"Not optimal OBB by PCA",160}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Computation of the not optimal OBB in this case took 0.007 sec, optimal - 0.1 sec, which is about 14 times slower. Such performance is comparable to creation of the OBB for this shape by PCA approach (see below) which takes about 0.17 sec.
|
||||
|
||||
The computation of optimal OBB is controlled by the same *theIsOptimal* flag in the BRepBndLib::AddOBB method as for PCA algorithm.
|
||||
|
||||
These algorithms are implemented in the *Bnd_OBB::ReBuild(...)* method.
|
||||
|
||||
@subsubsection occt_modat_6_1_2 Creation of OBB based on Axes of inertia
|
||||
|
||||
|
@@ -226,8 +226,6 @@ Selection is implemented as a combination of various algorithms divided among se
|
||||
#### SelectBasics
|
||||
|
||||
*SelectBasics* package contains basic classes and interfaces for selection. The most notable are:
|
||||
- *SelectBasics_SensitiveEntity* -- the base definition of a sensitive entity;
|
||||
- *SelectBasics_EntityOwner* -- the base definition of the an entity owner -- the link between the sensitive entity and the object to be selected;
|
||||
- *SelectBasics_PickResult* -- the structure for storing quantitative results of detection procedure, for example, depth and distance to the center of geometry;
|
||||
- *SelectBasics_SelectingVolumeManager* -- the interface for interaction with the current selection frustum.
|
||||
|
||||
@@ -247,9 +245,11 @@ Each custom sensitive entity must inherit at least *SelectBasics_SensitiveEntity
|
||||
- triangulation;
|
||||
- wire.
|
||||
|
||||
Each basic sensitive entity inherits *Select3D_SensitiveEntity*, which is a child class of *SelectBasics_SensitiveEntity*.
|
||||
Each basic sensitive entity inherits *Select3D_SensitiveEntity*.
|
||||
The package also contains two auxiliary classes, *Select3D_SensitivePoly* and *Select3D_SensitiveSet*.
|
||||
|
||||
*Select3D_SensitiveEntity* -- the base definition of a sensitive entity.
|
||||
|
||||
*Select3D_SensitiveSet* -- a base class for all complex sensitive entities that require the third level BVH usage. It implements traverse of the tree and defines an interface for the methods that check sub-entities.
|
||||
|
||||
*Select3D_SensitivePoly* -- describes an arbitrary point set and implements basic functions for selection. It is important to know that this class does not perform any internal data checks. Hence, custom implementations of sensitive entity inherited from *Select3D_SensitivePoly* must satisfy the terms of Separating Axis Theorem to use standard OCCT overlap detection methods.
|
||||
|
@@ -155,7 +155,6 @@ class ISession2D_InteractiveObject;
|
||||
class V3d_Viewer;
|
||||
class SelectMgr_SelectableObject;
|
||||
class TCollection_AsciiString;
|
||||
class SelectBasics_EntityOwner;
|
||||
class gp_Pnt2d;
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
@@ -264,11 +264,11 @@ bfuse _model _model t_s
|
||||
explode _model e
|
||||
|
||||
# Make a weld at joint edges of platform and wedge
|
||||
blend _model _model 2 _model_26
|
||||
blend _model _model 2 _model_27
|
||||
blend _model _model 2 _model_28
|
||||
blend _model _model 2 _model_29
|
||||
blend _model _model 2 _model_31
|
||||
blend _model _model 2 _model_30
|
||||
blend _model _model 2 _model_32
|
||||
|
||||
# Cylinder on wedge
|
||||
blend result _model 2 _model_161
|
||||
@@ -276,7 +276,7 @@ blend result _model 2 _model_161
|
||||
# Show result
|
||||
pload VISUALIZATION
|
||||
vinit Driver1/Viewer1/View1
|
||||
vsetcolorbg 200 200 255
|
||||
vbackground -color 0.784314 0.784314 1
|
||||
vdisplay -dispMode 1 result
|
||||
vfit
|
||||
vaspects result -setFaceBoundaryDraw 1 -mostContinuity c2
|
||||
|
@@ -262,7 +262,7 @@ unifysamedom result p_1
|
||||
# Show result
|
||||
pload VISUALIZATION
|
||||
vinit Driver1/Viewer1/View1
|
||||
vsetcolorbg 200 200 255
|
||||
vbackground -color 0.784314 0.784314 1
|
||||
vdisplay -dispMode 1 result
|
||||
vfit
|
||||
vaspects result -setFaceBoundaryDraw 1
|
||||
|
@@ -53,7 +53,7 @@ for {set i 1} {$i <= 1} {incr i} {
|
||||
|
||||
# prepare a view
|
||||
vinit Penrose w=1024 h=512
|
||||
vsetcolorbg 255 255 255
|
||||
vbackground -color WHITE
|
||||
vrenderparams -rayTrace -fsaa on -reflections off -shadows off
|
||||
|
||||
# set camera position and adjust lights
|
||||
|
@@ -19,7 +19,7 @@ restore $aBotLoc b
|
||||
vinit View1 w=768 h=768
|
||||
vclear
|
||||
vsetdispmode 0
|
||||
vsetcolorbg 255 255 255
|
||||
vbackground -color WHITE
|
||||
vbottom
|
||||
|
||||
puts "Getting cut projection..."
|
||||
|
@@ -69,7 +69,7 @@ vclose ALL
|
||||
vinit View1 w=768 h=768
|
||||
vtop
|
||||
vglinfo
|
||||
vsetgradientbg 180 200 255 180 180 180 2
|
||||
vbackground -gradient 0.705882 0.784314 1 0.705882 0.705882 0.705882 -gradientMode VERTICAL
|
||||
|
||||
vlight -change 0 -dir 0.577 -0.577 -0.577
|
||||
vrenderparams -msaa 8
|
||||
|
@@ -59,7 +59,7 @@ XShow D
|
||||
vfit
|
||||
vsetdispmode 1
|
||||
vrenderparams -msaa 8
|
||||
vsetcolorbg 255 255 255
|
||||
vbackground -color WHITE
|
||||
|
||||
#param write.iges.brep.mode 1
|
||||
#WriteIges D d:/pencil3.igs
|
||||
|
@@ -30,7 +30,7 @@ vsettransparency glass 0.6
|
||||
vlight new spot pos -100 -100 300
|
||||
|
||||
# set white background and fit view
|
||||
vsetcolorbg 255 255 255
|
||||
vbackground -color WHITE
|
||||
vfit
|
||||
|
||||
# set ray tracing
|
||||
|
@@ -129,7 +129,7 @@ vrenderparams -msaa 8
|
||||
vsetcolor snowflake 0 0 0
|
||||
vsetcolor lines 0 0 0
|
||||
vsetcolor text 0 0 0
|
||||
vsetcolorbg 255 255 255
|
||||
vbackground -color WHITE
|
||||
vtop
|
||||
vfit
|
||||
|
||||
|
@@ -14,10 +14,10 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <AIS.hxx>
|
||||
|
||||
#include <Adaptor3d_HCurve.hxx>
|
||||
#include <Adaptor3d_HSurface.hxx>
|
||||
#include <AIS.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
@@ -783,6 +783,7 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
BRepAdaptor_Surface surf1( aFace );
|
||||
Handle( Adaptor3d_HSurface ) surf2;
|
||||
Standard_Boolean isOffset = Standard_False;
|
||||
Offset = 0.0;
|
||||
|
||||
if (surf1.GetType() == GeomAbs_OffsetSurface)
|
||||
{
|
||||
@@ -801,7 +802,6 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
{
|
||||
aPlane = surf2->Plane();
|
||||
aSurfType = AIS_KOS_Plane;
|
||||
Offset = 0.;
|
||||
Result = Standard_True;
|
||||
}
|
||||
|
||||
@@ -817,7 +817,6 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
gp_Pln thePlane( LinePos, LineDir ^ ExtrusionDir);
|
||||
aPlane = thePlane;
|
||||
aSurfType = AIS_KOS_Plane;
|
||||
Offset = 0.;
|
||||
Result = Standard_True;
|
||||
}
|
||||
}
|
||||
@@ -826,7 +825,6 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
{
|
||||
aSurf = (Handle( Geom_OffsetSurface )::DownCast( aSurf ))->Surface();
|
||||
aPlane = (Handle( Geom_Plane )::DownCast( aSurf ))->Pln();
|
||||
Offset = 0.0e0;
|
||||
}
|
||||
if (Result == Standard_False)
|
||||
{
|
||||
@@ -839,7 +837,6 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
|
||||
TheType == STANDARD_TYPE(Geom_ToroidalSurface))
|
||||
{
|
||||
aSurf = (Handle( Geom_OffsetSurface )::DownCast( aSurf ))->Surface();
|
||||
Offset = 0.0e0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -899,20 +896,18 @@ gp_Pnt AIS::ProjectPointOnLine( const gp_Pnt & aPoint, const gp_Lin & aLine )
|
||||
//function : InitFaceLength
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS::InitFaceLength (const TopoDS_Face& aFace,
|
||||
gp_Pln & aPlane,
|
||||
Handle(Geom_Surface) & aSurface,
|
||||
AIS_KindOfSurface & aSurfaceType,
|
||||
Standard_Real & anOffset)
|
||||
void AIS::InitFaceLength (const TopoDS_Face& theFace,
|
||||
gp_Pln& thePlane,
|
||||
Handle(Geom_Surface)& theSurface,
|
||||
AIS_KindOfSurface& theSurfaceType,
|
||||
Standard_Real& theOffset)
|
||||
{
|
||||
AIS::GetPlaneFromFace( aFace, aPlane, aSurface, aSurfaceType, anOffset );
|
||||
|
||||
if (Abs( anOffset ) > Precision::Confusion())
|
||||
{
|
||||
aSurface = new Geom_OffsetSurface( aSurface, anOffset );
|
||||
anOffset = 0.0e0;
|
||||
}
|
||||
|
||||
if (AIS::GetPlaneFromFace (theFace, thePlane, theSurface, theSurfaceType, theOffset)
|
||||
&& Abs (theOffset) > Precision::Confusion())
|
||||
{
|
||||
theSurface = new Geom_OffsetSurface (theSurface, theOffset);
|
||||
theOffset = 0.0e0;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -17,73 +17,26 @@
|
||||
#ifndef _AIS_HeaderFile
|
||||
#define _AIS_HeaderFile
|
||||
|
||||
#include <AIS_KindOfSurface.hxx>
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <Aspect_TypeOfMarker.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <AIS_KindOfSurface.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <Aspect_TypeOfMarker.hxx>
|
||||
class gp_Pnt;
|
||||
class TopoDS_Shape;
|
||||
class gp_Lin;
|
||||
class Geom_Curve;
|
||||
class TopoDS_Edge;
|
||||
class Geom_Plane;
|
||||
class TopoDS_Vertex;
|
||||
class TopoDS_Face;
|
||||
class gp_Pln;
|
||||
class Geom_Surface;
|
||||
class gp_Dir;
|
||||
class Bnd_Box;
|
||||
class gp_Elips;
|
||||
class Prs3d_Presentation;
|
||||
class AIS_Triangulation;
|
||||
class AIS_InteractiveContext;
|
||||
class AIS_GraphicTool;
|
||||
class AIS_GlobalStatus;
|
||||
class AIS_InteractiveObject;
|
||||
class AIS_Point;
|
||||
class AIS_Axis;
|
||||
class AIS_Trihedron;
|
||||
class AIS_PlaneTrihedron;
|
||||
class AIS_Line;
|
||||
class AIS_Circle;
|
||||
class AIS_Plane;
|
||||
class AIS_Shape;
|
||||
class AIS_ConnectedInteractive;
|
||||
class AIS_MultipleConnectedInteractive;
|
||||
class AIS_DimensionOwner;
|
||||
class AIS_Relation;
|
||||
class AIS_EllipseRadiusDimension;
|
||||
class AIS_MaxRadiusDimension;
|
||||
class AIS_MinRadiusDimension;
|
||||
class AIS_Chamf2dDimension;
|
||||
class AIS_Chamf3dDimension;
|
||||
class AIS_OffsetDimension;
|
||||
class AIS_FixRelation;
|
||||
class AIS_PerpendicularRelation;
|
||||
class AIS_ParallelRelation;
|
||||
class AIS_TangentRelation;
|
||||
class AIS_ConcentricRelation;
|
||||
class AIS_IdenticRelation;
|
||||
class AIS_SymmetricRelation;
|
||||
class AIS_MidPointRelation;
|
||||
class AIS_EqualRadiusRelation;
|
||||
class AIS_EqualDistanceRelation;
|
||||
class AIS_TypeFilter;
|
||||
class AIS_SignatureFilter;
|
||||
class AIS_ExclusionFilter;
|
||||
class AIS_AttributeFilter;
|
||||
class AIS_C0RegularityFilter;
|
||||
class AIS_BadEdgeFilter;
|
||||
class AIS_Selection;
|
||||
|
||||
class Geom_Curve;
|
||||
class Geom_Plane;
|
||||
class Geom_Surface;
|
||||
class TopoDS_Edge;
|
||||
class TopoDS_Face;
|
||||
class TopoDS_Shape;
|
||||
class TopoDS_Vertex;
|
||||
|
||||
//! Application Interactive Services provide the means to create links between an application GUI viewer and
|
||||
//! the packages which are used to manage selection and presentation.
|
||||
|
@@ -168,7 +168,7 @@ void AIS_Animation::StartTimer (const Standard_Real theStartPts,
|
||||
{
|
||||
if (myTimer.IsNull())
|
||||
{
|
||||
myTimer = new AIS_AnimationTimer();
|
||||
myTimer = new Media_Timer();
|
||||
}
|
||||
myTimer->Stop();
|
||||
myTimer->Seek (theStartPts);
|
||||
|
@@ -191,7 +191,7 @@ protected:
|
||||
|
||||
protected:
|
||||
|
||||
Handle(AIS_AnimationTimer) myTimer;
|
||||
Handle(Media_Timer) myTimer;
|
||||
|
||||
TCollection_AsciiString myName; //!< animation name
|
||||
NCollection_Sequence<Handle(AIS_Animation)>
|
||||
|
@@ -48,7 +48,7 @@ void AIS_AnimationCamera::update (const AIS_AnimationProgress& theProgress)
|
||||
Handle(Graphic3d_Camera) aCamera = myView->Camera();
|
||||
|
||||
Graphic3d_CameraLerp aCamLerp (myCamStart, myCamEnd);
|
||||
aCamLerp.Interpolate (theProgress.LocalNormalized, aCamera);
|
||||
aCamLerp.Interpolate (HasOwnDuration() ? theProgress.LocalNormalized : 1.0, aCamera);
|
||||
|
||||
const Standard_Boolean aPrevImmUpdate = myView->SetImmediateUpdate (Standard_False);
|
||||
myView->SetCamera (aCamera);
|
||||
|
@@ -33,6 +33,9 @@ public:
|
||||
//! Return the target view.
|
||||
const Handle(V3d_View)& View() const { return myView; }
|
||||
|
||||
//! Set target view.
|
||||
void SetView (const Handle(V3d_View)& theView) { myView = theView; }
|
||||
|
||||
//! Return camera start position.
|
||||
const Handle(Graphic3d_Camera)& CameraStart() const { return myCamStart; }
|
||||
|
||||
|
@@ -15,60 +15,7 @@
|
||||
#ifndef _AIS_AnimationTimer_HeaderFile
|
||||
#define _AIS_AnimationTimer_HeaderFile
|
||||
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
//! Auxiliary class defining the animation timer.
|
||||
class AIS_AnimationTimer : public Standard_Transient
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_AnimationTimer, Standard_Transient)
|
||||
public:
|
||||
|
||||
//! Empty constructor.
|
||||
AIS_AnimationTimer() : myTimerFrom (0.0), myTimerSpeed (1.0) {}
|
||||
|
||||
//! Return elapsed time in seconds.
|
||||
Standard_Real ElapsedTime() const
|
||||
{
|
||||
return myTimerFrom + myTimer.ElapsedTime() * myTimerSpeed;
|
||||
}
|
||||
|
||||
//! Return playback speed coefficient (1.0 means normal speed).
|
||||
Standard_Real PlaybackSpeed() const { return myTimerSpeed; }
|
||||
|
||||
//! Setup playback speed coefficient.
|
||||
Standard_EXPORT void SetPlaybackSpeed (const Standard_Real theSpeed);
|
||||
|
||||
//! Return true if timer has been started.
|
||||
Standard_Boolean IsStarted() const
|
||||
{
|
||||
return myTimer.IsStarted();
|
||||
}
|
||||
|
||||
//! Start the timer.
|
||||
void Start()
|
||||
{
|
||||
myTimer.Start();
|
||||
}
|
||||
|
||||
//! Pause the timer.
|
||||
Standard_EXPORT void Pause();
|
||||
|
||||
//! Stop the timer.
|
||||
Standard_EXPORT void Stop();
|
||||
|
||||
//! Seek the timer to specified position.
|
||||
Standard_EXPORT void Seek (const Standard_Real theTime);
|
||||
|
||||
protected:
|
||||
|
||||
OSD_Timer myTimer;
|
||||
Standard_Real myTimerFrom;
|
||||
Standard_Real myTimerSpeed;
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_AnimationTimer, Standard_Transient)
|
||||
#include <Media_Timer.hxx>
|
||||
typedef Media_Timer AIS_AnimationTimer;
|
||||
|
||||
#endif // _AIS_AnimationTimer_HeaderFile
|
||||
|
@@ -34,10 +34,8 @@
|
||||
#include <Prs3d_Projector.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Select3D_SensitiveSegment.hxx>
|
||||
#include <SelectBasics_EntityOwner.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StdPrs_Curve.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@@ -199,8 +197,7 @@ void AIS_Axis::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(G
|
||||
void AIS_Axis::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
|
||||
const Standard_Integer)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this);
|
||||
eown -> SelectBasics_EntityOwner::Set(3);
|
||||
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner (this, 3);
|
||||
Handle(Select3D_SensitiveSegment) seg = new Select3D_SensitiveSegment(eown,
|
||||
myPfirst,
|
||||
myPlast);
|
||||
|
@@ -17,29 +17,13 @@
|
||||
#ifndef _AIS_Chamf2dDimension_HeaderFile
|
||||
#define _AIS_Chamf2dDimension_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <DsgPrs_ArrowSide.hxx>
|
||||
#include <AIS_KindOfDimension.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
class TopoDS_Shape;
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <DsgPrs_ArrowSide.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
|
||||
class Geom_Plane;
|
||||
class TCollection_ExtendedString;
|
||||
class gp_Pnt;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
|
||||
|
||||
class AIS_Chamf2dDimension;
|
||||
DEFINE_STANDARD_HANDLE(AIS_Chamf2dDimension, AIS_Relation)
|
||||
|
||||
//! A framework to define display of 2D chamfers.
|
||||
@@ -48,10 +32,9 @@ DEFINE_STANDARD_HANDLE(AIS_Chamf2dDimension, AIS_Relation)
|
||||
//! chamfer, or the angle if it is not.
|
||||
class AIS_Chamf2dDimension : public AIS_Relation
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_Chamf2dDimension, AIS_Relation)
|
||||
public:
|
||||
|
||||
|
||||
//! Constructs the display object for 2D chamfers.
|
||||
//! This object is defined by the face aFShape, the
|
||||
//! dimension aVal, the plane aPlane and the text aText.
|
||||
@@ -79,18 +62,7 @@ public:
|
||||
//! to the object to display before computation !!!
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_Chamf2dDimension,AIS_Relation)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
@@ -101,14 +73,8 @@ private:
|
||||
gp_Pnt myPntAttach;
|
||||
gp_Dir myDir;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <AIS_Chamf2dDimension.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_Chamf2dDimension_HeaderFile
|
||||
|
@@ -17,28 +17,11 @@
|
||||
#ifndef _AIS_Chamf3dDimension_HeaderFile
|
||||
#define _AIS_Chamf3dDimension_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <DsgPrs_ArrowSide.hxx>
|
||||
#include <AIS_KindOfDimension.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
class TopoDS_Shape;
|
||||
class TCollection_ExtendedString;
|
||||
class gp_Pnt;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <DsgPrs_ArrowSide.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
|
||||
|
||||
class AIS_Chamf3dDimension;
|
||||
DEFINE_STANDARD_HANDLE(AIS_Chamf3dDimension, AIS_Relation)
|
||||
|
||||
//! A framework to define display of 3D chamfers.
|
||||
@@ -47,10 +30,9 @@ DEFINE_STANDARD_HANDLE(AIS_Chamf3dDimension, AIS_Relation)
|
||||
//! chamfer, or the angle if it is not.
|
||||
class AIS_Chamf3dDimension : public AIS_Relation
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_Chamf3dDimension, AIS_Relation)
|
||||
public:
|
||||
|
||||
|
||||
//! Constructs a display object for 3D chamfers.
|
||||
//! This object is defined by the shape aFShape, the
|
||||
//! dimension aVal and the text aText.
|
||||
@@ -78,19 +60,8 @@ public:
|
||||
//! to the object to display before computation !!!
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_Chamf3dDimension,AIS_Relation)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
@@ -100,14 +71,8 @@ private:
|
||||
gp_Pnt myPntAttach;
|
||||
gp_Dir myDir;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <AIS_Chamf3dDimension.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_Chamf3dDimension_HeaderFile
|
||||
|
@@ -512,8 +512,8 @@ void AIS_ColoredShape::ComputeSelection (const Handle(SelectMgr_Selection)& theS
|
||||
Handle(SelectMgr_SelectableObject) aThis (this);
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelEntIter.Value()->BaseSensitive()->OwnerId());
|
||||
anOwner->Set (aThis);
|
||||
const Handle(SelectMgr_EntityOwner)& anOwner = aSelEntIter.Value()->BaseSensitive()->OwnerId();
|
||||
anOwner->SetSelectable (aThis);
|
||||
}
|
||||
|
||||
StdSelect_BRepSelectionTool::PreBuildBVH (theSelection);
|
||||
|
@@ -17,24 +17,11 @@
|
||||
#ifndef _AIS_ConcentricRelation_HeaderFile
|
||||
#define _AIS_ConcentricRelation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
class TopoDS_Shape;
|
||||
#include <gp_Dir.hxx>
|
||||
|
||||
class Geom_Plane;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
|
||||
|
||||
class AIS_ConcentricRelation;
|
||||
DEFINE_STANDARD_HANDLE(AIS_ConcentricRelation, AIS_Relation)
|
||||
|
||||
//! A framework to define a constraint by a relation of
|
||||
@@ -44,10 +31,9 @@ DEFINE_STANDARD_HANDLE(AIS_ConcentricRelation, AIS_Relation)
|
||||
//! relation of concentricity can be extended.
|
||||
class AIS_ConcentricRelation : public AIS_Relation
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_ConcentricRelation, AIS_Relation)
|
||||
public:
|
||||
|
||||
|
||||
//! Constructs the display object for concentric relations
|
||||
//! between shapes.
|
||||
//! This object is defined by the two shapes, aFShape
|
||||
@@ -65,19 +51,8 @@ public:
|
||||
//! to the object to display before computation !!!
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_ConcentricRelation,AIS_Relation)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
@@ -95,13 +70,6 @@ private:
|
||||
gp_Dir myDir;
|
||||
gp_Pnt myPnt;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_ConcentricRelation_HeaderFile
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_Projector.hxx>
|
||||
#include <PrsMgr_ModedPresentation.hxx>
|
||||
#include <Select3D_SensitiveEntity.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
@@ -92,12 +91,12 @@ void AIS_ConnectedInteractive::connect (const Handle(AIS_InteractiveObject)& the
|
||||
|
||||
void AIS_ConnectedInteractive::Disconnect()
|
||||
{
|
||||
for(Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
|
||||
for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
|
||||
{
|
||||
const Handle(PrsMgr_Presentation)& aPrs = myPresentations (aPrsIter).Presentation();
|
||||
const Handle(PrsMgr_Presentation)& aPrs = aPrsIter.Value();
|
||||
if (!aPrs.IsNull())
|
||||
{
|
||||
aPrs->Presentation()->DisconnectAll (Graphic3d_TOC_DESCENDANT);
|
||||
aPrs->DisconnectAll (Graphic3d_TOC_DESCENDANT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,7 +111,7 @@ void AIS_ConnectedInteractive::Compute (const Handle(PrsMgr_PresentationManager3
|
||||
if (HasConnection())
|
||||
{
|
||||
thePrs->Clear (Standard_False);
|
||||
thePrs->RemoveAll();
|
||||
thePrs->DisconnectAll (Graphic3d_TOC_DESCENDANT);
|
||||
|
||||
if (!myReference->HasInteractiveContext())
|
||||
{
|
||||
@@ -234,7 +233,7 @@ void AIS_ConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selectio
|
||||
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (TheRefSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
if (Handle(Select3D_SensitiveEntity) aSensitive = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
|
||||
if (const Handle(Select3D_SensitiveEntity)& aSensitive = aSelEntIter.Value()->BaseSensitive())
|
||||
{
|
||||
// Get the copy of SE3D
|
||||
if (Handle(Select3D_SensitiveEntity) aNewSensitive = aSensitive->GetConnected())
|
||||
@@ -272,7 +271,7 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
|
||||
Shapes2EntitiesMap aShapes2EntitiesMap;
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aRefSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
if (Handle(Select3D_SensitiveEntity) aSE = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
|
||||
if (const Handle(Select3D_SensitiveEntity)& aSE = aSelEntIter.Value()->BaseSensitive())
|
||||
{
|
||||
if (Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast (aSE->OwnerId()))
|
||||
{
|
||||
|
@@ -335,31 +335,31 @@ TCollection_ExtendedString AIS_Dimension::GetValueString (Standard_Real& theWidt
|
||||
if (myDrawer->DimensionAspect()->IsText3d())
|
||||
{
|
||||
// text width produced by BRepFont
|
||||
Font_BRepFont aFont (aTextAspect->Aspect()->Font().ToCString(),
|
||||
aTextAspect->Aspect()->GetTextFontAspect(),
|
||||
aTextAspect->Height());
|
||||
|
||||
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
|
||||
Font_BRepFont aFont;
|
||||
if (aFont.FindAndInit (aTextAspect->Aspect()->Font(), aTextAspect->Aspect()->GetTextFontAspect(), aTextAspect->Height(), Font_StrictLevel_Any))
|
||||
{
|
||||
Standard_Utf32Char aCurrChar = *anIter;
|
||||
Standard_Utf32Char aNextChar = *(++anIter);
|
||||
theWidth += aFont.AdvanceX (aCurrChar, aNextChar);
|
||||
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
|
||||
{
|
||||
Standard_Utf32Char aCurrChar = *anIter;
|
||||
Standard_Utf32Char aNextChar = *(++anIter);
|
||||
theWidth += aFont.AdvanceX (aCurrChar, aNextChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Text width for 1:1 scale 2D case
|
||||
Handle(Font_FTFont) aFont = new Font_FTFont();
|
||||
aFont->Init (aTextAspect->Aspect()->Font().ToCString(),
|
||||
aTextAspect->Aspect()->GetTextFontAspect(),
|
||||
(unsigned int )aTextAspect->Height(),
|
||||
THE_2D_TEXT_RESOLUTION);
|
||||
|
||||
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
|
||||
Font_FTFontParams aFontParams;
|
||||
aFontParams.PointSize = (unsigned int )aTextAspect->Height();
|
||||
aFontParams.Resolution = THE_2D_TEXT_RESOLUTION;
|
||||
if (Handle(Font_FTFont) aFont = Font_FTFont::FindAndCreate (aTextAspect->Aspect()->Font(), aTextAspect->Aspect()->GetTextFontAspect(), aFontParams, Font_StrictLevel_Any))
|
||||
{
|
||||
Standard_Utf32Char aCurrChar = *anIter;
|
||||
Standard_Utf32Char aNextChar = *(++anIter);
|
||||
theWidth += (Standard_Real) aFont->AdvanceX (aCurrChar, aNextChar);
|
||||
for (NCollection_Utf8Iter anIter = anUTFString.Iterator(); *anIter != 0; )
|
||||
{
|
||||
Standard_Utf32Char aCurrChar = *anIter;
|
||||
Standard_Utf32Char aNextChar = *(++anIter);
|
||||
theWidth += (Standard_Real) aFont->AdvanceX (aCurrChar, aNextChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
// Copyright (c) 2018-2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
@@ -12,15 +11,16 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef BOPTools_BoxBndTree_HeaderFile
|
||||
#define BOPTools_BoxBndTree_HeaderFile
|
||||
#ifndef _AIS_DragAction_HeaderFile
|
||||
#define _AIS_DragAction_HeaderFile
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BOPTools_BoxSelector.hxx>
|
||||
#include <NCollection_EBTree.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
//! Dragging action.
|
||||
enum AIS_DragAction
|
||||
{
|
||||
AIS_DragAction_Start, //!< (try) start dragging object
|
||||
AIS_DragAction_Update, //!< perform dragging (update position)
|
||||
AIS_DragAction_Stop, //!< stop dragging (save position)
|
||||
AIS_DragAction_Abort, //!< abort dragging (restore initial position)
|
||||
};
|
||||
|
||||
typedef NCollection_EBTree<Standard_Integer, Bnd_Box> BOPTools_BoxBndTree;
|
||||
typedef BOPTools_BoxSelector<Bnd_Box> BOPTools_BoxBndTreeSelector;
|
||||
|
||||
#endif
|
||||
#endif // _AIS_DragAction_HeaderFile
|
@@ -17,32 +17,12 @@
|
||||
#ifndef _AIS_EqualDistanceRelation_HeaderFile
|
||||
#define _AIS_EqualDistanceRelation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <DsgPrs_ArrowSide.hxx>
|
||||
#include <AIS_TypeOfDist.hxx>
|
||||
class TopoDS_Shape;
|
||||
#include <DsgPrs_ArrowSide.hxx>
|
||||
|
||||
class Geom_Plane;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
class TopoDS_Edge;
|
||||
class Bnd_Box;
|
||||
class gp_Pnt;
|
||||
class TopoDS_Vertex;
|
||||
|
||||
|
||||
class AIS_EqualDistanceRelation;
|
||||
DEFINE_STANDARD_HANDLE(AIS_EqualDistanceRelation, AIS_Relation)
|
||||
|
||||
//! A framework to display equivalent distances between
|
||||
@@ -52,10 +32,9 @@ DEFINE_STANDARD_HANDLE(AIS_EqualDistanceRelation, AIS_Relation)
|
||||
//! These distances are used to compare shapes by this vector alone.
|
||||
class AIS_EqualDistanceRelation : public AIS_Relation
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_EqualDistanceRelation,AIS_Relation)
|
||||
public:
|
||||
|
||||
|
||||
//! Constructs a framework to display equivalent
|
||||
//! distances between the shapes aShape1, aShape2,
|
||||
//! aShape3, aShape4 and the plane aPlane.
|
||||
@@ -105,19 +84,8 @@ public:
|
||||
//! a line or a circle.
|
||||
Standard_EXPORT static void ComputeOneEdgeOneVertexLength (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Real ArrowSize, const TopoDS_Shape& FirstShape, const TopoDS_Shape& SecondShape, const Handle(Geom_Plane)& Plane, const Standard_Boolean AutomaticPos, const Standard_Boolean IsSetBndBox, const Bnd_Box& BndBox, gp_Pnt& Position, gp_Pnt& FirstAttach, gp_Pnt& SecondAttach, gp_Pnt& FirstExtreme, gp_Pnt& SecondExtreme, DsgPrs_ArrowSide& SymbolPrs);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_EqualDistanceRelation,AIS_Relation)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
@@ -135,14 +103,8 @@ private:
|
||||
gp_Pnt myPoint3;
|
||||
gp_Pnt myPoint4;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <AIS_EqualDistanceRelation.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_EqualDistanceRelation_HeaderFile
|
||||
|
@@ -17,31 +17,17 @@
|
||||
#ifndef _AIS_EqualRadiusRelation_HeaderFile
|
||||
#define _AIS_EqualRadiusRelation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
class TopoDS_Edge;
|
||||
|
||||
class Geom_Plane;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
|
||||
|
||||
class AIS_EqualRadiusRelation;
|
||||
DEFINE_STANDARD_HANDLE(AIS_EqualRadiusRelation, AIS_Relation)
|
||||
|
||||
|
||||
class AIS_EqualRadiusRelation : public AIS_Relation
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_EqualRadiusRelation, AIS_Relation)
|
||||
public:
|
||||
|
||||
|
||||
//! Creates equal relation of two arc's radiuses.
|
||||
//! If one of edges is not in the given plane,
|
||||
//! the presentation method projects it onto the plane.
|
||||
@@ -56,19 +42,8 @@ public:
|
||||
//! to the object to display before computation !!!
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_EqualRadiusRelation,AIS_Relation)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
@@ -82,13 +57,6 @@ private:
|
||||
gp_Pnt myFirstPoint;
|
||||
gp_Pnt mySecondPoint;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_EqualRadiusRelation_HeaderFile
|
||||
|
@@ -17,32 +17,11 @@
|
||||
#ifndef _AIS_FixRelation_HeaderFile
|
||||
#define _AIS_FixRelation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
class TopoDS_Shape;
|
||||
|
||||
class Geom_Plane;
|
||||
class TopoDS_Wire;
|
||||
class gp_Pnt;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
class TopoDS_Vertex;
|
||||
class Geom_Curve;
|
||||
class TopoDS_Edge;
|
||||
class gp_Lin;
|
||||
class gp_Circ;
|
||||
|
||||
|
||||
class AIS_FixRelation;
|
||||
DEFINE_STANDARD_HANDLE(AIS_FixRelation, AIS_Relation)
|
||||
|
||||
//! Constructs and manages a constraint by a fixed
|
||||
@@ -55,9 +34,8 @@ DEFINE_STANDARD_HANDLE(AIS_FixRelation, AIS_Relation)
|
||||
//! object.
|
||||
class AIS_FixRelation : public AIS_Relation
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_FixRelation, AIS_Relation)
|
||||
public:
|
||||
|
||||
|
||||
//! initializes the vertex aShape, the
|
||||
//! plane aPlane and the wire aWire, which connects
|
||||
@@ -98,16 +76,6 @@ public:
|
||||
//! to the object to display before computation !!!
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_FixRelation,AIS_Relation)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -141,11 +109,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <AIS_FixRelation.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_FixRelation_HeaderFile
|
||||
|
@@ -17,21 +17,14 @@
|
||||
#ifndef _AIS_IdenticRelation_HeaderFile
|
||||
#define _AIS_IdenticRelation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColStd_ListOfTransient.hxx>
|
||||
|
||||
class TopoDS_Shape;
|
||||
class Geom_Plane;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
class Geom_Line;
|
||||
class gp_Pnt;
|
||||
class Geom_Circle;
|
||||
@@ -40,8 +33,6 @@ class TopoDS_Wire;
|
||||
class TopoDS_Vertex;
|
||||
class gp_Dir;
|
||||
|
||||
|
||||
class AIS_IdenticRelation;
|
||||
DEFINE_STANDARD_HANDLE(AIS_IdenticRelation, AIS_Relation)
|
||||
|
||||
//! Constructs a constraint by a relation of identity
|
||||
|
@@ -37,7 +37,6 @@
|
||||
#include <Prs3d_PlaneAspect.hxx>
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <PrsMgr_ModedPresentation.hxx>
|
||||
#include <PrsMgr_PresentableObject.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
@@ -107,7 +106,6 @@ AIS_InteractiveContext::AIS_InteractiveContext(const Handle(V3d_Viewer)& MainVie
|
||||
myMainPM(new PrsMgr_PresentationManager3d(MainViewer->StructureManager())),
|
||||
myMainVwr(MainViewer),
|
||||
myMainSel(new StdSelect_ViewerSelector3d()),
|
||||
myWasLastMain(Standard_False),
|
||||
myToHilightSelected(Standard_True),
|
||||
mySelection(new AIS_Selection()),
|
||||
myFilters(new SelectMgr_OrFilter()),
|
||||
@@ -189,6 +187,29 @@ AIS_InteractiveContext::~AIS_InteractiveContext()
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LastActiveView
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(V3d_View) AIS_InteractiveContext::LastActiveView() const
|
||||
{
|
||||
if (myLastActiveView == NULL
|
||||
|| myMainVwr.IsNull())
|
||||
{
|
||||
return Handle(V3d_View)();
|
||||
}
|
||||
|
||||
// as a precaution - check that myLastActiveView pointer is a valid active View
|
||||
for (V3d_ListOfViewIterator aViewIter = myMainVwr->ActiveViewIterator(); aViewIter.More(); aViewIter.Next())
|
||||
{
|
||||
if (aViewIter.Value() == myLastActiveView)
|
||||
{
|
||||
return aViewIter.Value();
|
||||
}
|
||||
}
|
||||
return Handle(V3d_View)();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateCurrentViewer
|
||||
//purpose :
|
||||
@@ -426,8 +447,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
||||
setContextToObject (theIObj);
|
||||
if (!myObjects.IsBound (theIObj))
|
||||
{
|
||||
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
|
||||
myObjects.Bind (theIObj, aStatus);
|
||||
setObjectStatus (theIObj, AIS_DS_Displayed, theDispMode, theSelectionMode);
|
||||
myMainVwr->StructureManager()->RegisterObject (theIObj);
|
||||
myMainPM->Display(theIObj, theDispMode);
|
||||
if (theSelectionMode != -1)
|
||||
@@ -504,8 +524,7 @@ void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
{
|
||||
Standard_Integer aDispMode, aHiMod, aSelModeDef;
|
||||
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
|
||||
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
|
||||
myObjects.Bind (theIObj, aStatus);
|
||||
setObjectStatus (theIObj, AIS_DS_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
|
||||
myMainVwr->StructureManager()->RegisterObject (theIObj);
|
||||
}
|
||||
|
||||
@@ -756,7 +775,9 @@ Standard_Boolean AIS_InteractiveContext::IsHilighted (const Handle(SelectMgr_Ent
|
||||
return myObjects (anObj)->IsHilighted();
|
||||
}
|
||||
|
||||
return theOwner->IsSelected();
|
||||
const Handle(Prs3d_Drawer)& aStyle = getSelStyle (anObj, theOwner);
|
||||
const Standard_Integer aHiMode = getHilightMode (anObj, aStyle, -1);
|
||||
return theOwner->IsHilighted (myMainPM, aHiMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1663,20 +1684,20 @@ void AIS_InteractiveContext::SetWidth (const Handle(AIS_InteractiveObject)& theI
|
||||
setContextToObject (theIObj);
|
||||
theIObj->SetWidth (theWidth);
|
||||
theIObj->UpdatePresentations();
|
||||
if (!myLastinMain.IsNull() && myLastinMain->IsSameSelectable (theIObj))
|
||||
if (!myLastPicked.IsNull() && myLastPicked->IsSameSelectable (theIObj))
|
||||
{
|
||||
if (myLastinMain->IsAutoHilight())
|
||||
if (myLastPicked->IsAutoHilight())
|
||||
{
|
||||
const Standard_Integer aHiMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
|
||||
myLastinMain->HilightWithColor (myMainPM,
|
||||
myLastinMain->IsSelected() ? getSelStyle (theIObj, myLastinMain) : getHiStyle (theIObj, myLastinMain),
|
||||
myLastPicked->HilightWithColor (myMainPM,
|
||||
myLastPicked->IsSelected() ? getSelStyle (theIObj, myLastPicked) : getHiStyle (theIObj, myLastPicked),
|
||||
aHiMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
theIObj->HilightOwnerWithColor (myMainPM,
|
||||
myLastinMain->IsSelected() ? getSelStyle (theIObj, myLastinMain) : getHiStyle (theIObj, myLastinMain),
|
||||
myLastinMain);
|
||||
myLastPicked->IsSelected() ? getSelStyle (theIObj, myLastPicked) : getHiStyle (theIObj, myLastPicked),
|
||||
myLastPicked);
|
||||
}
|
||||
}
|
||||
if (theToUpdateViewer)
|
||||
@@ -1807,6 +1828,7 @@ void AIS_InteractiveContext::UnsetTransparency (const Handle(AIS_InteractiveObje
|
||||
void AIS_InteractiveContext::SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
|
||||
const Standard_Boolean theToUpdateViewer)
|
||||
{
|
||||
Standard_DISABLE_DEPRECATION_WARNINGS
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
@@ -1814,6 +1836,7 @@ void AIS_InteractiveContext::SetSelectedAspect (const Handle(Prs3d_BasicAspect)&
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
|
||||
anObj->SetAspect (theAspect);
|
||||
}
|
||||
Standard_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
if (isFound && theToUpdateViewer)
|
||||
{
|
||||
@@ -1936,42 +1959,18 @@ void AIS_InteractiveContext::GetDefModes (const Handle(AIS_InteractiveObject)& t
|
||||
void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const Standard_Boolean theToUpdateviewer)
|
||||
{
|
||||
Handle(AIS_GlobalStatus) aStatus;
|
||||
if (theIObj.IsNull()
|
||||
|| !myObjects.IsBound (theIObj))
|
||||
|| !myObjects.Find (theIObj, aStatus)
|
||||
|| aStatus->GraphicStatus() == AIS_DS_Erased)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
|
||||
|
||||
const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
|
||||
if (aStatus->GraphicStatus() == AIS_DS_Erased)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (aStatus->IsHilighted())
|
||||
{
|
||||
Standard_DISABLE_DEPRECATION_WARNINGS
|
||||
if (IsCurrent (theIObj))
|
||||
{
|
||||
AddOrRemoveCurrentObject (theIObj, Standard_False);
|
||||
}
|
||||
else if (myMainPM->IsHighlighted (theIObj, aStatus->DisplayMode()))
|
||||
{
|
||||
unhighlightGlobal (theIObj);
|
||||
}
|
||||
Standard_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
|
||||
unhighlightOwners (theIObj);
|
||||
myMainPM->SetVisibility (theIObj, aStatus->DisplayMode(), Standard_False);
|
||||
|
||||
if (aStatus->IsHilighted()
|
||||
&& theIObj->HasHilightMode())
|
||||
{
|
||||
unhighlightGlobal (theIObj);
|
||||
}
|
||||
|
||||
if (!myLastPicked.IsNull()
|
||||
&& myLastPicked->IsSameSelectable (theIObj))
|
||||
{
|
||||
@@ -2027,8 +2026,9 @@ void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObje
|
||||
void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const Standard_Boolean theToUpdateviewer)
|
||||
{
|
||||
Handle(AIS_GlobalStatus) aStatus;
|
||||
if (theIObj.IsNull()
|
||||
|| !myObjects.IsBound (theIObj))
|
||||
|| !myObjects.Find (theIObj, aStatus))
|
||||
{
|
||||
// for cases when reference shape of connected interactives was not displayed
|
||||
// but its selection primitives were calculated
|
||||
@@ -2037,7 +2037,6 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
|
||||
unhighlightOwners (theIObj);
|
||||
|
||||
myMainPM->Erase (theIObj, -1);
|
||||
@@ -2078,7 +2077,7 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity
|
||||
mgrSelector->Remove (anObj);
|
||||
|
||||
myObjects.UnBind (theIObj);
|
||||
setObjectStatus (theIObj, AIS_DS_None, -1, -1);
|
||||
myMainVwr->StructureManager()->UnregisterObject (theIObj);
|
||||
|
||||
for (V3d_ListOfViewIterator aDefViewIter (myMainVwr->DefinedViewIterator()); aDefViewIter.More(); aDefViewIter.Next())
|
||||
@@ -2086,13 +2085,11 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
aDefViewIter.Value()->View()->ChangeHiddenObjects()->Remove (theIObj.get());
|
||||
}
|
||||
|
||||
if (!myLastinMain.IsNull())
|
||||
if (!myLastPicked.IsNull())
|
||||
{
|
||||
if (myLastinMain->IsSameSelectable (theIObj)
|
||||
|| myLastPicked->IsSameSelectable(theIObj))
|
||||
if (myLastPicked->IsSameSelectable (theIObj))
|
||||
{
|
||||
clearDynamicHighlight();
|
||||
myLastinMain.Nullify();
|
||||
myLastPicked.Nullify();
|
||||
}
|
||||
}
|
||||
@@ -2146,15 +2143,12 @@ Standard_Boolean AIS_InteractiveContext::ClearDetected (Standard_Boolean theToRe
|
||||
myCurDetected = 0;
|
||||
myCurHighlighted = 0;
|
||||
myDetectedSeq.Clear();
|
||||
myLastPicked = myLastinMain;
|
||||
myWasLastMain = Standard_True;
|
||||
Standard_Boolean toUpdate = Standard_False;
|
||||
if (!myLastPicked.IsNull() && myLastPicked->HasSelectable())
|
||||
{
|
||||
toUpdate = Standard_True;
|
||||
clearDynamicHighlight();
|
||||
}
|
||||
myLastinMain.Nullify();
|
||||
myLastPicked.Nullify();
|
||||
myMainSel->ClearPicked();
|
||||
if (toUpdate && theToRedrawImmediate)
|
||||
@@ -2445,6 +2439,13 @@ void AIS_InteractiveContext::Disconnect (const Handle(AIS_InteractiveObject)& th
|
||||
{
|
||||
Handle(AIS_MultipleConnectedInteractive) theObj (Handle(AIS_MultipleConnectedInteractive)::DownCast (theAssembly));
|
||||
theObj->Disconnect (theObjToDisconnect);
|
||||
if (!myObjects.IsBound (theObjToDisconnect))
|
||||
{
|
||||
// connected presentation might contain displayed presentations
|
||||
myMainPM->Erase (theObjToDisconnect, -1);
|
||||
theObjToDisconnect->ErasePresentations (true);
|
||||
}
|
||||
|
||||
const Handle(SelectMgr_SelectableObject)& anObj = theObjToDisconnect; // to avoid ambiguity
|
||||
mgrSelector->Remove (anObj);
|
||||
}
|
||||
@@ -2469,12 +2470,10 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView)
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FitSelected
|
||||
//purpose : Fits the view corresponding to the bounds of selected objects
|
||||
//function : BoundingBoxOfSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
|
||||
const Standard_Real theMargin,
|
||||
const Standard_Boolean theToUpdate)
|
||||
Bnd_Box AIS_InteractiveContext::BoundingBoxOfSelection() const
|
||||
{
|
||||
Bnd_Box aBndSelected;
|
||||
AIS_MapOfObjectOwners anObjectOwnerMap;
|
||||
@@ -2513,12 +2512,22 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
|
||||
aBndSelected.Add (aTmpBox);
|
||||
}
|
||||
|
||||
anObjectOwnerMap.Clear();
|
||||
return aBndSelected;
|
||||
}
|
||||
|
||||
if (aBndSelected.IsVoid())
|
||||
return;
|
||||
|
||||
theView->FitAll (aBndSelected, theMargin, theToUpdate);
|
||||
//=======================================================================
|
||||
//function : FitSelected
|
||||
//purpose : Fits the view corresponding to the bounds of selected objects
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
|
||||
const Standard_Real theMargin,
|
||||
const Standard_Boolean theToUpdate)
|
||||
{
|
||||
Bnd_Box aBndSelected = BoundingBoxOfSelection();
|
||||
if (!aBndSelected.IsVoid())
|
||||
{
|
||||
theView->FitAll (aBndSelected, theMargin, theToUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -2544,3 +2553,38 @@ void AIS_InteractiveContext::SetTransformPersistence (const Handle(AIS_Interacti
|
||||
anActiveViewIter.Value()->View()->InvalidateZLayerBoundingBox (aLayerId);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GravityPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
gp_Pnt AIS_InteractiveContext::GravityPoint (const Handle(V3d_View)& theView) const
|
||||
{
|
||||
return theView->GravityPoint();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : setObjectStatus
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::setObjectStatus (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const AIS_DisplayStatus theStatus,
|
||||
const Standard_Integer theDispMode,
|
||||
const Standard_Integer theSelectionMode)
|
||||
{
|
||||
if (theStatus != AIS_DS_None)
|
||||
{
|
||||
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
|
||||
myObjects.Bind (theIObj, aStatus);
|
||||
}
|
||||
else
|
||||
myObjects.UnBind (theIObj);
|
||||
|
||||
for (PrsMgr_ListOfPresentableObjectsIter aPrsIter (theIObj->Children()); aPrsIter.More(); aPrsIter.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) aChild (Handle(AIS_InteractiveObject)::DownCast (aPrsIter.Value()));
|
||||
if (aChild.IsNull())
|
||||
continue;
|
||||
|
||||
setObjectStatus (aChild, theStatus, theDispMode, theSelectionMode);
|
||||
}
|
||||
}
|
||||
|
@@ -370,6 +370,9 @@ public: //! @name mouse picking logic (detection and dynamic highlighting of ent
|
||||
const Standard_Integer theMode,
|
||||
const Standard_Integer theNewSensitivity);
|
||||
|
||||
//! Returns last active View (argument of MoveTo()/Select() methods).
|
||||
Standard_EXPORT Handle(V3d_View) LastActiveView() const;
|
||||
|
||||
//! Relays mouse position in pixels theXPix and theYPix to the interactive context selectors.
|
||||
//! This is done by the view theView passing this position to the main viewer and updating it.
|
||||
//! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to highlight detected object.
|
||||
@@ -454,6 +457,7 @@ public: //! @name iteration through detected entities
|
||||
public: //! @name Selection management
|
||||
|
||||
//! Sets the graphic basic aspect to the current presentation of ALL selected objects.
|
||||
Standard_DEPRECATED ("Deprecated method - presentation attributes should be assigned directly to object")
|
||||
Standard_EXPORT void SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
|
||||
const Standard_Boolean theToUpdateViewer);
|
||||
|
||||
@@ -504,6 +508,9 @@ public: //! @name Selection management
|
||||
const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean theToUpdateViewer);
|
||||
|
||||
//! Returns bounding box of selected objects.
|
||||
Standard_EXPORT Bnd_Box BoundingBoxOfSelection() const;
|
||||
|
||||
//! Fits the view correspondingly to the bounds of selected objects.
|
||||
//! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
|
||||
Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView,
|
||||
@@ -556,6 +563,14 @@ public: //! @name Selection management
|
||||
Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& theObject,
|
||||
const Standard_Boolean theToUpdateViewer);
|
||||
|
||||
//! Updates Selected state of specified owner without calling HilightSelected().
|
||||
//! Has no effect if Selected state is not changed, and redirects to AddOrRemoveSelected() otherwise.
|
||||
//! @param theOwner owner object to set selected state
|
||||
//! @param theIsSelected new selected state
|
||||
//! @return TRUE if Selected state has been changed
|
||||
Standard_EXPORT Standard_Boolean SetSelectedState (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Standard_Boolean theIsSelected);
|
||||
|
||||
//! Highlights selected objects.
|
||||
Standard_EXPORT void HilightSelected (const Standard_Boolean theToUpdateViewer);
|
||||
|
||||
@@ -815,6 +830,9 @@ public: //! @name common properties
|
||||
//! returns the number of removed structures from the viewers.
|
||||
Standard_EXPORT Standard_Integer PurgeDisplay();
|
||||
|
||||
//! Return rotation gravity point.
|
||||
Standard_EXPORT virtual gp_Pnt GravityPoint (const Handle(V3d_View)& theView) const;
|
||||
|
||||
public: //! @name debug visualization
|
||||
|
||||
//! Visualization of sensitives - for debugging purposes!
|
||||
@@ -1339,19 +1357,27 @@ protected: //! @name internal methods
|
||||
//! Removes dynamic highlight draw
|
||||
void clearDynamicHighlight() const
|
||||
{
|
||||
if (myLastinMain.IsNull())
|
||||
if (myLastPicked.IsNull())
|
||||
return;
|
||||
|
||||
if (myLastinMain->IsAutoHilight())
|
||||
if (myLastPicked->IsAutoHilight())
|
||||
{
|
||||
myMainPM->ClearImmediateDraw();
|
||||
}
|
||||
else
|
||||
{
|
||||
myLastinMain->Selectable()->ClearDynamicHighlight (myMainPM);
|
||||
myLastPicked->Selectable()->ClearDynamicHighlight (myMainPM);
|
||||
}
|
||||
}
|
||||
|
||||
//! Bind/Unbind status to object and its children
|
||||
//! @param theObj [in] the object to change status
|
||||
//! @param theStatus status, if NULL, unbind object
|
||||
Standard_EXPORT void setObjectStatus (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const AIS_DisplayStatus theStatus,
|
||||
const Standard_Integer theDispyMode,
|
||||
const Standard_Integer theSelectionMode);
|
||||
|
||||
protected: //! @name internal fields
|
||||
|
||||
AIS_DataMapOfIOStatus myObjects;
|
||||
@@ -1359,9 +1385,8 @@ protected: //! @name internal fields
|
||||
Handle(PrsMgr_PresentationManager3d) myMainPM;
|
||||
Handle(V3d_Viewer) myMainVwr;
|
||||
Handle(StdSelect_ViewerSelector3d) myMainSel;
|
||||
V3d_View* myLastActiveView;
|
||||
Handle(SelectMgr_EntityOwner) myLastPicked;
|
||||
Handle(SelectMgr_EntityOwner) myLastinMain;
|
||||
Standard_Boolean myWasLastMain;
|
||||
Standard_Boolean myToHilightSelected;
|
||||
Handle(AIS_Selection) mySelection;
|
||||
Handle(SelectMgr_OrFilter) myFilters;
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <SelectBasics_SensitiveEntity.hxx>
|
||||
#include <Select3D_SensitiveEntity.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_Filter.hxx>
|
||||
#include <SelectMgr_OrFilter.hxx>
|
||||
@@ -184,7 +184,6 @@ void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsTo
|
||||
{
|
||||
anObjToClear.Add (anInteractive);
|
||||
}
|
||||
anOwner->SetSelected (Standard_False);
|
||||
if (anOwner == anInteractive->GlobalSelOwner())
|
||||
{
|
||||
myObjects.ChangeFind (anInteractive)->SetHilightStatus (Standard_False);
|
||||
@@ -326,10 +325,9 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
myCurDetected = 0;
|
||||
myCurHighlighted = 0;
|
||||
myDetectedSeq.Clear();
|
||||
myLastActiveView = theView.get();
|
||||
|
||||
// preliminaires
|
||||
myLastPicked = myLastinMain;
|
||||
myWasLastMain = Standard_True;
|
||||
AIS_StatusOfDetection aStatus = AIS_SOD_Nothing;
|
||||
Standard_Boolean toUpdateViewer = Standard_False;
|
||||
|
||||
@@ -399,7 +397,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
|
||||
// initialize myLastPicked field with currently detected object
|
||||
myLastPicked = aNewPickedOwner;
|
||||
myLastinMain = myLastPicked;
|
||||
|
||||
// highlight detected object if it is not selected or myToHilightSelected flag is true
|
||||
if (myLastPicked->HasSelectable())
|
||||
@@ -440,7 +437,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
toUpdateViewer = Standard_True;
|
||||
}
|
||||
|
||||
myLastinMain.Nullify();
|
||||
myLastPicked.Nullify();
|
||||
}
|
||||
|
||||
@@ -500,7 +496,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
|
||||
// all objects detected by the selector are taken, previous current objects are emptied,
|
||||
// new objects are put...
|
||||
ClearSelected (Standard_False);
|
||||
myWasLastMain = Standard_True;
|
||||
myLastActiveView = theView.get();
|
||||
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
|
||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
||||
{
|
||||
@@ -509,7 +505,6 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
|
||||
continue;
|
||||
|
||||
mySelection->Select (aCurOwner);
|
||||
aCurOwner->SetSelected (Standard_True);
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
@@ -541,7 +536,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
|
||||
// all objects detected by the selector are taken, previous current objects are emptied,
|
||||
// new objects are put...
|
||||
ClearSelected (Standard_False);
|
||||
myWasLastMain = Standard_True;
|
||||
myLastActiveView = theView.get();
|
||||
myMainSel->Pick (thePolyline, theView);
|
||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
||||
{
|
||||
@@ -550,7 +545,6 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
|
||||
continue;
|
||||
|
||||
mySelection->Select (anOwner);
|
||||
anOwner->SetSelected (Standard_True);
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
@@ -572,17 +566,28 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
|
||||
//=======================================================================
|
||||
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdateViewer)
|
||||
{
|
||||
if (myWasLastMain && !myLastinMain.IsNull())
|
||||
if (!myLastPicked.IsNull())
|
||||
{
|
||||
Graphic3d_Vec2i aMousePos (-1, -1);
|
||||
if (myMainSel->GetManager().GetActiveSelectionType() == SelectBasics_SelectingVolumeManager::Point)
|
||||
{
|
||||
aMousePos.SetValues ((Standard_Integer )myMainSel->GetManager().GetMousePosition().X(),
|
||||
(Standard_Integer )myMainSel->GetManager().GetMousePosition().Y());
|
||||
}
|
||||
if (myLastPicked->HandleMouseClick (aMousePos, Aspect_VKeyMouse_LeftButton, Aspect_VKeyFlags_NONE, false))
|
||||
{
|
||||
return AIS_SOP_NothingSelected;
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
clearDynamicHighlight();
|
||||
}
|
||||
if (!myLastinMain->IsSelected()
|
||||
|| myLastinMain->IsForcedHilight()
|
||||
if (!myLastPicked->IsSelected()
|
||||
|| myLastPicked->IsForcedHilight()
|
||||
|| NbSelected() > 1)
|
||||
{
|
||||
SetSelected (myLastinMain, Standard_False);
|
||||
SetSelected (myLastPicked, Standard_False);
|
||||
if(toUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
@@ -611,9 +616,9 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Boolean toU
|
||||
{
|
||||
clearDynamicHighlight();
|
||||
}
|
||||
if (myWasLastMain && !myLastinMain.IsNull())
|
||||
if (!myLastPicked.IsNull())
|
||||
{
|
||||
AddOrRemoveSelected (myLastinMain, toUpdateViewer);
|
||||
AddOrRemoveSelected (myLastPicked, toUpdateViewer);
|
||||
}
|
||||
|
||||
Standard_Integer aSelNum = NbSelected();
|
||||
@@ -639,11 +644,11 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
|
||||
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
|
||||
}
|
||||
|
||||
myLastActiveView = theView.get();
|
||||
if (myAutoHilight)
|
||||
{
|
||||
UnhilightSelected (Standard_False);
|
||||
}
|
||||
myWasLastMain = Standard_True;
|
||||
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
|
||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
||||
{
|
||||
@@ -651,8 +656,7 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
|
||||
continue;
|
||||
|
||||
AIS_SelectStatus aSelStatus = mySelection->Select (anOwner);
|
||||
anOwner->SetSelected (aSelStatus == AIS_SS_Added);
|
||||
mySelection->Select (anOwner);
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
@@ -681,11 +685,11 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d
|
||||
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
|
||||
}
|
||||
|
||||
myLastActiveView = theView.get();
|
||||
if (myAutoHilight)
|
||||
{
|
||||
UnhilightSelected (Standard_False);
|
||||
}
|
||||
myWasLastMain = Standard_True;
|
||||
myMainSel->Pick (thePolyline, theView);
|
||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
||||
{
|
||||
@@ -693,8 +697,7 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
|
||||
continue;
|
||||
|
||||
AIS_SelectStatus aSelStatus = mySelection->Select (anOwner);
|
||||
anOwner->SetSelected (aSelStatus == AIS_SS_Added);
|
||||
mySelection->Select (anOwner);
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
@@ -729,7 +732,6 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
|
||||
aState->SetHilightStatus (Standard_True);
|
||||
aState->SetHilightStyle (anObjSelStyle);
|
||||
}
|
||||
anOwner->SetSelected (Standard_True);
|
||||
if (!anOwner->IsAutoHilight())
|
||||
{
|
||||
NCollection_Handle<SelectMgr_SequenceOfOwner> aSeq;
|
||||
@@ -779,7 +781,6 @@ void AIS_InteractiveContext::UnhilightSelected (const Standard_Boolean theToUpda
|
||||
myObjects.ChangeFind (anObj)->SetHilightStatus (Standard_False);
|
||||
}
|
||||
|
||||
anOwner->SetSelected (Standard_False);
|
||||
anOwner->Unhilight (myMainPM);
|
||||
}
|
||||
|
||||
@@ -801,13 +802,6 @@ void AIS_InteractiveContext::ClearSelected (const Standard_Boolean theToUpdateVi
|
||||
{
|
||||
unhighlightSelected();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
aSelIter.Value()->SetSelected (Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
mySelection->Clear();
|
||||
if (myAutoHilight)
|
||||
@@ -833,7 +827,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
|
||||
if (!myObjects.IsBound (theObject))
|
||||
{
|
||||
Display (theObject, Standard_False);
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
|
||||
@@ -869,7 +863,6 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
{
|
||||
Unhilight (aSelectable, Standard_False);
|
||||
}
|
||||
aSelOwner->SetSelected (Standard_False);
|
||||
if (aSelOwner == aSelectable->GlobalSelOwner())
|
||||
{
|
||||
myObjects.ChangeFind (aSelectable)->SetHilightStatus (Standard_False);
|
||||
@@ -894,7 +887,6 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
HilightWithColor (theObject, anObjSelStyle, Standard_False);
|
||||
}
|
||||
}
|
||||
anOwner->SetSelected (Standard_True);
|
||||
|
||||
if (theToUpdateViewer)
|
||||
UpdateCurrentViewer();
|
||||
@@ -927,7 +919,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
|
||||
}
|
||||
|
||||
if (!myObjects.IsBound (anObject))
|
||||
Display (anObject, Standard_False);
|
||||
return;
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
@@ -941,12 +933,10 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
|
||||
if (!HighlightStyle (theOwner, aCustomStyle) ||
|
||||
(!aCustomStyle.IsNull() && aCustomStyle != anObjSelStyle))
|
||||
{
|
||||
theOwner->SetSelected (Standard_True);
|
||||
highlightSelected (theOwner);
|
||||
}
|
||||
}
|
||||
|
||||
theOwner->SetSelected (Standard_True);
|
||||
if (myAutoHilight && theOwner == anObject->GlobalSelOwner())
|
||||
{
|
||||
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObject);
|
||||
@@ -995,8 +985,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
||||
if (!myFilters->IsOk(theOwner) && !theOwner->IsSelected())
|
||||
return;
|
||||
|
||||
AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
|
||||
theOwner->SetSelected (aSelStat == AIS_SS_Added);
|
||||
mySelection->Select (theOwner);
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
@@ -1031,6 +1020,43 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetSelectedState
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean AIS_InteractiveContext::SetSelectedState (const Handle(SelectMgr_EntityOwner)& theEntity,
|
||||
const Standard_Boolean theIsSelected)
|
||||
{
|
||||
if (theEntity.IsNull())
|
||||
{
|
||||
throw Standard_ProgramError ("Internal error: AIS_InteractiveContext::SetSelectedState() called with NO object");
|
||||
}
|
||||
|
||||
if (!theEntity->HasSelectable()
|
||||
|| mySelection->IsSelected (theEntity) == theIsSelected)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (theEntity->IsAutoHilight())
|
||||
{
|
||||
AddOrRemoveSelected (theEntity, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (theIsSelected)
|
||||
{
|
||||
const AIS_SelectStatus aSelStatus = mySelection->AddSelect (theEntity);
|
||||
theEntity->SetSelected (true);
|
||||
return aSelStatus == AIS_SS_Added;
|
||||
}
|
||||
else
|
||||
{
|
||||
const AIS_SelectStatus aSelStatus = mySelection->Select (theEntity);
|
||||
theEntity->SetSelected (false);
|
||||
return aSelStatus == AIS_SS_Removed;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSelected
|
||||
@@ -1144,9 +1170,9 @@ void AIS_InteractiveContext::EntityOwners(Handle(SelectMgr_IndexedMapOfOwner)& t
|
||||
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
if (Handle(SelectBasics_SensitiveEntity) aEntity = aSelEntIter.Value()->BaseSensitive())
|
||||
if (Handle(Select3D_SensitiveEntity) aEntity = aSelEntIter.Value()->BaseSensitive())
|
||||
{
|
||||
if (Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast(aEntity->OwnerId()))
|
||||
if (const Handle(SelectMgr_EntityOwner)& aOwner = aEntity->OwnerId())
|
||||
{
|
||||
theOwners->Add (aOwner);
|
||||
}
|
||||
@@ -1201,7 +1227,6 @@ Standard_Integer AIS_InteractiveContext::HilightNextDetected (const Handle(V3d_V
|
||||
|
||||
highlightWithColor (anOwner, theView->Viewer());
|
||||
myLastPicked = anOwner;
|
||||
myLastinMain = myLastPicked;
|
||||
|
||||
if (theToRedrawImmediate)
|
||||
{
|
||||
@@ -1237,7 +1262,6 @@ Standard_Integer AIS_InteractiveContext::HilightPreviousDetected (const Handle(V
|
||||
|
||||
highlightWithColor (anOwner, theView->Viewer());
|
||||
myLastPicked = anOwner;
|
||||
myLastinMain = myLastPicked;
|
||||
|
||||
if (theToRedrawImmediate)
|
||||
{
|
||||
|
@@ -419,7 +419,7 @@ Standard_Boolean AIS_InteractiveContext::ImmediateAdd (const Handle(AIS_Interact
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myMainPM->AddToImmediateList (myMainPM->Presentation (theObj, theMode)->Presentation());
|
||||
myMainPM->AddToImmediateList (myMainPM->Presentation (theObj, theMode));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
@@ -16,32 +16,20 @@
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
|
||||
#include <AIS_GraphicTool.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Aspect_PolygonOffsetMode.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Graphic3d_BndBox4f.hxx>
|
||||
#include <Graphic3d_CStructure.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_MaterialAspect.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Prs3d_BasicAspect.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
#include <PrsMgr_ModedPresentation.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_InteractiveObject,SelectMgr_SelectableObject)
|
||||
|
||||
@@ -51,14 +39,9 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_InteractiveObject,SelectMgr_SelectableObject)
|
||||
//=======================================================================
|
||||
AIS_InteractiveObject::AIS_InteractiveObject (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
|
||||
: SelectMgr_SelectableObject (aTypeOfPresentation3d),
|
||||
myCTXPtr (NULL),
|
||||
myOwnWidth (0.0f),
|
||||
myCurrentFacingModel (Aspect_TOFM_BOTH_SIDE),
|
||||
myInfiniteState (Standard_False),
|
||||
hasOwnColor (Standard_False),
|
||||
hasOwnMaterial (Standard_False)
|
||||
myCTXPtr (NULL)
|
||||
{
|
||||
SetCurrentFacingModel();
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -73,22 +56,6 @@ void AIS_InteractiveObject::Redisplay (const Standard_Boolean AllModes)
|
||||
myCTXPtr->Redisplay (this, Standard_False, AllModes);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Type
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_KindOfInteractive AIS_InteractiveObject::Type() const
|
||||
{return AIS_KOI_None;}
|
||||
|
||||
//=======================================================================
|
||||
//function : Signature
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer AIS_InteractiveObject::Signature() const
|
||||
{return -1;}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
@@ -116,252 +83,6 @@ void AIS_InteractiveObject::SetContext (const Handle(AIS_InteractiveContext)& th
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_InteractiveObject::HasOwner() const
|
||||
{
|
||||
return (!myOwner.IsNull());
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::ClearOwner()
|
||||
{
|
||||
myOwner.Nullify();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDisplayMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetDisplayMode (const Standard_Integer theMode)
|
||||
{
|
||||
if (AcceptDisplayMode (theMode))
|
||||
{
|
||||
myDrawer->SetDisplayMode (theMode);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetCurrentFacingModel(const Aspect_TypeOfFacingModel aModel) {
|
||||
myCurrentFacingModel = aModel;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CurrentFacingModel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Aspect_TypeOfFacingModel AIS_InteractiveObject::CurrentFacingModel() const {
|
||||
return myCurrentFacingModel;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_InteractiveObject::SetColor(const Quantity_Color& theColor)
|
||||
{
|
||||
myDrawer->SetColor (theColor);
|
||||
hasOwnColor = Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UnsetColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::UnsetColor()
|
||||
{
|
||||
hasOwnColor = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetWidth(const Standard_Real aValue)
|
||||
{
|
||||
myOwnWidth = (Standard_ShortReal )aValue;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::UnsetWidth()
|
||||
{
|
||||
myOwnWidth = 0.0f;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Material
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Graphic3d_NameOfMaterial AIS_InteractiveObject::Material() const
|
||||
{
|
||||
return myDrawer->ShadingAspect()->Material().Name();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMaterial
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
|
||||
{
|
||||
if (!myDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
if (myDrawer->HasLink())
|
||||
{
|
||||
*myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect();
|
||||
}
|
||||
}
|
||||
|
||||
myDrawer->ShadingAspect()->SetMaterial (theMaterial);
|
||||
hasOwnMaterial = Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UnsetMaterial
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::UnsetMaterial()
|
||||
{
|
||||
if (!HasMaterial())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasColor() || IsTransparent())
|
||||
{
|
||||
if(myDrawer->HasLink())
|
||||
{
|
||||
myDrawer->ShadingAspect()->SetMaterial (AIS_GraphicTool::GetMaterial (myDrawer->Link()));
|
||||
}
|
||||
|
||||
if (HasColor())
|
||||
{
|
||||
SetColor (myDrawer->Color());
|
||||
}
|
||||
|
||||
if (IsTransparent())
|
||||
{
|
||||
SetTransparency (myDrawer->Transparency());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(Prs3d_ShadingAspect) anAspect;
|
||||
myDrawer->SetShadingAspect (anAspect);
|
||||
}
|
||||
|
||||
hasOwnMaterial = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTransparency
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetTransparency (const Standard_Real theValue)
|
||||
{
|
||||
if (!myDrawer->HasOwnShadingAspect())
|
||||
{
|
||||
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
|
||||
if(myDrawer->HasLink())
|
||||
myDrawer->ShadingAspect()->SetMaterial(AIS_GraphicTool::GetMaterial(myDrawer->Link()));
|
||||
}
|
||||
|
||||
myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (Standard_ShortReal(theValue));
|
||||
myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (Standard_ShortReal(theValue));
|
||||
myDrawer->SetTransparency (Standard_ShortReal(theValue));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UnsetTransparency
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::UnsetTransparency()
|
||||
{
|
||||
if(HasColor() || HasMaterial() )
|
||||
{
|
||||
myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (0.0f);
|
||||
myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (0.0f);
|
||||
}
|
||||
else{
|
||||
Handle (Prs3d_ShadingAspect) SA;
|
||||
myDrawer->SetShadingAspect(SA);
|
||||
}
|
||||
myDrawer->SetTransparency (0.0f);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Transparency
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real AIS_InteractiveObject::Transparency() const
|
||||
{
|
||||
return (myDrawer->Transparency() <= 0.005f ? 0.0 : myDrawer->Transparency());
|
||||
// Graphic3d_MaterialAspect Mat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
||||
// return Mat.Transparency();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UnsetAttributes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::UnsetAttributes()
|
||||
{
|
||||
SelectMgr_SelectableObject::UnsetAttributes();
|
||||
|
||||
hasOwnColor = Standard_False;
|
||||
hasOwnMaterial = Standard_False;
|
||||
myOwnWidth = 0.0f;
|
||||
myDrawer->SetTransparency (0.0f);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AcceptDisplayMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean AIS_InteractiveObject::AcceptDisplayMode(const Standard_Integer ) const
|
||||
{return Standard_True;}
|
||||
|
||||
//=======================================================================
|
||||
//function : DefaultDisplayMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer AIS_InteractiveObject::DefaultDisplayMode() const
|
||||
{return 0;}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetInfiniteState
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetInfiniteState(const Standard_Boolean aFlag)
|
||||
{
|
||||
myInfiniteState = aFlag;
|
||||
Handle(Prs3d_Presentation) P;
|
||||
|
||||
for(Standard_Integer i =1; i<=myPresentations.Length();i++)
|
||||
{
|
||||
P = myPresentations(i).Presentation()->Presentation();
|
||||
if(!P.IsNull())
|
||||
P->SetInfiniteState(myInfiniteState);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasPresentation
|
||||
//purpose :
|
||||
@@ -384,214 +105,41 @@ Handle(Prs3d_Presentation) AIS_InteractiveObject::Presentation() const
|
||||
}
|
||||
|
||||
Handle(PrsMgr_Presentation) aPrs = myCTXPtr->MainPrsMgr()->Presentation (this, myDrawer->DisplayMode(), false);
|
||||
return !aPrs.IsNull()
|
||||
? aPrs->Presentation()
|
||||
: Handle(Prs3d_Presentation)();
|
||||
return aPrs;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetAspect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetAspect(const Handle(Prs3d_BasicAspect)& anAspect)
|
||||
void AIS_InteractiveObject::SetAspect(const Handle(Prs3d_BasicAspect)& theAspect)
|
||||
{
|
||||
|
||||
if( HasPresentation() ) {
|
||||
Handle(Prs3d_Presentation) prs = Presentation();
|
||||
{ Handle(Prs3d_ShadingAspect) aspect =
|
||||
Handle(Prs3d_ShadingAspect)::DownCast(anAspect);
|
||||
if( !aspect.IsNull() ) {
|
||||
Prs3d_Root::CurrentGroup(prs)->SetGroupPrimitivesAspect(aspect->Aspect());
|
||||
return;
|
||||
}
|
||||
}
|
||||
{ Handle(Prs3d_LineAspect) aspect =
|
||||
Handle(Prs3d_LineAspect)::DownCast(anAspect);
|
||||
if( !aspect.IsNull() ) {
|
||||
Prs3d_Root::CurrentGroup(prs)->SetGroupPrimitivesAspect(aspect->Aspect());
|
||||
return;
|
||||
}
|
||||
}
|
||||
{ Handle(Prs3d_PointAspect) aspect =
|
||||
Handle(Prs3d_PointAspect)::DownCast(anAspect);
|
||||
if( !aspect.IsNull() ) {
|
||||
Prs3d_Root::CurrentGroup(prs)->SetGroupPrimitivesAspect(aspect->Aspect());
|
||||
return;
|
||||
}
|
||||
}
|
||||
{ Handle(Prs3d_TextAspect) aspect =
|
||||
Handle(Prs3d_TextAspect)::DownCast(anAspect);
|
||||
if( !aspect.IsNull() ) {
|
||||
Prs3d_Root::CurrentGroup(prs)->SetGroupPrimitivesAspect(aspect->Aspect());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPolygonOffsets
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetPolygonOffsets(const Standard_Integer aMode,
|
||||
const Standard_ShortReal aFactor,
|
||||
const Standard_ShortReal aUnits)
|
||||
{
|
||||
if ( !HasPolygonOffsets() )
|
||||
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
|
||||
|
||||
myDrawer->ShadingAspect()->Aspect()->SetPolygonOffsets( aMode, aFactor, aUnits );
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasPolygonOffsets
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_InteractiveObject::HasPolygonOffsets() const
|
||||
{
|
||||
return !( myDrawer->ShadingAspect().IsNull() ||
|
||||
( myDrawer->HasLink() &&
|
||||
myDrawer->ShadingAspect() == myDrawer->Link()->ShadingAspect() ) );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PolygonOffsets
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::PolygonOffsets(Standard_Integer& aMode,
|
||||
Standard_ShortReal& aFactor,
|
||||
Standard_ShortReal& aUnits) const
|
||||
{
|
||||
if( HasPolygonOffsets() )
|
||||
myDrawer->ShadingAspect()->Aspect()->PolygonOffsets( aMode, aFactor, aUnits );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BoundingBox
|
||||
//purpose : Returns bounding box of object correspondingly to its
|
||||
// current display mode
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::BoundingBox (Bnd_Box& theBndBox)
|
||||
{
|
||||
if (myDrawer->DisplayMode() == -1)
|
||||
{
|
||||
if (!myPresentations.IsEmpty())
|
||||
{
|
||||
const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations.First().Presentation();
|
||||
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
|
||||
const Graphic3d_BndBox3d& aBndBox = aStruct->CStructure()->BoundingBox();
|
||||
|
||||
if (!aBndBox.IsValid())
|
||||
{
|
||||
theBndBox.SetVoid();
|
||||
return;
|
||||
}
|
||||
|
||||
theBndBox.Update (aBndBox.CornerMin().x(), aBndBox.CornerMin().y(), aBndBox.CornerMin().z(),
|
||||
aBndBox.CornerMax().x(), aBndBox.CornerMax().y(), aBndBox.CornerMax().z());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (PrsMgr_ListOfPresentableObjectsIter aPrsIter (Children()); aPrsIter.More(); aPrsIter.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) aChild (Handle(AIS_InteractiveObject)::DownCast (aPrsIter.Value()));
|
||||
if (aChild.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Bnd_Box aBox;
|
||||
aChild->BoundingBox (aBox);
|
||||
theBndBox.Add (aBox);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
|
||||
{
|
||||
if (myPresentations (aPrsIter).Mode() == myDrawer->DisplayMode())
|
||||
{
|
||||
const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation();
|
||||
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
|
||||
const Graphic3d_BndBox3d& aBndBox = aStruct->CStructure()->BoundingBox();
|
||||
|
||||
if (!aBndBox.IsValid())
|
||||
{
|
||||
theBndBox.SetVoid();
|
||||
return;
|
||||
}
|
||||
|
||||
theBndBox.Update (aBndBox.CornerMin().x(), aBndBox.CornerMin().y(), aBndBox.CornerMin().z(),
|
||||
aBndBox.CornerMax().x(), aBndBox.CornerMax().y(), aBndBox.CornerMax().z());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetIsoOnTriangulation
|
||||
//purpose : Enables or disables isoline on triangulation building
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetIsoOnTriangulation (const Standard_Boolean theIsEnabled)
|
||||
{
|
||||
myDrawer->SetIsoOnTriangulation (theIsEnabled);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SynchronizeAspects
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SynchronizeAspects()
|
||||
{
|
||||
for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
|
||||
{
|
||||
const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue().Presentation();
|
||||
if (aPrs3d.IsNull()
|
||||
|| aPrs3d->Presentation().IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPrs3d->Presentation()->Groups()); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
if (!aGroupIter.Value().IsNull())
|
||||
{
|
||||
aGroupIter.ChangeValue()->SynchronizeAspects();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : replaceAspects
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::replaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap)
|
||||
{
|
||||
if (theMap.IsEmpty())
|
||||
if (!HasPresentation())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
|
||||
Handle(Prs3d_Presentation) aPrs = Presentation();
|
||||
if (aPrs->Groups().IsEmpty())
|
||||
{
|
||||
const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue().Presentation();
|
||||
if (aPrs3d.IsNull()
|
||||
|| aPrs3d->Presentation().IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPrs3d->Presentation()->Groups()); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
if (!aGroupIter.Value().IsNull())
|
||||
{
|
||||
aGroupIter.ChangeValue()->ReplaceAspects (theMap);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
const Handle(Graphic3d_Group)& aGroup = aPrs->Groups().Last();
|
||||
if (Handle(Prs3d_ShadingAspect) aShadingAspect = Handle(Prs3d_ShadingAspect)::DownCast(theAspect))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (aShadingAspect->Aspect());
|
||||
}
|
||||
else if (Handle(Prs3d_LineAspect) aLineAspect = Handle(Prs3d_LineAspect)::DownCast(theAspect))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (aLineAspect->Aspect());
|
||||
}
|
||||
else if (Handle(Prs3d_PointAspect) aPointAspect = Handle(Prs3d_PointAspect)::DownCast(theAspect))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (aPointAspect->Aspect());
|
||||
}
|
||||
else if (Handle(Prs3d_TextAspect) aTextAspect = Handle(Prs3d_TextAspect)::DownCast(theAspect))
|
||||
{
|
||||
aGroup->SetGroupPrimitivesAspect (aTextAspect->Aspect());
|
||||
}
|
||||
}
|
||||
|
@@ -17,139 +17,48 @@
|
||||
#ifndef _AIS_InteractiveObject_HeaderFile
|
||||
#define _AIS_InteractiveObject_HeaderFile
|
||||
|
||||
#include <Aspect_TypeOfFacingModel.hxx>
|
||||
#include <AIS_KindOfInteractive.hxx>
|
||||
#include <Graphic3d_NameOfMaterial.hxx>
|
||||
#include <PrsMgr_TypeOfPresentation3d.hxx>
|
||||
#include <SelectMgr_SelectableObject.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <TColStd_ListOfTransient.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
|
||||
class AIS_InteractiveContext;
|
||||
class Graphic3d_MaterialAspect;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_BasicAspect;
|
||||
class Bnd_Box;
|
||||
|
||||
//! Defines a class of objects with display and selection services.
|
||||
//! Entities which are visualized and selected are
|
||||
//! Interactive Objects. You can make use of classes of
|
||||
//! standard Interactive Objects for which all necessary
|
||||
//! methods have already been programmed, or you can
|
||||
//! implement your own classes of Interactive Objects.
|
||||
//! Specific attributes of entities such as arrow aspect for
|
||||
//! dimensions must be loaded in a Drawer. This Drawer
|
||||
//! is then applied to the Interactive Object in view.
|
||||
//! There are four types of Interactive Object in AIS: the
|
||||
//! construction element or Datum, the Relation, which
|
||||
//! includes both dimensions and constraints, the Object,
|
||||
//! and finally, when the object is of an unknown type, the None type.
|
||||
//! Inside these categories, a signature, or index,
|
||||
//! provides the possibility of additional characterization.
|
||||
//! By default, the Interactive Object has a None type
|
||||
//! and a signature of 0. If you want to give a particular
|
||||
//! type and signature to your interactive object, you must
|
||||
//! redefine the methods, Signature and Type.
|
||||
//! Warning
|
||||
//! In the case of attribute methods, methods for
|
||||
//! standard attributes are virtual. They must be
|
||||
//! redefined by the inheriting classes. Setcolor for a
|
||||
//! point and Setcolor for a plane, for example, do not
|
||||
//! affect the same attributes in the Drawer.
|
||||
//! Entities which are visualized and selected are Interactive Objects.
|
||||
//! Specific attributes of entities such as arrow aspect for dimensions must be loaded in a Prs3d_Drawer.
|
||||
//!
|
||||
//! You can make use of classes of standard Interactive Objects for which all necessary methods have already been programmed,
|
||||
//! or you can implement your own classes of Interactive Objects.
|
||||
//! Key interface methods to be implemented by every Interactive Object:
|
||||
//! * Presentable Object (PrsMgr_PresentableObject)
|
||||
//! Consider defining an enumeration of supported Display Mode indexes for particular Interactive Object or class of Interactive Objects.
|
||||
//! - AcceptDisplayMode() accepting display modes implemented by this object;
|
||||
//! - Compute() computing presentation for the given display mode index;
|
||||
//! * Selectable Object (SelectMgr_SelectableObject)
|
||||
//! Consider defining an enumeration of supported Selection Mode indexes for particular Interactive Object or class of Interactive Objects.
|
||||
//! - ComputeSelection() computing selectable entities for the given selection mode index.
|
||||
class AIS_InteractiveObject : public SelectMgr_SelectableObject
|
||||
{
|
||||
friend class AIS_InteractiveContext;
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_InteractiveObject, SelectMgr_SelectableObject)
|
||||
public:
|
||||
|
||||
//! Returns the kind of Interactive Object:
|
||||
//! - None
|
||||
//! - Datum
|
||||
//! - Relation
|
||||
//! - Object
|
||||
//! By default, the interactive object has a None type.
|
||||
//! Because specific shapes entail different behavior
|
||||
//! according to their sub-shapes, you may need to
|
||||
//! create a Local Context. This will allow you to
|
||||
//! specify the additional characteristics which you
|
||||
//! need to handle these shapes.
|
||||
Standard_EXPORT virtual AIS_KindOfInteractive Type() const;
|
||||
|
||||
//! Specifies additional characteristics of Interactive
|
||||
//! Objects. A signature is, in fact, an index with integer
|
||||
//! values assigned different properties.
|
||||
//! This method is frequently used in conjuction with
|
||||
//! Type to give a particular type and signature to an
|
||||
//! Interactive Object. By default, the Interactive Object
|
||||
//! has a None type and a signature of 0. Among the
|
||||
//! datums, this signature is attributed to the shape
|
||||
//! Returns the kind of Interactive Object; AIS_KOI_None by default.
|
||||
virtual AIS_KindOfInteractive Type() const { return AIS_KOI_None; }
|
||||
|
||||
//! Specifies additional characteristics of Interactive Object of Type(); -1 by default.
|
||||
//! Among the datums, this signature is attributed to the shape.
|
||||
//! The remaining datums have the following default signatures:
|
||||
//! - Point signature 1
|
||||
//! - Axis signature 2
|
||||
//! - Trihedron signature 3
|
||||
//! - PlaneTrihedron signature 4
|
||||
//! - Line signature 5
|
||||
//! - Circle signature 6
|
||||
//! - Plane signature 7.
|
||||
Standard_EXPORT virtual Standard_Integer Signature() const;
|
||||
|
||||
//! Informs the graphic context that the interactive Object
|
||||
//! may be decomposed into sub-shapes for dynamic selection.
|
||||
//! The most used Interactive Object is AIS_Shape.
|
||||
//! Activation methods for standard selection modes are
|
||||
//! proposed in the Interactive Context. These include
|
||||
//! selection by vertex or by edges. For datums with the
|
||||
//! same behavior as AIS_Shape, such as vetices and
|
||||
//! edges, we must redefine the virtual method so that
|
||||
//! AcceptShapeDecomposition returns false.
|
||||
//! Rule for selection :
|
||||
//! Mode 0 : Selection of the interactive Object itself
|
||||
//! Mode 1 : Selection of vertices
|
||||
//! Mode 2 : Selection Of Edges
|
||||
//! Mode 3 : Selection Of Wires
|
||||
//! Mode 4 : Selection Of Faces ...
|
||||
virtual Standard_Boolean AcceptShapeDecomposition() const { return Standard_False; }
|
||||
|
||||
//! change the current facing model apply on polygons for
|
||||
//! SetColor(), SetTransparency(), SetMaterial() methods
|
||||
//! default facing model is Aspect_TOFM_TWO_SIDE. This mean that attributes is
|
||||
//! applying both on the front and back face.
|
||||
Standard_EXPORT void SetCurrentFacingModel (const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE);
|
||||
|
||||
//! Returns the current facing model which is in effect.
|
||||
Standard_EXPORT Aspect_TypeOfFacingModel CurrentFacingModel() const;
|
||||
|
||||
//! Only the interactive object knowns which Drawer attribute is affected by the color, if any
|
||||
//! (ex: for a wire,it's the wireaspect field of the drawer, but for a vertex, only the point aspect field is affected by the color).
|
||||
//! WARNING : Do not forget to set the corresponding fields here (hasOwnColor and myDrawer->SetColor())
|
||||
Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Removes color settings. Only the Interactive Object
|
||||
//! knows which Drawer attribute is affected by the color
|
||||
//! setting. For a wire, for example, wire aspect is the
|
||||
//! attribute affected. For a vertex, however, only point
|
||||
//! aspect is affected by the color setting.
|
||||
Standard_EXPORT virtual void UnsetColor();
|
||||
|
||||
//! Allows you to provide the setting aValue for width.
|
||||
//! Only the Interactive Object knows which Drawer
|
||||
//! attribute is affected by the width setting.
|
||||
Standard_EXPORT virtual void SetWidth (const Standard_Real aValue);
|
||||
|
||||
Standard_EXPORT virtual void UnsetWidth();
|
||||
|
||||
//! Returns true if the class of objects accepts the display mode aMode.
|
||||
//! The interactive context can have a default mode of
|
||||
//! representation for the set of Interactive Objects. This
|
||||
//! mode may not be accepted by a given class of
|
||||
//! objects. Consequently, this virtual method allowing us
|
||||
//! to get information about the class in question must be implemented.
|
||||
Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const;
|
||||
|
||||
//! Returns the default display mode. This method is to
|
||||
//! be implemented when the main mode is not mode 0.
|
||||
Standard_EXPORT virtual Standard_Integer DefaultDisplayMode() const;
|
||||
//! - Point signature 1
|
||||
//! - Axis signature 2
|
||||
//! - Trihedron signature 3
|
||||
//! - PlaneTrihedron signature 4
|
||||
//! - Line signature 5
|
||||
//! - Circle signature 6
|
||||
//! - Plane signature 7.
|
||||
virtual Standard_Integer Signature() const { return -1; }
|
||||
|
||||
//! Updates the active presentation; if <AllModes> = Standard_True
|
||||
//! all the presentations inside are recomputed.
|
||||
@@ -158,33 +67,20 @@ public:
|
||||
//! is accessible. This method just redirects call to myCTXPtr,
|
||||
//! so this class field must be up to date for proper result.
|
||||
Standard_EXPORT void Redisplay (const Standard_Boolean AllModes = Standard_False);
|
||||
|
||||
//! Sets the infinite state flag aFlage.
|
||||
//! if <aFlag> = True , the interactiveObject is
|
||||
//! considered as infinite, i.e. its graphic presentations
|
||||
//! are not taken in account for View FitAll...
|
||||
Standard_EXPORT void SetInfiniteState (const Standard_Boolean aFlag = Standard_True);
|
||||
|
||||
//! Returns true if the interactive object is infinite. In this
|
||||
//! case, its graphic presentations are not taken into
|
||||
//! account in the fit-all view.
|
||||
Standard_Boolean IsInfinite() const { return myInfiniteState; }
|
||||
|
||||
//! Indicates whether the Interactive Object has a pointer to an interactive context.
|
||||
Standard_Boolean HasInteractiveContext() const { return myCTXPtr != NULL; }
|
||||
|
||||
//! Returns the context pointer to the interactive context.
|
||||
Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
|
||||
AIS_InteractiveContext* InteractiveContext() const { return myCTXPtr; }
|
||||
|
||||
//! Sets the interactive context aCtx and provides a link
|
||||
//! to the default drawing tool or "Drawer" if there is none.
|
||||
Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& aCtx);
|
||||
|
||||
//! Returns true if the object has an owner attributed to it.
|
||||
//! The owner can be a shape for a set of sub-shapes or
|
||||
//! a sub-shape for sub-shapes which it is composed of,
|
||||
//! and takes the form of a transient.
|
||||
Standard_EXPORT Standard_Boolean HasOwner() const;
|
||||
//! The owner can be a shape for a set of sub-shapes or a sub-shape for sub-shapes which it is composed of, and takes the form of a transient.
|
||||
Standard_Boolean HasOwner() const { return !myOwner.IsNull(); }
|
||||
|
||||
//! Returns the owner of the Interactive Object.
|
||||
//! The owner can be a shape for a set of sub-shapes or
|
||||
@@ -203,211 +99,35 @@ public:
|
||||
//! is composed of. The owner takes the form of a transient.
|
||||
void SetOwner (const Handle(Standard_Transient)& theApplicativeEntity) { myOwner = theApplicativeEntity; }
|
||||
|
||||
//! Each Interactive Object has methods which allow us
|
||||
//! to attribute an Owner to it in the form of a Transient.
|
||||
//! Each Interactive Object has methods which allow us to attribute an Owner to it in the form of a Transient.
|
||||
//! This method removes the owner from the graphic entity.
|
||||
Standard_EXPORT void ClearOwner();
|
||||
void ClearOwner() { myOwner.Nullify(); }
|
||||
|
||||
//! Returns true if the Interactive Object has a display
|
||||
//! mode setting. Otherwise, it is displayed in Neutral Point.
|
||||
Standard_Boolean HasDisplayMode() const { return myDrawer->DisplayMode() != -1; }
|
||||
public:
|
||||
|
||||
//! Sets the display mode aMode for the interactive object.
|
||||
//! An object can have its own temporary display mode,
|
||||
//! which is different from that proposed by the interactive context.
|
||||
//! The range of possibilities currently proposed is the following:
|
||||
//! - AIS_WireFrame
|
||||
//! - AIS_Shaded
|
||||
//! This range can, however, be extended through the creation of new display modes.
|
||||
Standard_EXPORT void SetDisplayMode (const Standard_Integer aMode);
|
||||
//! Returns the context pointer to the interactive context.
|
||||
Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
|
||||
|
||||
//! Removes display mode settings from the interactive object.
|
||||
void UnsetDisplayMode() { myDrawer->SetDisplayMode (-1); }
|
||||
|
||||
//! Returns the display mode setting of the Interactive Object.
|
||||
//! The range of possibilities is the following:
|
||||
//! - AIS_WireFrame
|
||||
//! - AIS_Shaded
|
||||
//! This range can, however, be extended through the
|
||||
//! creation of new display modes.
|
||||
Standard_Integer DisplayMode() const { return myDrawer->DisplayMode(); }
|
||||
|
||||
//! Returns true if the Interactive Object is in highlight mode.
|
||||
Standard_Boolean HasHilightMode() const { return !myHilightDrawer.IsNull() && myHilightDrawer->DisplayMode() != -1; }
|
||||
|
||||
//! Returns highlight display mode.
|
||||
//! This is obsolete method for backward compatibility - use ::HilightAttributes() and ::DynamicHilightAttributes() instead.
|
||||
Standard_Integer HilightMode() const { return !myHilightDrawer.IsNull() ? myHilightDrawer->DisplayMode() : -1; }
|
||||
|
||||
//! Sets highlight display mode.
|
||||
//! This is obsolete method for backward compatibility - use ::HilightAttributes() and ::DynamicHilightAttributes() instead.
|
||||
void SetHilightMode (const Standard_Integer theMode)
|
||||
{
|
||||
if (myHilightDrawer.IsNull())
|
||||
{
|
||||
myHilightDrawer = new Prs3d_Drawer();
|
||||
myHilightDrawer->Link (myDrawer);
|
||||
myHilightDrawer->SetAutoTriangulation (Standard_False);
|
||||
myHilightDrawer->SetColor (Quantity_NOC_GRAY80);
|
||||
myHilightDrawer->SetZLayer(Graphic3d_ZLayerId_UNKNOWN);
|
||||
}
|
||||
if (myDynHilightDrawer.IsNull())
|
||||
{
|
||||
myDynHilightDrawer = new Prs3d_Drawer();
|
||||
myDynHilightDrawer->Link (myDrawer);
|
||||
myDynHilightDrawer->SetColor (Quantity_NOC_CYAN1);
|
||||
myDynHilightDrawer->SetAutoTriangulation (Standard_False);
|
||||
myDynHilightDrawer->SetZLayer(Graphic3d_ZLayerId_Top);
|
||||
}
|
||||
myHilightDrawer ->SetDisplayMode (theMode);
|
||||
myDynHilightDrawer->SetDisplayMode (theMode);
|
||||
}
|
||||
|
||||
//! Unsets highlight display mode.
|
||||
void UnsetHilightMode()
|
||||
{
|
||||
if (!myHilightDrawer.IsNull())
|
||||
{
|
||||
myHilightDrawer->SetDisplayMode (-1);
|
||||
}
|
||||
if (!myDynHilightDrawer.IsNull())
|
||||
{
|
||||
myDynHilightDrawer->SetDisplayMode (-1);
|
||||
}
|
||||
}
|
||||
|
||||
//! Returns true if the Interactive Object has color.
|
||||
Standard_Boolean HasColor() const { return hasOwnColor; }
|
||||
|
||||
//! Returns the color setting of the Interactive Object.
|
||||
virtual void Color (Quantity_Color& theColor) const { theColor = myDrawer->Color(); }
|
||||
|
||||
//! Returns true if the Interactive Object has width.
|
||||
Standard_Boolean HasWidth() const { return myOwnWidth != 0.0f; }
|
||||
|
||||
//! Returns the width setting of the Interactive Object.
|
||||
Standard_Real Width() const { return myOwnWidth; }
|
||||
|
||||
//! Returns true if the Interactive Object has a setting for material.
|
||||
Standard_Boolean HasMaterial() const { return hasOwnMaterial; }
|
||||
|
||||
//! Returns the current material setting.
|
||||
//! This will be on of the following materials:
|
||||
//! - Brass
|
||||
//! - Bronze
|
||||
//! - Gold
|
||||
//! - Pewter
|
||||
//! - Silver
|
||||
//! - Stone.
|
||||
Standard_EXPORT virtual Graphic3d_NameOfMaterial Material() const;
|
||||
|
||||
//! Sets the material aMat defining this display attribute
|
||||
//! for the interactive object.
|
||||
//! Material aspect determines shading aspect, color and
|
||||
//! transparency of visible entities.
|
||||
Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& aName);
|
||||
|
||||
//! Removes the setting for material.
|
||||
Standard_EXPORT virtual void UnsetMaterial();
|
||||
|
||||
//! Attributes a setting aValue for transparency.
|
||||
//! The transparency value should be between 0.0 and 1.0.
|
||||
//! At 0.0 an object will be totally opaque, and at 1.0, fully transparent.
|
||||
//! Warning At a value of 1.0, there may be nothing visible.
|
||||
Standard_EXPORT virtual void SetTransparency (const Standard_Real aValue = 0.6);
|
||||
|
||||
//! Returns true if there is a transparency setting.
|
||||
Standard_Boolean IsTransparent() const { return myDrawer->Transparency() > 0.005f; }
|
||||
|
||||
//! Returns the transparency setting.
|
||||
//! This will be between 0.0 and 1.0.
|
||||
//! At 0.0 an object will be totally opaque, and at 1.0, fully transparent.
|
||||
Standard_EXPORT virtual Standard_Real Transparency() const;
|
||||
|
||||
//! Removes the transparency setting. The object is opaque by default.
|
||||
Standard_EXPORT virtual void UnsetTransparency();
|
||||
|
||||
//! Clears settings provided by the drawing tool aDrawer.
|
||||
Standard_EXPORT virtual void UnsetAttributes() Standard_OVERRIDE;
|
||||
|
||||
//! Returns TRUE when this object has a presentation
|
||||
//! in the current DisplayMode()
|
||||
//! Returns TRUE when this object has a presentation in the current DisplayMode()
|
||||
Standard_EXPORT Standard_Boolean HasPresentation() const;
|
||||
|
||||
//! Returns the current presentation of this object
|
||||
//! according to the current DisplayMode()
|
||||
|
||||
//! Returns the current presentation of this object according to the current DisplayMode()
|
||||
Standard_EXPORT Handle(Prs3d_Presentation) Presentation() const;
|
||||
|
||||
//! Sets the graphic basic aspect to the current presentation.
|
||||
Standard_DEPRECATED("Deprecated method, results might be undefined")
|
||||
Standard_EXPORT void SetAspect (const Handle(Prs3d_BasicAspect)& anAspect);
|
||||
|
||||
//! Sets up polygon offsets for this object.
|
||||
//! It modifies all existing presentations of <anObj> (if any),
|
||||
//! so it is reasonable to call this method after <anObj> has been displayed.
|
||||
//! Otherwise, Compute() method should pass Graphic3d_AspectFillArea3d
|
||||
//! aspect from <myDrawer> to Graphic3d_Group to make polygon offsets work.
|
||||
//!
|
||||
//! <aMode> parameter can contain various combinations of
|
||||
//! Aspect_PolygonOffsetMode enumeration elements (Aspect_POM_None means
|
||||
//! that polygon offsets are not changed).
|
||||
//! If <aMode> is different from Aspect_POM_Off and Aspect_POM_None, then <aFactor> and <aUnits>
|
||||
//! arguments are used by graphic renderer to calculate a depth offset value:
|
||||
//!
|
||||
//! offset = <aFactor> * m + <aUnits> * r, where
|
||||
//! m - maximum depth slope for the polygon currently being displayed,
|
||||
//! r - minimum window coordinates depth resolution (implementation-specific).
|
||||
//!
|
||||
//! Deafult settings for OCC 3D viewer: mode = Aspect_POM_Fill, factor = 1., units = 0.
|
||||
//!
|
||||
//! Negative offset values move polygons closer to the viewport,
|
||||
//! while positive values shift polygons away.
|
||||
//! Consult OpenGL reference for details (glPolygonOffset function description).
|
||||
//!
|
||||
//! NOTE: This method has a side effect - it creates own shading aspect
|
||||
//! if not yet created, so it is better to set up object material,
|
||||
//! color, etc. first.
|
||||
Standard_EXPORT virtual void SetPolygonOffsets (const Standard_Integer aMode, const Standard_ShortReal aFactor = 1.0, const Standard_ShortReal aUnits = 0.0);
|
||||
|
||||
//! Returns Standard_True if <myDrawer> has non-null shading aspect
|
||||
Standard_EXPORT virtual Standard_Boolean HasPolygonOffsets() const;
|
||||
|
||||
//! Retrieves current polygon offsets settings from <myDrawer>.
|
||||
Standard_EXPORT virtual void PolygonOffsets (Standard_Integer& aMode, Standard_ShortReal& aFactor, Standard_ShortReal& aUnits) const;
|
||||
|
||||
//! Returns bounding box of object correspondingly to its current display mode.
|
||||
Standard_EXPORT virtual void BoundingBox (Bnd_Box& theBndBox) Standard_OVERRIDE;
|
||||
|
||||
//! Enables or disables on-triangulation build of isolines according to the flag given.
|
||||
Standard_EXPORT void SetIsoOnTriangulation (const Standard_Boolean theIsEnabled);
|
||||
|
||||
//! Synchronize presentation aspects after their modification.
|
||||
//!
|
||||
//! This method should be called after modifying primitive aspect properties (material, texture, shader)
|
||||
//! so that modifications will take effect on already computed presentation groups (thus avoiding re-displaying the object).
|
||||
Standard_EXPORT void SynchronizeAspects();
|
||||
|
||||
protected:
|
||||
|
||||
//! Replace aspects of existing (computed) presentation groups,
|
||||
//! so that the new aspects can be applied without recomputing presentation.
|
||||
//! It is NOT recommended approach, because user has to fill such map and then search for each occurrence in computed groups.
|
||||
//! The recommended approach is computing presentation with necessary customized aspects,
|
||||
//! and then modify them directly followed by SynchronizeAspects() call.
|
||||
Standard_EXPORT void replaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap);
|
||||
|
||||
//! The TypeOfPresention3d means that the interactive object
|
||||
//! may have a presentation dependant of the view of Display.
|
||||
Standard_EXPORT AIS_InteractiveObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
|
||||
|
||||
protected:
|
||||
|
||||
AIS_InteractiveContext* myCTXPtr;
|
||||
Handle(Standard_Transient) myOwner;
|
||||
Standard_ShortReal myOwnWidth;
|
||||
Aspect_TypeOfFacingModel myCurrentFacingModel;
|
||||
Standard_Boolean myInfiniteState;
|
||||
Standard_Boolean hasOwnColor;
|
||||
Standard_Boolean hasOwnMaterial;
|
||||
AIS_InteractiveContext* myCTXPtr; //!< pointer to Interactive Context, where object is currently displayed; @sa SetContext()
|
||||
Handle(Standard_Transient) myOwner; //!< application-specific owner object
|
||||
|
||||
};
|
||||
|
||||
|
@@ -18,37 +18,13 @@
|
||||
#include <AIS_Dimension.hxx>
|
||||
#include <AIS_KindOfDimension.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_Transformation.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_Projector.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
class TopoDS_Face;
|
||||
class TCollection_ExtendedString;
|
||||
class gp_Pnt;
|
||||
class TopoDS_Edge;
|
||||
class TopoDS_Shape;
|
||||
class Geom_Plane;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
class SelectMgr_Selection;
|
||||
class Bnd_Box;
|
||||
class gp_Dir;
|
||||
class TopoDS_Vertex;
|
||||
class Standard_Transient;
|
||||
class AIS_LengthDimension;
|
||||
|
||||
DEFINE_STANDARD_HANDLE (AIS_LengthDimension, AIS_Dimension)
|
||||
|
||||
|
@@ -85,7 +85,7 @@ namespace
|
||||
{
|
||||
public:
|
||||
//! Main constructor.
|
||||
ManipSensCircle (const Handle(SelectBasics_EntityOwner)& theOwnerId,
|
||||
ManipSensCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const Handle(Geom_Circle)& theCircle,
|
||||
const Standard_Integer theNbPnts)
|
||||
: Select3D_SensitiveCircle (theOwnerId, theCircle, Standard_False, theNbPnts),
|
||||
@@ -104,7 +104,7 @@ namespace
|
||||
class ManipSensTriangulation : public Select3D_SensitiveTriangulation, public ManipSensRotation
|
||||
{
|
||||
public:
|
||||
ManipSensTriangulation (const Handle(SelectBasics_EntityOwner)& theOwnerId,
|
||||
ManipSensTriangulation (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const Handle(Poly_Triangulation)& theTrg,
|
||||
const gp_Dir& thePlaneNormal)
|
||||
: Select3D_SensitiveTriangulation (theOwnerId, theTrg, TopLoc_Location(), Standard_True),
|
||||
@@ -702,7 +702,20 @@ void AIS_Manipulator::Transform (const gp_Trsf& theTrsf)
|
||||
NCollection_Sequence<gp_Trsf>::Iterator aTrsfIter (myStartTrsfs);
|
||||
for (; anObjIter.More(); anObjIter.Next(), aTrsfIter.Next())
|
||||
{
|
||||
anObjIter.ChangeValue()->SetLocalTransformation (theTrsf * aTrsfIter.Value());
|
||||
const Handle(AIS_InteractiveObject)& anObj = anObjIter.ChangeValue();
|
||||
const gp_Trsf& anOldTrsf = aTrsfIter.Value();
|
||||
const Handle(Geom_Transformation)& aParentTrsf = anObj->CombinedParentTransformation();
|
||||
if (!aParentTrsf.IsNull()
|
||||
&& aParentTrsf->Form() != gp_Identity)
|
||||
{
|
||||
// recompute local transformation relative to parent transformation
|
||||
const gp_Trsf aNewLocalTrsf = aParentTrsf->Trsf().Inverted() * theTrsf * aParentTrsf->Trsf() * anOldTrsf;
|
||||
anObj->SetLocalTransformation (aNewLocalTrsf);
|
||||
}
|
||||
else
|
||||
{
|
||||
anObj->SetLocalTransformation (theTrsf * anOldTrsf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1022,15 +1035,21 @@ void AIS_Manipulator::HilightOwnerWithColor (const Handle(PrsMgr_PresentationMan
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
aPresentation->CStructure()->ViewAffinity = thePM->StructureManager()->ObjectAffinity (Handle(Standard_Transient) (this));
|
||||
|
||||
if (anOwner->Mode() == AIS_MM_TranslationPlane)
|
||||
{
|
||||
Handle(Prs3d_Drawer) aStyle = new Prs3d_Drawer();
|
||||
aStyle->SetColor(myAxes[anOwner->Index()].Color());
|
||||
aStyle->SetTransparency(0.5);
|
||||
aPresentation->Highlight(aStyle);
|
||||
aStyle->SetColor (myAxes[anOwner->Index()].Color());
|
||||
aStyle->SetTransparency (0.5);
|
||||
aPresentation->Highlight (aStyle);
|
||||
}
|
||||
else
|
||||
aPresentation->Highlight(theStyle);
|
||||
{
|
||||
aPresentation->Highlight (theStyle);
|
||||
}
|
||||
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPresentation->Groups());
|
||||
aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
|
@@ -17,38 +17,19 @@
|
||||
#ifndef _AIS_MaxRadiusDimension_HeaderFile
|
||||
#define _AIS_MaxRadiusDimension_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <AIS_EllipseRadiusDimension.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <DsgPrs_ArrowSide.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
class Standard_ConstructionError;
|
||||
class TopoDS_Shape;
|
||||
class TCollection_ExtendedString;
|
||||
class gp_Pnt;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
|
||||
|
||||
class AIS_MaxRadiusDimension;
|
||||
DEFINE_STANDARD_HANDLE(AIS_MaxRadiusDimension, AIS_EllipseRadiusDimension)
|
||||
|
||||
|
||||
//! Ellipse Max radius dimension of a Shape which can be Edge
|
||||
//! or Face (planar or cylindrical(surface of extrusion or
|
||||
//! surface of offset))
|
||||
class AIS_MaxRadiusDimension : public AIS_EllipseRadiusDimension
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_MaxRadiusDimension, AIS_EllipseRadiusDimension)
|
||||
public:
|
||||
|
||||
|
||||
//! Max Ellipse radius dimension
|
||||
//! Shape can be edge , planar face or cylindrical face
|
||||
Standard_EXPORT AIS_MaxRadiusDimension(const TopoDS_Shape& aShape, const Standard_Real aVal, const TCollection_ExtendedString& aText);
|
||||
@@ -66,19 +47,8 @@ public:
|
||||
//! to the object to display before computation !!!
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_MaxRadiusDimension,AIS_EllipseRadiusDimension)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
@@ -93,13 +63,6 @@ private:
|
||||
gp_Pnt myApexN;
|
||||
gp_Pnt myEndOfArrow;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_MaxRadiusDimension_HeaderFile
|
||||
|
250
src/AIS/AIS_MediaPlayer.cxx
Normal file
250
src/AIS/AIS_MediaPlayer.cxx
Normal file
@@ -0,0 +1,250 @@
|
||||
// Created by: Kirill GAVRILOV
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <AIS_MediaPlayer.hxx>
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Media_PlayerContext.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_MediaTexture.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_MediaPlayer, AIS_InteractiveObject)
|
||||
|
||||
//! Create an array of triangles defining a rectangle.
|
||||
static Handle(Graphic3d_ArrayOfTriangles) createRectangleArray (const Graphic3d_Vec2i& theLower,
|
||||
const Graphic3d_Vec2i& theUpper,
|
||||
Graphic3d_ArrayFlags theFlags)
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfTriangles) aRectTris = new Graphic3d_ArrayOfTriangles (4, 6, theFlags);
|
||||
aRectTris->AddVertex (gp_Pnt (theLower.x(), theLower.y(), 0.0), gp_Pnt2d (0.0, 1.0));
|
||||
aRectTris->AddVertex (gp_Pnt (theLower.x(), theUpper.y(), 0.0), gp_Pnt2d (0.0, 0.0));
|
||||
aRectTris->AddVertex (gp_Pnt (theUpper.x(), theUpper.y(), 0.0), gp_Pnt2d (1.0, 0.0));
|
||||
aRectTris->AddVertex (gp_Pnt (theUpper.x(), theLower.y(), 0.0), gp_Pnt2d (1.0, 1.0));
|
||||
aRectTris->AddEdges (1, 2, 3);
|
||||
aRectTris->AddEdges (1, 3, 4);
|
||||
return aRectTris;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : AIS_MediaPlayer
|
||||
// Purpose :
|
||||
//================================================================
|
||||
AIS_MediaPlayer::AIS_MediaPlayer()
|
||||
: myFramePair (new Graphic3d_MediaTextureSet()),
|
||||
myFrameSize (1, 1),
|
||||
myToClosePlayer (false)
|
||||
{
|
||||
SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
|
||||
SetZLayer (Graphic3d_ZLayerId_TopOSD);
|
||||
SetInfiniteState (true);
|
||||
|
||||
Graphic3d_MaterialAspect aMat;
|
||||
myFrameAspect = new Graphic3d_AspectFillArea3d (Aspect_IS_SOLID, Quantity_NOC_WHITE, Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0f, aMat, aMat);
|
||||
myFrameAspect->SetShadingModel (Graphic3d_TOSM_UNLIT);
|
||||
myFrameAspect->SetTextureMapOn (true);
|
||||
myFrameAspect->SetTextureSet (myFramePair);
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : ~AIS_MediaPlayer
|
||||
// Purpose :
|
||||
//================================================================
|
||||
AIS_MediaPlayer::~AIS_MediaPlayer()
|
||||
{
|
||||
// stop threads
|
||||
myFramePair.Nullify();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenInput
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_MediaPlayer::OpenInput (const TCollection_AsciiString& thePath,
|
||||
Standard_Boolean theToWait)
|
||||
{
|
||||
if (myFramePair->PlayerContext().IsNull()
|
||||
&& thePath.IsEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myFramePair->OpenInput (thePath, theToWait);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : PresentFrame
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool AIS_MediaPlayer::PresentFrame (const Graphic3d_Vec2i& theLeftCorner,
|
||||
const Graphic3d_Vec2i& theMaxSize)
|
||||
{
|
||||
if (myToClosePlayer)
|
||||
{
|
||||
myToClosePlayer = false;
|
||||
if (!HasInteractiveContext())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!myFramePair->PlayerContext().IsNull())
|
||||
{
|
||||
myFramePair->PlayerContext()->Pause();
|
||||
}
|
||||
|
||||
Handle(AIS_InteractiveContext) aCtx = GetContext();
|
||||
Handle(AIS_InteractiveObject) aThis = this;
|
||||
aCtx->Remove (aThis, false);
|
||||
aCtx->CurrentViewer()->Invalidate();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (myFramePair->PlayerContext().IsNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool toRedraw = myFramePair->SwapFrames();
|
||||
toRedraw = updateSize (theLeftCorner, theMaxSize) || toRedraw;
|
||||
if (toRedraw)
|
||||
{
|
||||
myFrameAspect->SetShaderProgram (myFramePair->ShaderProgram());
|
||||
SynchronizeAspects();
|
||||
}
|
||||
return toRedraw;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : updateSize
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool AIS_MediaPlayer::updateSize (const Graphic3d_Vec2i& theLeftCorner,
|
||||
const Graphic3d_Vec2i& theMaxSize)
|
||||
{
|
||||
const Graphic3d_Vec2i aFrameSize = myFramePair->FrameSize();
|
||||
Graphic3d_Vec2i aNewPos = theLeftCorner;
|
||||
Graphic3d_Vec2i aNewSize = myFrameSize;
|
||||
if (aFrameSize.x() > 0
|
||||
&& aFrameSize.y() > 0)
|
||||
{
|
||||
const double anAspect = double(theMaxSize.x()) / double(theMaxSize.y());
|
||||
const double aFitAspect = double(aFrameSize.x()) / double(aFrameSize.y());
|
||||
aNewSize = aFrameSize;
|
||||
if (aFitAspect >= anAspect)
|
||||
{
|
||||
aNewSize.y() = int(double(aFrameSize.x()) / aFitAspect);
|
||||
}
|
||||
else
|
||||
{
|
||||
aNewSize.x() = int(double(aFrameSize.y()) * aFitAspect);
|
||||
}
|
||||
|
||||
for (int aCoord = 0; aCoord < 2; ++aCoord)
|
||||
{
|
||||
if (aNewSize[aCoord] > theMaxSize[aCoord])
|
||||
{
|
||||
const double aScale = double(theMaxSize[aCoord]) / double(aNewSize[aCoord]);
|
||||
aNewSize.x() = int(double(aNewSize.x()) * aScale);
|
||||
aNewSize.y() = int(double(aNewSize.y()) * aScale);
|
||||
}
|
||||
}
|
||||
|
||||
aNewPos = theLeftCorner + theMaxSize / 2 - aNewSize / 2;
|
||||
}
|
||||
else if (myFrameSize.x() < 2
|
||||
|| myFrameSize.y() < 2)
|
||||
{
|
||||
aNewSize = theMaxSize;
|
||||
}
|
||||
|
||||
if (myFrameSize == aNewSize
|
||||
&& myFrameBottomLeft == aNewPos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
myFrameSize = aNewSize;
|
||||
myFrameBottomLeft = aNewPos;
|
||||
if (HasInteractiveContext())
|
||||
{
|
||||
SetToUpdate();
|
||||
GetContext()->Redisplay (this, false);
|
||||
GetContext()->CurrentViewer()->Invalidate();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : PlayPause
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_MediaPlayer::PlayPause()
|
||||
{
|
||||
if (myFramePair->PlayerContext().IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Real aProgress = 0.0, aDuration = 0.0;
|
||||
bool isPaused = false;
|
||||
myFramePair->PlayerContext()->PlayPause (isPaused, aProgress, aDuration);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Compute
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_MediaPlayer::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
thePrs->SetInfiniteState (IsInfinite());
|
||||
if (theMode != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// main frame
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris = createRectangleArray (myFrameBottomLeft, myFrameBottomLeft + myFrameSize, Graphic3d_ArrayFlags_VertexTexel);
|
||||
Handle(Graphic3d_Group) aMainGroup = thePrs->NewGroup();
|
||||
aMainGroup->SetGroupPrimitivesAspect (myFrameAspect);
|
||||
aMainGroup->AddPrimitiveArray (aTris);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ComputeSelection
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_MediaPlayer::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (theMode != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris = createRectangleArray (myFrameBottomLeft, myFrameBottomLeft + myFrameSize, Graphic3d_ArrayFlags_None);
|
||||
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this, 5);
|
||||
Handle(Select3D_SensitivePrimitiveArray) aSens = new Select3D_SensitivePrimitiveArray (anOwner);
|
||||
aSens->InitTriangulation (aTris->Attributes(), aTris->Indices(), TopLoc_Location());
|
||||
theSel->Add (aSens);
|
||||
}
|
96
src/AIS/AIS_MediaPlayer.hxx
Normal file
96
src/AIS/AIS_MediaPlayer.hxx
Normal file
@@ -0,0 +1,96 @@
|
||||
// Created by: Kirill GAVRILOV
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_MediaPlayer_HeaderFile
|
||||
#define _AIS_MediaPlayer_HeaderFile
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Graphic3d_MediaTextureSet.hxx>
|
||||
|
||||
class Media_PlayerContext;
|
||||
|
||||
//! Presentation for video playback.
|
||||
class AIS_MediaPlayer : public AIS_InteractiveObject
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_MediaPlayer, AIS_InteractiveObject)
|
||||
public:
|
||||
|
||||
//! Empty constructor.
|
||||
Standard_EXPORT AIS_MediaPlayer();
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~AIS_MediaPlayer();
|
||||
|
||||
//! Setup callback to be called on queue progress (e.g. when new frame should be displayed).
|
||||
void SetCallback (Graphic3d_MediaTextureSet::CallbackOnUpdate_t theCallbackFunction, void* theCallbackUserPtr)
|
||||
{
|
||||
myFramePair->SetCallback (theCallbackFunction, theCallbackUserPtr);
|
||||
}
|
||||
|
||||
//! Open specified file.
|
||||
Standard_EXPORT void OpenInput (const TCollection_AsciiString& thePath,
|
||||
Standard_Boolean theToWait);
|
||||
|
||||
//! Display new frame.
|
||||
Standard_EXPORT bool PresentFrame (const Graphic3d_Vec2i& theLeftCorner,
|
||||
const Graphic3d_Vec2i& theMaxSize);
|
||||
|
||||
//! Return player context.
|
||||
const Handle(Media_PlayerContext)& PlayerContext() const { return myFramePair->PlayerContext(); }
|
||||
|
||||
//! Switch playback state.
|
||||
Standard_EXPORT void PlayPause();
|
||||
|
||||
//! Schedule player to be closed.
|
||||
void SetClosePlayer()
|
||||
{
|
||||
myToClosePlayer = true;
|
||||
myFramePair->Notify();
|
||||
}
|
||||
|
||||
//! Return duration.
|
||||
double Duration() const { return myFramePair->Duration(); }
|
||||
|
||||
//! @name AIS_InteractiveObject interface
|
||||
protected:
|
||||
|
||||
//! Accept only display mode 0.
|
||||
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
|
||||
|
||||
//! Compute presentation.
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Compute selection
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Update frame size.
|
||||
Standard_EXPORT bool updateSize (const Graphic3d_Vec2i& theLeftCorner,
|
||||
const Graphic3d_Vec2i& theMaxSize);
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_MediaTextureSet) myFramePair;
|
||||
Handle(Graphic3d_AspectFillArea3d) myFrameAspect;
|
||||
Graphic3d_Vec2i myFrameBottomLeft;
|
||||
Graphic3d_Vec2i myFrameSize;
|
||||
bool myToClosePlayer;
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_MediaPlayer_HeaderFile
|
@@ -16,37 +16,22 @@
|
||||
#ifndef _AIS_MidPointRelation_HeaderFile
|
||||
#define _AIS_MidPointRelation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
class TopoDS_Shape;
|
||||
|
||||
class Geom_Plane;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
class gp_Lin;
|
||||
class gp_Pnt;
|
||||
class gp_Circ;
|
||||
class gp_Elips;
|
||||
|
||||
|
||||
class AIS_MidPointRelation;
|
||||
DEFINE_STANDARD_HANDLE(AIS_MidPointRelation, AIS_Relation)
|
||||
|
||||
//! presentation of equal distance to point myMidPoint
|
||||
class AIS_MidPointRelation : public AIS_Relation
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_MidPointRelation, AIS_Relation)
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT AIS_MidPointRelation(const TopoDS_Shape& aSymmTool, const TopoDS_Shape& FirstShape, const TopoDS_Shape& SecondShape, const Handle(Geom_Plane)& aPlane);
|
||||
|
||||
virtual Standard_Boolean IsMovable() const Standard_OVERRIDE;
|
||||
@@ -64,19 +49,8 @@ public:
|
||||
//! to the object to display before computation !!!
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_MidPointRelation,AIS_Relation)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
@@ -118,14 +92,8 @@ private:
|
||||
gp_Pnt mySecondPnt1;
|
||||
gp_Pnt mySecondPnt2;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <AIS_MidPointRelation.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_MidPointRelation_HeaderFile
|
||||
|
@@ -17,26 +17,9 @@
|
||||
#ifndef _AIS_MinRadiusDimension_HeaderFile
|
||||
#define _AIS_MinRadiusDimension_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <AIS_EllipseRadiusDimension.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <DsgPrs_ArrowSide.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
class Standard_ConstructionError;
|
||||
class TopoDS_Shape;
|
||||
class TCollection_ExtendedString;
|
||||
class gp_Pnt;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
|
||||
|
||||
class AIS_MinRadiusDimension;
|
||||
DEFINE_STANDARD_HANDLE(AIS_MinRadiusDimension, AIS_EllipseRadiusDimension)
|
||||
|
||||
//! -- Ellipse Min radius dimension of a Shape which
|
||||
@@ -44,10 +27,9 @@ DEFINE_STANDARD_HANDLE(AIS_MinRadiusDimension, AIS_EllipseRadiusDimension)
|
||||
//! extrusion or surface of offset))
|
||||
class AIS_MinRadiusDimension : public AIS_EllipseRadiusDimension
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_MinRadiusDimension, AIS_EllipseRadiusDimension)
|
||||
public:
|
||||
|
||||
|
||||
//! Max Ellipse radius dimension
|
||||
//! Shape can be edge , planar face or cylindrical face
|
||||
Standard_EXPORT AIS_MinRadiusDimension(const TopoDS_Shape& aShape, const Standard_Real aVal, const TCollection_ExtendedString& aText);
|
||||
@@ -65,18 +47,7 @@ public:
|
||||
//! to the object to display before computation !!!
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_MinRadiusDimension,AIS_EllipseRadiusDimension)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
@@ -92,13 +63,6 @@ private:
|
||||
gp_Pnt myApexN;
|
||||
gp_Pnt myEndOfArrow;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_MinRadiusDimension_HeaderFile
|
||||
|
36
src/AIS/AIS_MouseGesture.hxx
Normal file
36
src/AIS/AIS_MouseGesture.hxx
Normal file
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_MouseGesture_HeaderFile
|
||||
#define _AIS_MouseGesture_HeaderFile
|
||||
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
//! Mouse gesture - only one can be active at one moment.
|
||||
enum AIS_MouseGesture
|
||||
{
|
||||
AIS_MouseGesture_NONE, //!< no active gesture
|
||||
//
|
||||
AIS_MouseGesture_SelectRectangle, //!< rectangular selection
|
||||
AIS_MouseGesture_SelectLasso, //!< polygonal selection
|
||||
//
|
||||
AIS_MouseGesture_Zoom, //!< view zoom gesture
|
||||
AIS_MouseGesture_Pan, //!< view panning gesture
|
||||
AIS_MouseGesture_RotateOrbit, //!< orbit rotation gesture
|
||||
AIS_MouseGesture_RotateView, //!< view rotation gesture
|
||||
};
|
||||
|
||||
//! Map defining mouse gestures.
|
||||
typedef NCollection_DataMap<unsigned int, AIS_MouseGesture> AIS_MouseGestureMap;
|
||||
|
||||
#endif // _AIS_MouseGesture_HeaderFile
|
@@ -20,7 +20,6 @@
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Prs3d_Projector.hxx>
|
||||
#include <PrsMgr_ModedPresentation.hxx>
|
||||
#include <Select3D_SensitiveEntity.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
@@ -1,7 +1,4 @@
|
||||
// Created on: 1995-01-25
|
||||
// Created by: Jean-Louis Frenkel
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
@@ -14,10 +11,21 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _PrsMgr_PresentableObjectPointer_HeaderFile
|
||||
#define _PrsMgr_PresentableObjectPointer_HeaderFile
|
||||
#ifndef _AIS_NavigationMode_HeaderFile
|
||||
#define _AIS_NavigationMode_HeaderFile
|
||||
|
||||
class PrsMgr_PresentableObject;
|
||||
typedef PrsMgr_PresentableObject* PrsMgr_PresentableObjectPointer;
|
||||
//! Camera navigation mode.
|
||||
enum AIS_NavigationMode
|
||||
{
|
||||
AIS_NavigationMode_Orbit, //!< orbit rotation
|
||||
AIS_NavigationMode_FirstPersonFlight, //!< flight rotation (first person)
|
||||
AIS_NavigationMode_FirstPersonWalk, //!< walking mode (first person)
|
||||
};
|
||||
|
||||
#endif // _PrsMgr_PresentableObjectPointer_HeaderFile
|
||||
enum
|
||||
{
|
||||
AIS_NavigationMode_LOWER = 0,
|
||||
AIS_NavigationMode_UPPER = AIS_NavigationMode_FirstPersonWalk
|
||||
};
|
||||
|
||||
#endif // _V3d_NavigationMode_HeaderFile
|
@@ -17,28 +17,9 @@
|
||||
#ifndef _AIS_OffsetDimension_HeaderFile
|
||||
#define _AIS_OffsetDimension_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <AIS_KindOfDimension.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class TopoDS_Shape;
|
||||
class TCollection_ExtendedString;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
class gp_Trsf;
|
||||
|
||||
|
||||
class AIS_OffsetDimension;
|
||||
DEFINE_STANDARD_HANDLE(AIS_OffsetDimension, AIS_Relation)
|
||||
|
||||
//! A framework to display dimensions of offsets.
|
||||
@@ -48,10 +29,9 @@ DEFINE_STANDARD_HANDLE(AIS_OffsetDimension, AIS_Relation)
|
||||
//! and the basis shape.
|
||||
class AIS_OffsetDimension : public AIS_Relation
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_OffsetDimension, AIS_Relation)
|
||||
public:
|
||||
|
||||
|
||||
//! Constructs the offset display object defined by the
|
||||
//! first shape aFShape, the second shape aSShape, the
|
||||
//! dimension aVal, and the text aText.
|
||||
@@ -77,19 +57,8 @@ public:
|
||||
//! selection to a relative position.
|
||||
void SetRelativePos (const gp_Trsf& aTrsf);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_OffsetDimension,AIS_Relation)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
@@ -108,14 +77,8 @@ private:
|
||||
gp_Dir myDirAttach2;
|
||||
gp_Trsf myRelativePos;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <AIS_OffsetDimension.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_OffsetDimension_HeaderFile
|
||||
|
@@ -17,27 +17,9 @@
|
||||
#ifndef _AIS_ParallelRelation_HeaderFile
|
||||
#define _AIS_ParallelRelation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <DsgPrs_ArrowSide.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
class TopoDS_Shape;
|
||||
class Geom_Plane;
|
||||
class gp_Pnt;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
|
||||
|
||||
class AIS_ParallelRelation;
|
||||
DEFINE_STANDARD_HANDLE(AIS_ParallelRelation, AIS_Relation)
|
||||
|
||||
//! A framework to display constraints of parallelism
|
||||
@@ -45,7 +27,7 @@ DEFINE_STANDARD_HANDLE(AIS_ParallelRelation, AIS_Relation)
|
||||
//! entities can be faces or edges.
|
||||
class AIS_ParallelRelation : public AIS_Relation
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_ParallelRelation, AIS_Relation)
|
||||
public:
|
||||
|
||||
|
||||
@@ -73,19 +55,8 @@ public:
|
||||
//! to the object to display before computation !!!
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_ParallelRelation,AIS_Relation)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
@@ -100,14 +71,8 @@ private:
|
||||
gp_Pnt mySAttach;
|
||||
gp_Dir myDirAttach;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <AIS_ParallelRelation.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_ParallelRelation_HeaderFile
|
||||
|
@@ -17,22 +17,8 @@
|
||||
#ifndef _AIS_PerpendicularRelation_HeaderFile
|
||||
#define _AIS_PerpendicularRelation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
class TopoDS_Shape;
|
||||
class Geom_Plane;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
|
||||
|
||||
class AIS_PerpendicularRelation;
|
||||
DEFINE_STANDARD_HANDLE(AIS_PerpendicularRelation, AIS_Relation)
|
||||
|
||||
//! A framework to display constraints of perpendicularity
|
||||
@@ -40,10 +26,9 @@ DEFINE_STANDARD_HANDLE(AIS_PerpendicularRelation, AIS_Relation)
|
||||
//! datums can be edges or faces.
|
||||
class AIS_PerpendicularRelation : public AIS_Relation
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_PerpendicularRelation, AIS_Relation)
|
||||
public:
|
||||
|
||||
|
||||
//! Constructs an object to display constraints of
|
||||
//! perpendicularity on shapes.
|
||||
//! This object is defined by a first shape aFShape, a
|
||||
@@ -68,16 +53,6 @@ public:
|
||||
//! to the object to display before computation !!!
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_PerpendicularRelation,AIS_Relation)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -94,13 +69,6 @@ private:
|
||||
gp_Pnt myFAttach;
|
||||
gp_Pnt mySAttach;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_PerpendicularRelation_HeaderFile
|
||||
|
@@ -43,7 +43,6 @@
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Select3D_SensitiveTriangulation.hxx>
|
||||
#include <SelectBasics_EntityOwner.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StdPrs_Plane.hxx>
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include <Prs3d_Projector.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Select3D_SensitivePoint.hxx>
|
||||
#include <SelectBasics_EntityOwner.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StdPrs_Point.hxx>
|
||||
@@ -124,7 +123,6 @@ void AIS_Point::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
|
||||
const Standard_Integer /*aMode*/)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this,10);
|
||||
// eown -> SelectBasics_EntityOwner::Set(5);
|
||||
Handle(Select3D_SensitivePoint) sp = new Select3D_SensitivePoint(eown,
|
||||
myComponent->Pnt());
|
||||
aSelection->Add(sp);
|
||||
|
@@ -24,7 +24,6 @@
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <PrsMgr_ModedPresentation.hxx>
|
||||
#include <PrsMgr_Presentations.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||
|
@@ -27,7 +27,6 @@
|
||||
#include <DsgPrs_ArrowSide.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <PrsMgr_TypeOfPresentation3d.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
|
33
src/AIS/AIS_RotationMode.hxx
Normal file
33
src/AIS/AIS_RotationMode.hxx
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_RotationMode_HeaderFile
|
||||
#define _AIS_RotationMode_HeaderFile
|
||||
|
||||
//! Camera rotation mode.
|
||||
enum AIS_RotationMode
|
||||
{
|
||||
AIS_RotationMode_BndBoxActive, //!< default OCCT rotation
|
||||
AIS_RotationMode_PickLast, //!< rotate around last picked point
|
||||
AIS_RotationMode_PickCenter, //!< rotate around point at the center of window
|
||||
AIS_RotationMode_CameraAt, //!< rotate around camera center
|
||||
AIS_RotationMode_BndBoxScene, //!< rotate around scene center
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AIS_RotationMode_LOWER = 0,
|
||||
AIS_RotationMode_UPPER = AIS_RotationMode_BndBoxScene,
|
||||
};
|
||||
|
||||
#endif // _AIS_RotationMode_HeaderFile
|
@@ -39,6 +39,11 @@ AIS_Selection::AIS_Selection()
|
||||
//=======================================================================
|
||||
void AIS_Selection::Clear()
|
||||
{
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (Objects()); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anObject = aSelIter.Value();
|
||||
anObject->SetSelected (Standard_False);
|
||||
}
|
||||
myresult.Clear();
|
||||
myResultMap.Clear();
|
||||
myIterator = AIS_NListOfEntityOwner::Iterator();
|
||||
@@ -61,6 +66,7 @@ AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& the
|
||||
AIS_NListOfEntityOwner::Iterator aListIter;
|
||||
myresult.Append (theObject, aListIter);
|
||||
myResultMap.Bind (theObject, aListIter);
|
||||
theObject->SetSelected (Standard_True);
|
||||
return AIS_SS_Added;
|
||||
}
|
||||
|
||||
@@ -87,6 +93,7 @@ AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& the
|
||||
|
||||
myresult.Remove (aListIter);
|
||||
myResultMap.UnBind (theObject);
|
||||
theObject->SetSelected (Standard_False);
|
||||
|
||||
// update list iterator for next object in <myresult> list if any
|
||||
if (aListIter.More())
|
||||
@@ -120,5 +127,6 @@ AIS_SelectStatus AIS_Selection::AddSelect (const Handle(SelectMgr_EntityOwner)&
|
||||
AIS_NListOfEntityOwner::Iterator aListIter;
|
||||
myresult.Append (theObject, aListIter);
|
||||
myResultMap.Bind (theObject, aListIter);
|
||||
theObject->SetSelected (Standard_True);
|
||||
return AIS_SS_Added;
|
||||
}
|
||||
|
@@ -48,7 +48,6 @@
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <StdPrs_BndBox.hxx>
|
||||
#include <StdPrs_ToolTriangulatedShape.hxx>
|
||||
#include <PrsMgr_ModedPresentation.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <Select3D_SensitiveEntity.hxx>
|
||||
|
@@ -17,25 +17,11 @@
|
||||
#ifndef _AIS_SymmetricRelation_HeaderFile
|
||||
#define _AIS_SymmetricRelation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
class TopoDS_Shape;
|
||||
class Geom_Plane;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
|
||||
|
||||
class AIS_SymmetricRelation;
|
||||
DEFINE_STANDARD_HANDLE(AIS_SymmetricRelation, AIS_Relation)
|
||||
|
||||
//! A framework to display constraints of symmetricity
|
||||
@@ -44,10 +30,9 @@ DEFINE_STANDARD_HANDLE(AIS_SymmetricRelation, AIS_Relation)
|
||||
//! shapes of which the datums are parts.
|
||||
class AIS_SymmetricRelation : public AIS_Relation
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_SymmetricRelation, AIS_Relation)
|
||||
public:
|
||||
|
||||
|
||||
//! Constructs an object to display constraints of symmetricity.
|
||||
//! This object is defined by a tool aSymmTool, a first
|
||||
//! shape FirstShape, a second shape SecondShape, and a plane aPlane.
|
||||
@@ -79,19 +64,8 @@ public:
|
||||
//! to the object to display before computation !!!
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_SymmetricRelation,AIS_Relation)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
@@ -110,14 +84,8 @@ private:
|
||||
gp_Dir myFDirAttach;
|
||||
gp_Dir myAxisDirAttach;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <AIS_SymmetricRelation.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_SymmetricRelation_HeaderFile
|
||||
|
@@ -17,24 +17,8 @@
|
||||
#ifndef _AIS_TangentRelation_HeaderFile
|
||||
#define _AIS_TangentRelation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <AIS_Relation.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
class TopoDS_Shape;
|
||||
class Geom_Plane;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
|
||||
|
||||
class AIS_TangentRelation;
|
||||
DEFINE_STANDARD_HANDLE(AIS_TangentRelation, AIS_Relation)
|
||||
|
||||
//! A framework to display tangency constraints between
|
||||
@@ -42,10 +26,9 @@ DEFINE_STANDARD_HANDLE(AIS_TangentRelation, AIS_Relation)
|
||||
//! The datums are normally faces or edges.
|
||||
class AIS_TangentRelation : public AIS_Relation
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_TangentRelation, AIS_Relation)
|
||||
public:
|
||||
|
||||
|
||||
//! TwoFacesTangent or TwoEdgesTangent relation
|
||||
//! Constructs an object to display tangency constraints.
|
||||
//! This object is defined by the first shape aFShape, the
|
||||
@@ -79,19 +62,8 @@ public:
|
||||
//! to the object to display before computation !!!
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_TangentRelation,AIS_Relation)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
@@ -107,13 +79,6 @@ private:
|
||||
Standard_Real myLength;
|
||||
Standard_Integer myExternRef;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_TangentRelation_HeaderFile
|
||||
|
@@ -263,14 +263,14 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
|
||||
if (myHasFlipping)
|
||||
{
|
||||
// Get width and height of text
|
||||
Font_FTFont aFont;
|
||||
unsigned int aResolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
|
||||
if (aFont.Init (anAsp->Aspect()->Font().ToCString(),
|
||||
anAsp->Aspect()->GetTextFontAspect(), (unsigned int)anAsp->Height(), aResolution))
|
||||
Font_FTFontParams aFontParams;
|
||||
aFontParams.PointSize = (unsigned int )anAsp->Height();
|
||||
aFontParams.Resolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
|
||||
if (Handle(Font_FTFont) aFont = Font_FTFont::FindAndCreate (anAsp->Aspect()->Font(), anAsp->Aspect()->GetTextFontAspect(), aFontParams))
|
||||
{
|
||||
isInit = Standard_True;
|
||||
const NCollection_String aText (myText.ToExtString());
|
||||
Font_Rect aBndBox = aFont.BoundingBox (aText, anAsp->HorizontalJustification(), anAsp->VerticalJustification());
|
||||
Font_Rect aBndBox = aFont->BoundingBox (aText, anAsp->HorizontalJustification(), anAsp->VerticalJustification());
|
||||
Standard_Real aWidth = Abs (aBndBox.Width());
|
||||
Standard_Real aHeight = Abs (aBndBox.Height());
|
||||
gp_Pnt aCenterOfLabel = aPosition;
|
||||
|
@@ -28,7 +28,6 @@
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <PrsMgr_ModedPresentation.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
@@ -199,14 +198,12 @@ void AIS_TexturedShape::SetColor (const Quantity_Color& theColor)
|
||||
{
|
||||
AIS_Shape::SetColor (theColor);
|
||||
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= Presentations().Length(); ++aPrsIt)
|
||||
for (PrsMgr_Presentations::Iterator aPrsIter (Presentations()); aPrsIter.More(); aPrsIter.Next())
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = Presentations().Value (aPrsIt);
|
||||
|
||||
if (aPrsModed.Mode() != 3)
|
||||
continue;
|
||||
|
||||
updateAttributes (aPrsModed.Presentation()->Presentation());
|
||||
if (aPrsIter.Value()->Mode() == 3)
|
||||
{
|
||||
updateAttributes (aPrsIter.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,15 +225,12 @@ void AIS_TexturedShape::UnsetColor()
|
||||
void AIS_TexturedShape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
|
||||
{
|
||||
AIS_Shape::SetMaterial (theMat);
|
||||
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= Presentations().Length(); ++aPrsIt)
|
||||
for (PrsMgr_Presentations::Iterator aPrsIter (Presentations()); aPrsIter.More(); aPrsIter.Next())
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = Presentations().Value (aPrsIt);
|
||||
|
||||
if (aPrsModed.Mode() != 3)
|
||||
continue;
|
||||
|
||||
updateAttributes (aPrsModed.Presentation()->Presentation());
|
||||
if (aPrsIter.Value()->Mode() == 3)
|
||||
{
|
||||
updateAttributes (aPrsIter.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,15 +241,12 @@ void AIS_TexturedShape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
|
||||
void AIS_TexturedShape::UnsetMaterial()
|
||||
{
|
||||
AIS_Shape::UnsetMaterial();
|
||||
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= Presentations().Length(); ++aPrsIt)
|
||||
for (PrsMgr_Presentations::Iterator aPrsIter (Presentations()); aPrsIter.More(); aPrsIter.Next())
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = Presentations().Value (aPrsIt);
|
||||
|
||||
if (aPrsModed.Mode() != 3)
|
||||
continue;
|
||||
|
||||
updateAttributes (aPrsModed.Presentation()->Presentation());
|
||||
if (aPrsIter.Value()->Mode() == 3)
|
||||
{
|
||||
updateAttributes (aPrsIter.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -95,16 +95,14 @@ void AIS_Triangulation::updatePresentation()
|
||||
// modify shading presentation without re-computation
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
|
||||
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
|
||||
for (PrsMgr_Presentations::Iterator aPrsIter (aPrsList); aPrsIter.More(); aPrsIter.Next())
|
||||
{
|
||||
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
|
||||
if (aPrsModed.Mode() != AIS_WireFrame)
|
||||
if (aPrsIter.Value()->Mode() != AIS_WireFrame)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsIter.Value();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
|
@@ -16,20 +16,11 @@
|
||||
#ifndef _AIS_Triangulation_HeaderFile
|
||||
#define _AIS_Triangulation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
|
||||
class Poly_Triangulation;
|
||||
class Prs3d_Presentation;
|
||||
|
||||
|
||||
class AIS_Triangulation;
|
||||
DEFINE_STANDARD_HANDLE(AIS_Triangulation, AIS_InteractiveObject)
|
||||
|
||||
//! Interactive object that draws data from Poly_Triangulation, optionally with colors associated
|
||||
@@ -38,10 +29,9 @@ DEFINE_STANDARD_HANDLE(AIS_Triangulation, AIS_InteractiveObject)
|
||||
//! Interactive selection of triangles and vertices is not yet implemented.
|
||||
class AIS_Triangulation : public AIS_InteractiveObject
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_Triangulation, AIS_InteractiveObject)
|
||||
public:
|
||||
|
||||
|
||||
//! Constructs the Triangulation display object
|
||||
Standard_EXPORT AIS_Triangulation(const Handle(Poly_Triangulation)& aTriangulation);
|
||||
|
||||
@@ -73,8 +63,6 @@ public:
|
||||
//! Removes the setting for transparency in the reconstructed compound shape.
|
||||
Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_Triangulation,AIS_InteractiveObject)
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT void updatePresentation();
|
||||
@@ -101,13 +89,6 @@ private:
|
||||
Standard_Integer myNbNodes;
|
||||
Standard_Integer myNbTriangles;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_Triangulation_HeaderFile
|
||||
|
@@ -43,7 +43,6 @@
|
||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||
#include <Select3D_SensitiveSegment.hxx>
|
||||
#include <Select3D_SensitiveTriangle.hxx>
|
||||
#include <SelectBasics_EntityOwner.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
@@ -732,14 +731,14 @@ void AIS_Trihedron::SetDrawArrows (const Standard_Boolean theToDraw)
|
||||
//function : createSensitiveEntity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(SelectBasics_SensitiveEntity) AIS_Trihedron::createSensitiveEntity (const Prs3d_DatumParts thePart,
|
||||
const Handle(SelectBasics_EntityOwner)& theOwner) const
|
||||
Handle(Select3D_SensitiveEntity) AIS_Trihedron::createSensitiveEntity (const Prs3d_DatumParts thePart,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner) const
|
||||
{
|
||||
Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect();
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrimitives = arrayOfPrimitives (thePart);
|
||||
if (aPrimitives.IsNull())
|
||||
{
|
||||
return Handle(SelectBasics_SensitiveEntity)();
|
||||
return Handle(Select3D_SensitiveEntity)();
|
||||
}
|
||||
|
||||
if (thePart >= Prs3d_DP_XOYAxis
|
||||
@@ -769,7 +768,7 @@ Handle(SelectBasics_SensitiveEntity) AIS_Trihedron::createSensitiveEntity (const
|
||||
const gp_Pnt anXYZ2 = aSegments->Vertice (2);
|
||||
return new Select3D_SensitiveSegment (theOwner, anXYZ1, anXYZ2);
|
||||
}
|
||||
return Handle(SelectBasics_SensitiveEntity)();
|
||||
return Handle(Select3D_SensitiveEntity)();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -225,8 +225,8 @@ protected:
|
||||
protected:
|
||||
|
||||
//! Creates a sensitive entity for the datum part that will be used in selection owner creation.
|
||||
Standard_EXPORT Handle(SelectBasics_SensitiveEntity) createSensitiveEntity (const Prs3d_DatumParts thePart,
|
||||
const Handle(SelectBasics_EntityOwner)& theOwner) const;
|
||||
Standard_EXPORT Handle(Select3D_SensitiveEntity) createSensitiveEntity (const Prs3d_DatumParts thePart,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner) const;
|
||||
|
||||
//! Computes presentation for display mode equal 1.
|
||||
Standard_EXPORT void computePresentation (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
|
2349
src/AIS/AIS_ViewController.cxx
Normal file
2349
src/AIS/AIS_ViewController.cxx
Normal file
File diff suppressed because it is too large
Load Diff
683
src/AIS/AIS_ViewController.hxx
Normal file
683
src/AIS/AIS_ViewController.hxx
Normal file
@@ -0,0 +1,683 @@
|
||||
// Copyright (c) 2016-2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_ViewController_HeaderFile
|
||||
#define _AIS_ViewController_HeaderFile
|
||||
|
||||
#include <Aspect_VKeySet.hxx>
|
||||
#include <Aspect_TouchMap.hxx>
|
||||
#include <AIS_DragAction.hxx>
|
||||
#include <AIS_MouseGesture.hxx>
|
||||
#include <AIS_NavigationMode.hxx>
|
||||
#include <AIS_ViewInputBuffer.hxx>
|
||||
#include <AIS_RotationMode.hxx>
|
||||
#include <AIS_WalkDelta.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_Vec3.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_Mutex.hxx>
|
||||
|
||||
class AIS_AnimationCamera;
|
||||
class AIS_InteractiveObject;
|
||||
class AIS_InteractiveContext;
|
||||
class AIS_Point;
|
||||
class AIS_RubberBand;
|
||||
class V3d_View;
|
||||
|
||||
//! Auxiliary structure for handling viewer events between GUI and Rendering threads.
|
||||
//!
|
||||
//! Class implements the following features:
|
||||
//! - Buffers storing the state of user input (mouse, touches and keyboard).
|
||||
//! - Mapping mouse/multi-touch input to View camera manipulations (panning/rotating/zooming).
|
||||
//! - Input events are not applied immediately but queued for separate processing from two working threads
|
||||
//! UI thread receiving user input and Rendering thread for OCCT 3D Viewer drawing.
|
||||
class AIS_ViewController
|
||||
{
|
||||
public:
|
||||
|
||||
//! Empty constructor.
|
||||
Standard_EXPORT AIS_ViewController();
|
||||
|
||||
//! Return input buffer.
|
||||
const AIS_ViewInputBuffer& InputBuffer (AIS_ViewInputBufferType theType) const { return theType == AIS_ViewInputBufferType_UI ? myUI : myGL; }
|
||||
|
||||
//! Return input buffer.
|
||||
AIS_ViewInputBuffer& ChangeInputBuffer (AIS_ViewInputBufferType theType) { return theType == AIS_ViewInputBufferType_UI ? myUI : myGL; }
|
||||
|
||||
//! Return view animation; empty (but not NULL) animation by default.
|
||||
const Handle(AIS_AnimationCamera)& ViewAnimation() const { return myViewAnimation; }
|
||||
|
||||
//! Set view animation to be handled within handleViewRedraw().
|
||||
void SetViewAnimation (const Handle(AIS_AnimationCamera)& theAnimation) { myViewAnimation = theAnimation; }
|
||||
|
||||
//! Interrupt active view animation.
|
||||
Standard_EXPORT void AbortViewAnimation();
|
||||
|
||||
public: //! @name global parameters
|
||||
|
||||
//! Return camera rotation mode, AIS_RotationMode_BndBoxActive by default.
|
||||
AIS_RotationMode RotationMode() const { return myRotationMode; }
|
||||
|
||||
//! Set camera rotation mode.
|
||||
void SetRotationMode (AIS_RotationMode theMode) { myRotationMode = theMode; }
|
||||
|
||||
//! Return camera navigation mode; AIS_NavigationMode_Orbit by default.
|
||||
AIS_NavigationMode NavigationMode() const { return myNavigationMode; }
|
||||
|
||||
//! Set camera navigation mode.
|
||||
Standard_EXPORT void SetNavigationMode (AIS_NavigationMode theMode);
|
||||
|
||||
//! Return mouse input acceleration ratio in First Person mode; 1.0 by default.
|
||||
float MouseAcceleration() const { return myMouseAccel; }
|
||||
|
||||
//! Set mouse input acceleration ratio.
|
||||
void SetMouseAcceleration (float theRatio) { myMouseAccel = theRatio; }
|
||||
|
||||
//! Return orbit rotation acceleration ratio; 1.0 by default.
|
||||
float OrbitAcceleration() const { return myOrbitAccel; }
|
||||
|
||||
//! Set orbit rotation acceleration ratio.
|
||||
void SetOrbitAcceleration (float theRatio) { myOrbitAccel = theRatio; }
|
||||
|
||||
//! Return TRUE if panning anchor point within perspective projection should be displayed in 3D Viewer; TRUE by default.
|
||||
bool ToShowPanAnchorPoint() const { return myToShowPanAnchorPoint; }
|
||||
|
||||
//! Set if panning anchor point within perspective projection should be displayed in 3D Viewer.
|
||||
void SetShowPanAnchorPoint (bool theToShow) { myToShowPanAnchorPoint = theToShow; }
|
||||
|
||||
//! Return TRUE if rotation point should be displayed in 3D Viewer; TRUE by default.
|
||||
bool ToShowRotateCenter() const { return myToShowRotateCenter; }
|
||||
|
||||
//! Set if rotation point should be displayed in 3D Viewer.
|
||||
void SetShowRotateCenter (bool theToShow) { myToShowRotateCenter = theToShow; }
|
||||
|
||||
//! Return TRUE if camera up orientation within AIS_NavigationMode_Orbit rotation mode should be forced Z up; FALSE by default.
|
||||
bool ToLockOrbitZUp() const { return myToLockOrbitZUp; }
|
||||
|
||||
//! Set if camera up orientation within AIS_NavigationMode_Orbit rotation mode should be forced Z up.
|
||||
void SetLockOrbitZUp (bool theToForceUp) { myToLockOrbitZUp = theToForceUp; }
|
||||
|
||||
//! Return TRUE if z-rotation via two-touches gesture is enabled; FALSE by default.
|
||||
bool ToAllowTouchZRotation() const { return myToAllowTouchZRotation; }
|
||||
|
||||
//! Set if z-rotation via two-touches gesture is enabled.
|
||||
void SetAllowTouchZRotation (bool theToEnable) { myToAllowTouchZRotation = theToEnable; }
|
||||
|
||||
//! Return TRUE if camera rotation is allowed; TRUE by default.
|
||||
bool ToAllowRotation() const { return myToAllowRotation; }
|
||||
|
||||
//! Set if camera rotation is allowed.
|
||||
void SetAllowRotation (bool theToEnable) { myToAllowRotation = theToEnable; }
|
||||
|
||||
//! Return TRUE if panning is allowed; TRUE by default.
|
||||
bool ToAllowPanning() const { return myToAllowPanning; }
|
||||
|
||||
//! Set if panning is allowed.
|
||||
void SetAllowPanning (bool theToEnable) { myToAllowPanning = theToEnable; }
|
||||
|
||||
//! Return TRUE if zooming is allowed; TRUE by default.
|
||||
bool ToAllowZooming() const { return myToAllowZooming; }
|
||||
|
||||
//! Set if zooming is allowed.
|
||||
void SetAllowZooming (bool theToEnable) { myToAllowZooming = theToEnable; }
|
||||
|
||||
//! Return TRUE if ZFocus change is allowed; TRUE by default.
|
||||
bool ToAllowZFocus() const { return myToAllowZFocus; }
|
||||
|
||||
//! Set if ZFocus change is allowed.
|
||||
void SetAllowZFocus (bool theToEnable) { myToAllowZFocus = theToEnable; }
|
||||
|
||||
//! Return TRUE if dynamic highlight on mouse move is allowed; TRUE by default.
|
||||
bool ToAllowHighlight() const { return myToAllowHighlight; }
|
||||
|
||||
//! Set if dragging object is allowed.
|
||||
void SetAllowHighlight (bool theToEnable) { myToAllowHighlight = theToEnable; }
|
||||
|
||||
//! Return TRUE if dragging object is allowed; TRUE by default.
|
||||
bool ToAllowDragging() const { return myToAllowDragging; }
|
||||
|
||||
//! Set if dynamic highlight on mouse move is allowed.
|
||||
void SetAllowDragging (bool theToEnable) { myToAllowDragging = theToEnable; }
|
||||
|
||||
//! Return TRUE if picked point should be projected to picking ray on zooming at point; TRUE by default.
|
||||
bool ToStickToRayOnZoom() const { return myToStickToRayOnZoom; }
|
||||
|
||||
//! Set if picked point should be projected to picking ray on zooming at point.
|
||||
void SetStickToRayOnZoom (bool theToEnable) { myToStickToRayOnZoom = theToEnable; }
|
||||
|
||||
//! Return TRUE if picked point should be projected to picking ray on rotating around point; TRUE by default.
|
||||
bool ToStickToRayOnRotation() const { return myToStickToRayOnRotation; }
|
||||
|
||||
//! Set if picked point should be projected to picking ray on rotating around point.
|
||||
void SetStickToRayOnRotation (bool theToEnable) { myToStickToRayOnRotation = theToEnable; }
|
||||
|
||||
//! Return TRUE if pitch direction should be inverted while processing Aspect_VKey_NavLookUp/Aspect_VKey_NavLookDown; FALSE by default.
|
||||
bool ToInvertPitch() const { return myToInvertPitch; }
|
||||
|
||||
//! Set flag inverting pitch direction.
|
||||
void SetInvertPitch (bool theToInvert) { myToInvertPitch = theToInvert; }
|
||||
|
||||
//! Return normal walking speed, in m/s; 1.5 by default.
|
||||
float WalkSpeedAbsolute() const { return myWalkSpeedAbsolute; }
|
||||
|
||||
//! Set normal walking speed, in m/s; 1.5 by default.
|
||||
void SetWalkSpeedAbsolute (float theSpeed) { myWalkSpeedAbsolute = theSpeed; }
|
||||
|
||||
//! Return walking speed relative to scene bounding box; 0.1 by default.
|
||||
float WalkSpeedRelative() const { return myWalkSpeedRelative; }
|
||||
|
||||
//! Set walking speed relative to scene bounding box.
|
||||
void SetWalkSpeedRelative (float theFactor) { myWalkSpeedRelative = theFactor; }
|
||||
|
||||
//! Return active thrust value; 0.0f by default.
|
||||
float ThrustSpeed() const { return myThrustSpeed; }
|
||||
|
||||
//! Set active thrust value.
|
||||
void SetThrustSpeed (float theSpeed) { myThrustSpeed = theSpeed; }
|
||||
|
||||
//! Return TRUE if previous position of MoveTo has been defined.
|
||||
bool HasPreviousMoveTo() const { return myPrevMoveTo != Graphic3d_Vec2i (-1); }
|
||||
|
||||
//! Return previous position of MoveTo event in 3D viewer.
|
||||
const Graphic3d_Vec2i& PreviousMoveTo() const { return myPrevMoveTo; }
|
||||
|
||||
//! Reset previous position of MoveTo.
|
||||
void ResetPreviousMoveTo() { myPrevMoveTo = Graphic3d_Vec2i (-1); }
|
||||
|
||||
public: //! @name keyboard input
|
||||
|
||||
//! Return keyboard state.
|
||||
const Aspect_VKeySet& Keys() const { return myKeys; }
|
||||
|
||||
//! Return keyboard state.
|
||||
Aspect_VKeySet& ChangeKeys() { return myKeys; }
|
||||
|
||||
//! Press key.
|
||||
//! @param theKey key pressed
|
||||
//! @param theTime event timestamp
|
||||
Standard_EXPORT virtual void KeyDown (Aspect_VKey theKey,
|
||||
double theTime,
|
||||
double thePressure = 1.0);
|
||||
|
||||
//! Release key.
|
||||
//! @param theKey key pressed
|
||||
//! @param theTime event timestamp
|
||||
Standard_EXPORT virtual void KeyUp (Aspect_VKey theKey,
|
||||
double theTime);
|
||||
|
||||
//! Simulate key up/down events from axis value.
|
||||
Standard_EXPORT virtual void KeyFromAxis (Aspect_VKey theNegative,
|
||||
Aspect_VKey thePositive,
|
||||
double theTime,
|
||||
double thePressure);
|
||||
|
||||
//! Fetch active navigation actions.
|
||||
Standard_EXPORT AIS_WalkDelta FetchNavigationKeys (Standard_Real theCrouchRatio,
|
||||
Standard_Real theRunRatio);
|
||||
|
||||
public: //! @name mouse input
|
||||
|
||||
//! Return map defining mouse gestures.
|
||||
const AIS_MouseGestureMap& MouseGestureMap() const { return myMouseGestureMap; }
|
||||
|
||||
//! Return map defining mouse gestures.
|
||||
AIS_MouseGestureMap& ChangeMouseGestureMap() { return myMouseGestureMap; }
|
||||
|
||||
//! Return double click interval in seconds; 0.4 by default.
|
||||
double MouseDoubleClickInterval() const { return myMouseDoubleClickInt; }
|
||||
|
||||
//! Set double click interval in seconds.
|
||||
void SetMouseDoubleClickInterval (double theSeconds) { myMouseDoubleClickInt = theSeconds; }
|
||||
|
||||
//! Perform selection in 3D viewer.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePnt picking point
|
||||
//! @param theIsXOR XOR selection flag
|
||||
Standard_EXPORT virtual void SelectInViewer (const Graphic3d_Vec2i& thePnt,
|
||||
const bool theIsXOR = false);
|
||||
|
||||
//! Perform selection in 3D viewer.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePnts picking point
|
||||
//! @param theIsXOR XOR selection flag
|
||||
Standard_EXPORT virtual void SelectInViewer (const NCollection_Sequence<Graphic3d_Vec2i>& thePnts,
|
||||
const bool theIsXOR = false);
|
||||
|
||||
//! Update rectangle selection tool.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePntFrom rectangle first corner
|
||||
//! @param thePntTo rectangle another corner
|
||||
//! @param theIsXOR XOR selection flag
|
||||
Standard_EXPORT virtual void UpdateRubberBand (const Graphic3d_Vec2i& thePntFrom,
|
||||
const Graphic3d_Vec2i& thePntTo,
|
||||
const bool theIsXOR = false);
|
||||
|
||||
//! Update polygonal selection tool.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePnt new point to add to polygon
|
||||
//! @param theToAppend append new point or update the last point
|
||||
Standard_EXPORT virtual void UpdatePolySelection (const Graphic3d_Vec2i& thePnt,
|
||||
bool theToAppend);
|
||||
|
||||
//! Update zoom event (e.g. from mouse scroll).
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param theDelta mouse cursor position to zoom at and zoom delta
|
||||
//! @return TRUE if new zoom event has been created or FALSE if existing one has been updated
|
||||
Standard_EXPORT virtual bool UpdateZoom (const Aspect_ScrollDelta& theDelta);
|
||||
|
||||
//! Update Z rotation event.
|
||||
//! @param theAngle rotation angle, in radians.
|
||||
//! @return TRUE if new zoom event has been created or FALSE if existing one has been updated
|
||||
Standard_EXPORT virtual bool UpdateZRotation (double theAngle);
|
||||
|
||||
//! Update mouse scroll event; redirects to UpdateZoom by default.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param theDelta mouse cursor position and delta
|
||||
//! @return TRUE if new event has been created or FALSE if existing one has been updated
|
||||
Standard_EXPORT virtual bool UpdateMouseScroll (const Aspect_ScrollDelta& theDelta);
|
||||
|
||||
//! Handle mouse button press/release event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButtons pressed buttons
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
|
||||
//! but emulated from non-precise input like touch on screen
|
||||
//! @return TRUE if View should be redrawn
|
||||
Standard_EXPORT virtual bool UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButtons,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated);
|
||||
|
||||
//! Handle mouse cursor movement event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButtons pressed buttons
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
|
||||
//! but emulated from non-precise input like touch on screen
|
||||
//! @return TRUE if View should be redrawn
|
||||
Standard_EXPORT virtual bool UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButtons,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated);
|
||||
|
||||
//! Handle mouse button press event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButton pressed button
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
|
||||
//! but emulated from non-precise input like touch on screen
|
||||
//! @return TRUE if View should be redrawn
|
||||
bool PressMouseButton (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButton,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated)
|
||||
{
|
||||
return UpdateMouseButtons (thePoint, myMousePressed | theButton, theModifiers, theIsEmulated);
|
||||
}
|
||||
|
||||
//! Handle mouse button release event.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButton released button
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
|
||||
//! but emulated from non-precise input like touch on screen
|
||||
//! @return TRUE if View should be redrawn
|
||||
bool ReleaseMouseButton (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButton,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsEmulated)
|
||||
{
|
||||
Aspect_VKeyMouse aButtons = myMousePressed & (~theButton);
|
||||
return UpdateMouseButtons (thePoint, aButtons, theModifiers, theIsEmulated);
|
||||
}
|
||||
|
||||
//! Handle mouse button click event (emulated by UpdateMouseButtons() while releasing single button).
|
||||
//! Note that as this method is called by UpdateMouseButtons(), it should be executed from UI thread.
|
||||
//! Default implementation redirects to SelectInViewer().
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param thePoint mouse cursor position
|
||||
//! @param theButton clicked button
|
||||
//! @param theModifiers key modifiers
|
||||
//! @param theIsDoubleClick flag indicating double mouse click
|
||||
//! @return TRUE if View should be redrawn
|
||||
Standard_EXPORT virtual bool UpdateMouseClick (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButton,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsDoubleClick);
|
||||
|
||||
//! Return currently pressed mouse buttons.
|
||||
Aspect_VKeyMouse PressedMouseButtons() const { return myMousePressed; }
|
||||
|
||||
//! Return active key modifiers passed with last mouse event.
|
||||
Aspect_VKeyFlags LastMouseFlags() const { return myMouseModifiers; }
|
||||
|
||||
//! Return last mouse position.
|
||||
const Graphic3d_Vec2i& LastMousePosition() const { return myMousePositionLast; }
|
||||
|
||||
public: //! @name multi-touch input
|
||||
|
||||
//! Return scale factor for adjusting tolerances for starting multi-touch gestures; 1.0 by default
|
||||
//! This scale factor is expected to be computed from touch screen resolution.
|
||||
float TouchToleranceScale() const { return myTouchToleranceScale; }
|
||||
|
||||
//! Set scale factor for adjusting tolerances for starting multi-touch gestures.
|
||||
void SetTouchToleranceScale (float theTolerance) { myTouchToleranceScale = theTolerance; }
|
||||
|
||||
//! Return TRUE if touches map is not empty.
|
||||
bool HasTouchPoints() const { return !myTouchPoints.IsEmpty(); }
|
||||
|
||||
//! Add touch point with the given ID.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param theId touch unique identifier
|
||||
//! @param thePnt touch coordinates
|
||||
//! @param theClearBefore if TRUE previously registered touches will be removed
|
||||
Standard_EXPORT virtual void AddTouchPoint (Standard_Size theId,
|
||||
const Graphic3d_Vec2d& thePnt,
|
||||
Standard_Boolean theClearBefore = false);
|
||||
|
||||
//! Remove touch point with the given ID.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param theId touch unique identifier
|
||||
//! @param theClearSelectPnts if TRUE will initiate clearing of selection points
|
||||
//! @return TRUE if point has been removed
|
||||
Standard_EXPORT virtual bool RemoveTouchPoint (Standard_Size theId,
|
||||
Standard_Boolean theClearSelectPnts = false);
|
||||
|
||||
//! Update touch point with the given ID.
|
||||
//! If point with specified ID was not registered before, it will be added.
|
||||
//! This method is expected to be called from UI thread.
|
||||
//! @param theId touch unique identifier
|
||||
//! @param thePnt touch coordinates
|
||||
Standard_EXPORT virtual void UpdateTouchPoint (Standard_Size theId,
|
||||
const Graphic3d_Vec2d& thePnt);
|
||||
|
||||
public:
|
||||
|
||||
//! Return event time (e.g. current time).
|
||||
double EventTime() const { return myEventTimer.ElapsedTime(); }
|
||||
|
||||
//! Reset input state (pressed keys, mouse buttons, etc.) e.g. on window focus loss.
|
||||
//! This method is expected to be called from UI thread.
|
||||
Standard_EXPORT virtual void ResetViewInput();
|
||||
|
||||
//! Reset view orientation.
|
||||
//! This method is expected to be called from UI thread.
|
||||
Standard_EXPORT virtual void UpdateViewOrientation (V3d_TypeOfOrientation theOrientation,
|
||||
bool theToFitAll);
|
||||
|
||||
//! Update buffer for rendering thread.
|
||||
//! This method is expected to be called within synchronization barrier between GUI
|
||||
//! and Rendering threads (e.g. GUI thread should be locked beforehand to avoid data races).
|
||||
//! @param theCtx interactive context
|
||||
//! @param theView active view
|
||||
//! @param theToHandle if TRUE, the HandleViewEvents() will be called
|
||||
Standard_EXPORT virtual void FlushViewEvents (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView,
|
||||
Standard_Boolean theToHandle = Standard_False);
|
||||
|
||||
//! Process events within rendering thread.
|
||||
Standard_EXPORT virtual void HandleViewEvents (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
public:
|
||||
|
||||
//! Callback called by handleMoveTo() on Selection in 3D Viewer.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void OnSelectionChanged (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Callback called by handleMoveTo() on dragging object in 3D Viewer.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void OnObjectDragged (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView,
|
||||
AIS_DragAction theAction);
|
||||
|
||||
//! Pick closest point under mouse cursor.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
//! @param thePnt [out] result point
|
||||
//! @param theCtx [in] interactive context
|
||||
//! @param theView [in] active view
|
||||
//! @param theCursor [in] mouse cursor
|
||||
//! @param theToStickToPickRay [in] when TRUE, the result point will lie on picking ray
|
||||
//! @return TRUE if result has been found
|
||||
Standard_EXPORT virtual bool PickPoint (gp_Pnt& thePnt,
|
||||
const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView,
|
||||
const Graphic3d_Vec2i& theCursor,
|
||||
bool theToStickToPickRay);
|
||||
|
||||
//! Compute rotation gravity center point depending on rotation mode.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual gp_Pnt GravityPoint (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
public:
|
||||
|
||||
//! Perform camera actions.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleCameraActions (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView,
|
||||
const AIS_WalkDelta& theWalk);
|
||||
|
||||
//! Perform moveto/selection/dragging.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleMoveTo (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Return TRUE if another frame should be drawn right after this one.
|
||||
bool toAskNextFrame() const { return myToAskNextFrame; }
|
||||
|
||||
//! Set if another frame should be drawn right after this one.
|
||||
void setAskNextFrame (bool theToDraw = true) { myToAskNextFrame = theToDraw; }
|
||||
|
||||
//! Return if panning anchor point has been defined.
|
||||
bool hasPanningAnchorPoint() const { return !Precision::IsInfinite (myPanPnt3d.X()); }
|
||||
|
||||
//! Return active panning anchor point.
|
||||
const gp_Pnt& panningAnchorPoint() const { return myPanPnt3d; }
|
||||
|
||||
//! Set active panning anchor point.
|
||||
void setPanningAnchorPoint (const gp_Pnt& thePnt) { myPanPnt3d = thePnt; }
|
||||
|
||||
//! Handle panning event myGL.Panning.
|
||||
Standard_EXPORT virtual void handlePanning (const Handle(V3d_View)& theView);
|
||||
|
||||
//! Handle Z rotation event myGL.ZRotate.
|
||||
Standard_EXPORT virtual void handleZRotate (const Handle(V3d_View)& theView);
|
||||
|
||||
//! Return minimal camera distance for zoom operation.
|
||||
double MinZoomDistance() const { return myMinCamDistance; }
|
||||
|
||||
//! Set minimal camera distance for zoom operation.
|
||||
void SetMinZoomDistance (double theDist) { myMinCamDistance = theDist; }
|
||||
|
||||
//! Handle zoom event myGL.ZoomActions.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleZoom (const Handle(V3d_View)& theView,
|
||||
const Aspect_ScrollDelta& theParams,
|
||||
const gp_Pnt* thePnt);
|
||||
|
||||
//! Handle ZScroll event myGL.ZoomActions.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleZFocusScroll (const Handle(V3d_View)& theView,
|
||||
const Aspect_ScrollDelta& theParams);
|
||||
|
||||
//! Handle orbital rotation events myGL.OrbitRotation.
|
||||
//! @param theView view to modify
|
||||
//! @param thePnt 3D point to rotate around
|
||||
//! @param theToLockZUp amend camera to exclude roll angle (put camera Up vector to plane containing global Z and view direction)
|
||||
Standard_EXPORT virtual void handleOrbitRotation (const Handle(V3d_View)& theView,
|
||||
const gp_Pnt& thePnt,
|
||||
bool theToLockZUp);
|
||||
|
||||
//! Handle view direction rotation events myGL.ViewRotation.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
//! @param theView camera to modify
|
||||
//! @param theYawExtra extra yaw increment
|
||||
//! @param thePitchExtra extra pitch increment
|
||||
//! @param theRoll roll value
|
||||
//! @param theToRestartOnIncrement flag indicating flight mode
|
||||
Standard_EXPORT virtual void handleViewRotation (const Handle(V3d_View)& theView,
|
||||
double theYawExtra,
|
||||
double thePitchExtra,
|
||||
double theRoll,
|
||||
bool theToRestartOnIncrement);
|
||||
|
||||
//! Handle view redraw.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleViewRedraw (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
protected:
|
||||
|
||||
//! Flush buffers.
|
||||
Standard_EXPORT virtual void flushBuffers (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Flush touch gestures.
|
||||
Standard_EXPORT virtual void flushGestures (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Return current and previously fetched event times.
|
||||
//! This callback is intended to compute delta between sequentially processed events.
|
||||
//! @param thePrevTime [out] events time fetched previous time by this method
|
||||
//! @param theCurrTime [out] actual events time
|
||||
void updateEventsTime (double& thePrevTime,
|
||||
double& theCurrTime)
|
||||
{
|
||||
thePrevTime = myLastEventsTime;
|
||||
myLastEventsTime = EventTime();
|
||||
theCurrTime = myLastEventsTime;
|
||||
}
|
||||
|
||||
//! Perform selection via mouse click.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleSelectionPick (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Perform dynamic highlight on mouse move.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleDynamicHighlight (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Perform rubber-band selection.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
Standard_EXPORT virtual void handleSelectionPoly (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Lazy AIS_InteractiveContext::MoveTo() with myPrevMoveTo check.
|
||||
Standard_EXPORT virtual void contextLazyMoveTo (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView,
|
||||
const Graphic3d_Vec2i& thePnt);
|
||||
|
||||
protected:
|
||||
|
||||
AIS_ViewInputBuffer myUI; //!< buffer for UI thread
|
||||
AIS_ViewInputBuffer myGL; //!< buffer for rendering thread
|
||||
|
||||
OSD_Timer myEventTimer; //!< timer for timestamping events
|
||||
Standard_Real myLastEventsTime; //!< last fetched events timer value for computing delta/progress
|
||||
Standard_Boolean myToAskNextFrame; //!< flag indicating that another frame should be drawn right after this one
|
||||
|
||||
Standard_Real myMinCamDistance; //!< minimal camera distance for zoom operation
|
||||
AIS_RotationMode myRotationMode; //!< rotation mode
|
||||
AIS_NavigationMode myNavigationMode; //!< navigation mode (orbit rotation / first person)
|
||||
Standard_ShortReal myMouseAccel; //!< mouse input acceleration ratio in First Person mode
|
||||
Standard_ShortReal myOrbitAccel; //!< Orbit rotation acceleration ratio
|
||||
Standard_Boolean myToShowPanAnchorPoint; //!< option displaying panning anchor point
|
||||
Standard_Boolean myToShowRotateCenter; //!< option displaying rotation center point
|
||||
Standard_Boolean myToLockOrbitZUp; //!< force camera up orientation within AIS_NavigationMode_Orbit rotation mode
|
||||
Standard_Boolean myToInvertPitch; //!< flag inverting pitch direction while processing Aspect_VKey_NavLookUp/Aspect_VKey_NavLookDown
|
||||
Standard_Boolean myToAllowTouchZRotation; //!< enable z-rotation two-touches gesture; FALSE by default
|
||||
Standard_Boolean myToAllowRotation; //!< enable rotation; TRUE by default
|
||||
Standard_Boolean myToAllowPanning; //!< enable panning; TRUE by default
|
||||
Standard_Boolean myToAllowZooming; //!< enable zooming; TRUE by default
|
||||
Standard_Boolean myToAllowZFocus; //!< enable ZFocus change; TRUE by default
|
||||
Standard_Boolean myToAllowHighlight; //!< enable dynamic highlight on mouse move; TRUE by default
|
||||
Standard_Boolean myToAllowDragging; //!< enable dragging object; TRUE by default
|
||||
Standard_Boolean myToStickToRayOnZoom; //!< project picked point to ray while zooming at point, TRUE by default
|
||||
Standard_Boolean myToStickToRayOnRotation; //!< project picked point to ray while rotating around point; TRUE by default
|
||||
|
||||
Standard_ShortReal myWalkSpeedAbsolute; //!< normal walking speed, in m/s; 1.5 by default
|
||||
Standard_ShortReal myWalkSpeedRelative; //!< walking speed relative to scene bounding box; 0.1 by default
|
||||
Standard_ShortReal myThrustSpeed; //!< active thrust value
|
||||
Standard_Boolean myHasThrust; //!< flag indicating active thrust
|
||||
|
||||
Handle(AIS_AnimationCamera) myViewAnimation; //!< view animation
|
||||
Handle(AIS_RubberBand) myRubberBand; //!< Rubber-band presentation
|
||||
Handle(AIS_InteractiveObject) myDragObject; //!< currently dragged object
|
||||
Graphic3d_Vec2i myPrevMoveTo; //!< previous position of MoveTo event in 3D viewer
|
||||
Standard_Boolean myHasHlrOnBeforeRotation; //!< flag for restoring Computed mode after rotation
|
||||
|
||||
protected: //! @name keyboard input variables
|
||||
|
||||
Aspect_VKeySet myKeys; //!< keyboard state
|
||||
|
||||
protected: //! @name mouse input variables
|
||||
|
||||
Standard_Real myMouseClickThreshold; //!< mouse click threshold in pixels; 3 by default
|
||||
Standard_Real myMouseDoubleClickInt; //!< double click interval in seconds; 0.4 by default
|
||||
Standard_ShortReal myScrollZoomRatio; //!< distance ratio for mapping mouse scroll event to zoom; 15.0 by default
|
||||
|
||||
AIS_MouseGestureMap myMouseGestureMap; //!< map defining mouse gestures
|
||||
AIS_MouseGesture myMouseActiveGesture; //!< initiated mouse gesture (by pressing mouse button)
|
||||
Standard_Boolean myMouseActiveIdleRotation; //!< flag indicating view idle rotation state
|
||||
Graphic3d_Vec2i myMousePositionLast; //!< last mouse position
|
||||
Graphic3d_Vec2i myMousePressPoint; //!< mouse position where active gesture was been initiated
|
||||
Graphic3d_Vec2i myMouseProgressPoint; //!< gesture progress
|
||||
OSD_Timer myMouseClickTimer; //!< timer for handling double-click event
|
||||
Standard_Integer myMouseClickCounter; //!< counter for handling double-click event
|
||||
Aspect_VKeyMouse myMousePressed; //!< active mouse buttons
|
||||
Aspect_VKeyFlags myMouseModifiers; //!< active key modifiers passed with last mouse event
|
||||
Standard_Integer myMouseSingleButton; //!< index of mouse button pressed alone (>0)
|
||||
|
||||
protected: //! @name multi-touch input variables
|
||||
|
||||
Standard_ShortReal myTouchToleranceScale; //!< tolerance scale factor; 1.0 by default
|
||||
Standard_ShortReal myTouchRotationThresholdPx; //!< threshold for starting one-touch rotation gesture in pixels; 6 by default
|
||||
Standard_ShortReal myTouchZRotationThreshold; //!< threshold for starting two-touch Z-rotation gesture in radians; 2 degrees by default
|
||||
Standard_ShortReal myTouchPanThresholdPx; //!< threshold for starting two-touch panning gesture in pixels; 4 by default
|
||||
Standard_ShortReal myTouchZoomThresholdPx; //!< threshold for starting two-touch zoom (pitch) gesture in pixels; 6 by default
|
||||
Standard_ShortReal myTouchZoomRatio; //!< distance ratio for mapping two-touch zoom (pitch) gesture from pixels to zoom; 0.13 by default
|
||||
|
||||
Aspect_TouchMap myTouchPoints; //!< map of active touches
|
||||
Graphic3d_Vec2d myStartPanCoord; //!< touch coordinates at the moment of starting panning gesture
|
||||
Graphic3d_Vec2d myStartRotCoord; //!< touch coordinates at the moment of starting rotating gesture
|
||||
Standard_Integer myNbTouchesLast; //!< number of touches within previous gesture flush to track gesture changes
|
||||
Standard_Boolean myUpdateStartPointPan; //!< flag indicating that new anchor point should be picked for starting panning gesture
|
||||
Standard_Boolean myUpdateStartPointRot; //!< flag indicating that new gravity point should be picked for starting rotation gesture
|
||||
Standard_Boolean myUpdateStartPointZRot; //!< flag indicating that new gravity point should be picked for starting Z-rotation gesture
|
||||
|
||||
protected: //! @name rotation/panning transient state variables
|
||||
|
||||
Handle(AIS_Point) myAnchorPointPrs1; //!< anchor point presentation (Graphic3d_ZLayerId_Top)
|
||||
Handle(AIS_Point) myAnchorPointPrs2; //!< anchor point presentation (Graphic3d_ZLayerId_Topmost)
|
||||
gp_Pnt myPanPnt3d; //!< active panning anchor point
|
||||
gp_Pnt myRotatePnt3d; //!< active rotation center of gravity
|
||||
gp_Dir myCamStartOpUp; //!< camera Up direction at the beginning of rotation
|
||||
gp_Pnt myCamStartOpEye; //!< camera Eye position at the beginning of rotation
|
||||
gp_Pnt myCamStartOpCenter; //!< camera Center position at the beginning of rotation
|
||||
gp_Vec myCamStartOpToCenter; //!< vector from rotation gravity point to camera Center at the beginning of rotation
|
||||
gp_Vec myCamStartOpToEye; //!< vector from rotation gravity point to camera Eye at the beginning of rotation
|
||||
Graphic3d_Vec3d myRotateStartYawPitchRoll; //!< camera yaw pitch roll at the beginning of rotation
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_ViewController_HeaderFile
|
891
src/AIS/AIS_ViewCube.cxx
Normal file
891
src/AIS/AIS_ViewCube.cxx
Normal file
@@ -0,0 +1,891 @@
|
||||
// Created on: 2017-07-25
|
||||
// Created by: Anastasia BOBYLEVA
|
||||
// Copyright (c) 2017-2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <AIS_ViewCube.hxx>
|
||||
|
||||
#include <AIS_AnimationCamera.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <Graphic3d_ViewAffinity.hxx>
|
||||
#include <NCollection_Lerp.hxx>
|
||||
#include <Prs3d.hxx>
|
||||
#include <Prs3d_Arrow.hxx>
|
||||
#include <Prs3d_DatumAspect.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <Prs3d_ToolDisk.hxx>
|
||||
#include <Prs3d_ToolSphere.hxx>
|
||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||
#include <SelectMgr_SequenceOfOwner.hxx>
|
||||
#include <V3d.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_ViewCube, AIS_InteractiveObject)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_ViewCubeOwner, SelectMgr_EntityOwner)
|
||||
|
||||
namespace
|
||||
{
|
||||
static const Standard_Integer THE_NB_ROUND_SPLITS = 8;
|
||||
static const Standard_Integer THE_NB_DISK_SLICES = 20;
|
||||
static const Standard_Integer THE_NB_ARROW_FACETTES = 20;
|
||||
|
||||
//! Return the number of non-zero components.
|
||||
static Standard_Integer nbDirectionComponents (const gp_Dir& theDir)
|
||||
{
|
||||
Standard_Integer aNbComps = 0;
|
||||
for (Standard_Integer aCompIter = 1; aCompIter <= 3; ++aCompIter)
|
||||
{
|
||||
if (Abs (theDir.Coord (aCompIter)) > gp::Resolution())
|
||||
{
|
||||
++aNbComps;
|
||||
}
|
||||
}
|
||||
return aNbComps;
|
||||
}
|
||||
}
|
||||
|
||||
//! Simple sensitive element for picking by point only.
|
||||
class AIS_ViewCubeSensitive : public Select3D_SensitivePrimitiveArray
|
||||
{
|
||||
DEFINE_STANDARD_RTTI_INLINE(AIS_ViewCubeSensitive, Select3D_SensitivePrimitiveArray)
|
||||
public:
|
||||
//! Constructor.
|
||||
AIS_ViewCubeSensitive (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(Graphic3d_ArrayOfTriangles)& theTris)
|
||||
: Select3D_SensitivePrimitiveArray (theOwner)
|
||||
{
|
||||
InitTriangulation (theTris->Attributes(), theTris->Indices(), TopLoc_Location());
|
||||
}
|
||||
|
||||
//! Checks whether element overlaps current selecting volume.
|
||||
virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE
|
||||
{
|
||||
return isValidRay (theMgr)
|
||||
&& Select3D_SensitivePrimitiveArray::Matches (theMgr, thePickResult);
|
||||
}
|
||||
|
||||
//! Checks if picking ray can be used for detection.
|
||||
bool isValidRay (const SelectBasics_SelectingVolumeManager& theMgr) const
|
||||
{
|
||||
if (theMgr.GetActiveSelectionType() != SelectBasics_SelectingVolumeManager::Point)
|
||||
{
|
||||
// disallow rectangular selection
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AIS_ViewCubeOwner* anOwner = dynamic_cast<AIS_ViewCubeOwner* >(myOwnerId.get()))
|
||||
{
|
||||
const Standard_Real anAngleToler = 10.0 * M_PI / 180.0;
|
||||
const gp_Vec aRay (theMgr.GetNearPickedPnt(), theMgr.GetFarPickedPnt());
|
||||
const gp_Dir aDir = V3d::GetProjAxis (anOwner->MainOrientation());
|
||||
return !aRay.IsNormal (aDir, anAngleToler);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : IsBoxSide
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
bool AIS_ViewCube::IsBoxSide (V3d_TypeOfOrientation theOrient)
|
||||
{
|
||||
return nbDirectionComponents (V3d::GetProjAxis (theOrient)) == 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsBoxEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
bool AIS_ViewCube::IsBoxEdge (V3d_TypeOfOrientation theOrient)
|
||||
{
|
||||
return nbDirectionComponents (V3d::GetProjAxis (theOrient)) == 2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsBoxCorner
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
bool AIS_ViewCube::IsBoxCorner (V3d_TypeOfOrientation theOrient)
|
||||
{
|
||||
return nbDirectionComponents (V3d::GetProjAxis (theOrient)) == 3;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AIS_ViewCube
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_ViewCube::AIS_ViewCube()
|
||||
: myBoxEdgeAspect (new Prs3d_ShadingAspect()),
|
||||
myBoxCornerAspect (new Prs3d_ShadingAspect()),
|
||||
mySize (1.0),
|
||||
myBoxEdgeMinSize (2.0),
|
||||
myBoxEdgeGap (0.0),
|
||||
myBoxFacetExtension (1.0),
|
||||
myAxesPadding (1.0),
|
||||
myCornerMinSize (2.0),
|
||||
myRoundRadius (0.0),
|
||||
myToDisplayAxes (true),
|
||||
myToDisplayEdges (true),
|
||||
myToDisplayVertices (true),
|
||||
myIsYup (false),
|
||||
myViewAnimation (new AIS_AnimationCamera ("AIS_ViewCube", Handle(V3d_View)())),
|
||||
myStartState(new Graphic3d_Camera()),
|
||||
myEndState (new Graphic3d_Camera()),
|
||||
myDuration (0.5),
|
||||
myToAutoStartAnim (true),
|
||||
myIsFixedAnimation (true),
|
||||
myToFitSelected (true),
|
||||
myToResetCameraUp (false)
|
||||
{
|
||||
myInfiniteState = true;
|
||||
myIsMutable = true;
|
||||
myDrawer->SetZLayer (Graphic3d_ZLayerId_Topmost);
|
||||
myTransformPersistence = new Graphic3d_TransformPers (Graphic3d_TMF_TriedronPers, Aspect_TOTP_LEFT_LOWER, Graphic3d_Vec2i (100, 100));
|
||||
|
||||
myDrawer->SetTextAspect (new Prs3d_TextAspect());
|
||||
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
|
||||
myDynHilightDrawer = new Prs3d_Drawer();
|
||||
myDynHilightDrawer->SetLink (myDrawer);
|
||||
myDynHilightDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
|
||||
setDefaultAttributes();
|
||||
setDefaultHighlightAttributes();
|
||||
|
||||
// setup default labels
|
||||
myBoxSideLabels.Bind (V3d_TypeOfOrientation_Zup_Front, "FRONT");
|
||||
myBoxSideLabels.Bind (V3d_TypeOfOrientation_Zup_Back, "BACK");
|
||||
myBoxSideLabels.Bind (V3d_TypeOfOrientation_Zup_Top, "TOP");
|
||||
myBoxSideLabels.Bind (V3d_TypeOfOrientation_Zup_Bottom, "BOTTOM");
|
||||
myBoxSideLabels.Bind (V3d_TypeOfOrientation_Zup_Left, "LEFT");
|
||||
myBoxSideLabels.Bind (V3d_TypeOfOrientation_Zup_Right, "RIGHT");
|
||||
|
||||
myAxesLabels.Bind (Prs3d_DP_XAxis, "X");
|
||||
myAxesLabels.Bind (Prs3d_DP_YAxis, "Y");
|
||||
myAxesLabels.Bind (Prs3d_DP_ZAxis, "Z");
|
||||
|
||||
// define default size
|
||||
SetSize (70.0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : setDefaultAttributes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ViewCube::setDefaultAttributes()
|
||||
{
|
||||
myDrawer->TextAspect()->SetHorizontalJustification(Graphic3d_HTA_CENTER);
|
||||
myDrawer->TextAspect()->SetVerticalJustification (Graphic3d_VTA_CENTER);
|
||||
myDrawer->TextAspect()->SetColor (Quantity_NOC_BLACK);
|
||||
myDrawer->TextAspect()->SetFont (Font_NOF_SANS_SERIF);
|
||||
myDrawer->TextAspect()->SetHeight (16.0);
|
||||
// this should be forced back-face culling regardless Closed flag
|
||||
myDrawer->TextAspect()->Aspect()->SetSuppressBackFaces (true);
|
||||
|
||||
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_UserDefined);
|
||||
aMat.SetColor (Quantity_NOC_WHITE);
|
||||
aMat.SetAmbientColor (Quantity_NOC_GRAY60);
|
||||
|
||||
const Handle(Graphic3d_AspectFillArea3d)& aShading = myDrawer->ShadingAspect()->Aspect();
|
||||
aShading->SetInteriorStyle (Aspect_IS_SOLID);
|
||||
// this should be forced back-face culling regardless Closed flag
|
||||
aShading->SetSuppressBackFaces (true);
|
||||
aShading->SetInteriorColor (aMat.Color());
|
||||
aShading->SetFrontMaterial (aMat);
|
||||
myDrawer->SetFaceBoundaryDraw (false);
|
||||
|
||||
*myBoxEdgeAspect ->Aspect() = *aShading;
|
||||
myBoxEdgeAspect->SetColor (Quantity_NOC_GRAY30);
|
||||
*myBoxCornerAspect->Aspect() = *aShading;
|
||||
myBoxCornerAspect->SetColor (Quantity_NOC_GRAY30);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : setDefaultHighlightAttributes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ViewCube::setDefaultHighlightAttributes()
|
||||
{
|
||||
Graphic3d_MaterialAspect aHighlightMaterial;
|
||||
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
|
||||
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
|
||||
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
|
||||
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
|
||||
aHighlightMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
|
||||
myDynHilightDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
myDynHilightDrawer->ShadingAspect()->SetMaterial (aHighlightMaterial);
|
||||
myDynHilightDrawer->ShadingAspect()->SetColor (Quantity_NOC_CYAN1);
|
||||
myDynHilightDrawer->SetZLayer (Graphic3d_ZLayerId_Topmost);
|
||||
myDynHilightDrawer->SetColor (Quantity_NOC_CYAN1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetYup
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ViewCube::SetYup (Standard_Boolean theIsYup,
|
||||
Standard_Boolean theToUpdateLabels)
|
||||
{
|
||||
if (myIsYup == theIsYup)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myIsYup = theIsYup;
|
||||
|
||||
static const V3d_TypeOfOrientation THE_ZUP_ORI_LIST[6] =
|
||||
{
|
||||
V3d_TypeOfOrientation_Zup_Front, V3d_TypeOfOrientation_Zup_Back,
|
||||
V3d_TypeOfOrientation_Zup_Top, V3d_TypeOfOrientation_Zup_Bottom,
|
||||
V3d_TypeOfOrientation_Zup_Left, V3d_TypeOfOrientation_Zup_Right
|
||||
};
|
||||
static const V3d_TypeOfOrientation THE_YUP_ORI_LIST[6] =
|
||||
{
|
||||
V3d_TypeOfOrientation_Yup_Front, V3d_TypeOfOrientation_Yup_Back,
|
||||
V3d_TypeOfOrientation_Yup_Top, V3d_TypeOfOrientation_Yup_Bottom,
|
||||
V3d_TypeOfOrientation_Yup_Left, V3d_TypeOfOrientation_Yup_Right
|
||||
};
|
||||
if (theToUpdateLabels)
|
||||
{
|
||||
NCollection_Array1<TCollection_AsciiString> aLabels (0, 5);
|
||||
for (Standard_Integer aLabelIter = 0; aLabelIter < 6; ++aLabelIter)
|
||||
{
|
||||
myBoxSideLabels.Find (!myIsYup ? THE_YUP_ORI_LIST[aLabelIter] : THE_ZUP_ORI_LIST[aLabelIter],
|
||||
aLabels.ChangeValue (aLabelIter));
|
||||
}
|
||||
for (Standard_Integer aLabelIter = 0; aLabelIter < 6; ++aLabelIter)
|
||||
{
|
||||
myBoxSideLabels.Bind (myIsYup ? THE_YUP_ORI_LIST[aLabelIter] : THE_ZUP_ORI_LIST[aLabelIter],
|
||||
aLabels.Value (aLabelIter));
|
||||
}
|
||||
}
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ResetStyles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ViewCube::ResetStyles()
|
||||
{
|
||||
UnsetAttributes();
|
||||
UnsetHilightAttributes();
|
||||
|
||||
myBoxEdgeMinSize = 2.0;
|
||||
myCornerMinSize = 2.0;
|
||||
myBoxEdgeGap = 0.0;
|
||||
myRoundRadius = 0.0;
|
||||
|
||||
myToDisplayAxes = true;
|
||||
myToDisplayEdges = true;
|
||||
myToDisplayVertices = true;
|
||||
|
||||
myBoxFacetExtension = 1.0;
|
||||
myAxesPadding = 1.0;
|
||||
SetSize (70.0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetSize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ViewCube::SetSize (Standard_Real theValue,
|
||||
Standard_Boolean theToAdaptAnother)
|
||||
{
|
||||
const bool isNewSize = Abs (mySize - theValue) > Precision::Confusion();
|
||||
mySize = theValue;
|
||||
if (theToAdaptAnother)
|
||||
{
|
||||
if (myBoxFacetExtension > 0.0)
|
||||
{
|
||||
SetBoxFacetExtension (mySize * 0.15);
|
||||
}
|
||||
if (myAxesPadding > 0.0)
|
||||
{
|
||||
SetAxesPadding (mySize * 0.1);
|
||||
}
|
||||
SetFontHeight (mySize * 0.16);
|
||||
}
|
||||
if (isNewSize)
|
||||
{
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetRoundRadius
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ViewCube::SetRoundRadius (const Standard_Real theValue)
|
||||
{
|
||||
Standard_OutOfRange_Raise_if (theValue < 0.0 || theValue > 0.5,
|
||||
"AIS_ViewCube::SetRoundRadius(): theValue should be in [0; 0.5]");
|
||||
if (Abs (myRoundRadius - theValue) > Precision::Confusion())
|
||||
{
|
||||
myRoundRadius = theValue;
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : createRoundRectangleTriangles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Graphic3d_ArrayOfTriangles) AIS_ViewCube::createRoundRectangleTriangles (const gp_XY& theSize,
|
||||
Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf)
|
||||
{
|
||||
const Standard_Real aRadius = Min (theRadius, Min (theSize.X(), theSize.Y()) * 0.5);
|
||||
const gp_XY aHSize (theSize.X() * 0.5 - aRadius, theSize.Y() * 0.5 - aRadius);
|
||||
const gp_Dir aNorm = gp::DZ().Transformed (theTrsf);
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris;
|
||||
if (aRadius > 0.0)
|
||||
{
|
||||
const Standard_Integer aNbNodes = (THE_NB_ROUND_SPLITS + 1) * 4 + 1;
|
||||
aTris = new Graphic3d_ArrayOfTriangles (aNbNodes, aNbNodes * 3, Graphic3d_ArrayFlags_VertexNormal);
|
||||
|
||||
aTris->AddVertex (gp_Pnt (0.0, 0.0, 0.0).Transformed (theTrsf));
|
||||
for (Standard_Integer aNodeIter = 0; aNodeIter <= THE_NB_ROUND_SPLITS; ++aNodeIter)
|
||||
{
|
||||
const Standard_Real anAngle = NCollection_Lerp<Standard_Real>::Interpolate (M_PI * 0.5, 0.0, Standard_Real(aNodeIter) / Standard_Real(THE_NB_ROUND_SPLITS));
|
||||
aTris->AddVertex (gp_Pnt (aHSize.X() + aRadius * Cos (anAngle), aHSize.Y() + aRadius * Sin (anAngle), 0.0).Transformed (theTrsf));
|
||||
}
|
||||
for (Standard_Integer aNodeIter = 0; aNodeIter <= THE_NB_ROUND_SPLITS; ++aNodeIter)
|
||||
{
|
||||
const Standard_Real anAngle = NCollection_Lerp<Standard_Real>::Interpolate (0.0, -M_PI * 0.5, Standard_Real(aNodeIter) / Standard_Real(THE_NB_ROUND_SPLITS));
|
||||
aTris->AddVertex (gp_Pnt (aHSize.X() + aRadius * Cos (anAngle), -aHSize.Y() + aRadius * Sin (anAngle), 0.0).Transformed (theTrsf));
|
||||
}
|
||||
for (Standard_Integer aNodeIter = 0; aNodeIter <= THE_NB_ROUND_SPLITS; ++aNodeIter)
|
||||
{
|
||||
const Standard_Real anAngle = NCollection_Lerp<Standard_Real>::Interpolate (-M_PI * 0.5, -M_PI, Standard_Real(aNodeIter) / Standard_Real(THE_NB_ROUND_SPLITS));
|
||||
aTris->AddVertex (gp_Pnt (-aHSize.X() + aRadius * Cos (anAngle), -aHSize.Y() + aRadius * Sin (anAngle), 0.0).Transformed (theTrsf));
|
||||
}
|
||||
for (Standard_Integer aNodeIter = 0; aNodeIter <= THE_NB_ROUND_SPLITS; ++aNodeIter)
|
||||
{
|
||||
const Standard_Real anAngle = NCollection_Lerp<Standard_Real>::Interpolate (-M_PI, -M_PI * 1.5, Standard_Real(aNodeIter) / Standard_Real(THE_NB_ROUND_SPLITS));
|
||||
aTris->AddVertex (gp_Pnt (-aHSize.X() + aRadius * Cos (anAngle), aHSize.Y() + aRadius * Sin (anAngle), 0.0).Transformed (theTrsf));
|
||||
}
|
||||
|
||||
// split triangle fan
|
||||
for (Standard_Integer aNodeIter = 2; aNodeIter <= aTris->VertexNumber(); ++aNodeIter)
|
||||
{
|
||||
aTris->AddEdge (1);
|
||||
aTris->AddEdge (aNodeIter - 1);
|
||||
aTris->AddEdge (aNodeIter);
|
||||
}
|
||||
aTris->AddEdge (1);
|
||||
aTris->AddEdge (aTris->VertexNumber());
|
||||
aTris->AddEdge (2);
|
||||
}
|
||||
else
|
||||
{
|
||||
aTris = new Graphic3d_ArrayOfTriangles (4, 6, Graphic3d_ArrayFlags_VertexNormal);
|
||||
aTris->AddVertex (gp_Pnt (-aHSize.X(), -aHSize.Y(), 0.0).Transformed (theTrsf));
|
||||
aTris->AddVertex (gp_Pnt (-aHSize.X(), aHSize.Y(), 0.0).Transformed (theTrsf));
|
||||
aTris->AddVertex (gp_Pnt ( aHSize.X(), aHSize.Y(), 0.0).Transformed (theTrsf));
|
||||
aTris->AddVertex (gp_Pnt ( aHSize.X(), -aHSize.Y(), 0.0).Transformed (theTrsf));
|
||||
aTris->AddEdges (3, 1, 2);
|
||||
aTris->AddEdges (1, 3, 4);
|
||||
}
|
||||
|
||||
for (Standard_Integer aVertIter = 1; aVertIter <= aTris->VertexNumber(); ++aVertIter)
|
||||
{
|
||||
aTris->SetVertexNormal (aVertIter, -aNorm);
|
||||
}
|
||||
return aTris;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : createBoxPartTriangles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Graphic3d_ArrayOfTriangles) AIS_ViewCube::createBoxPartTriangles (V3d_TypeOfOrientation theDir) const
|
||||
{
|
||||
if (IsBoxSide (theDir))
|
||||
{
|
||||
return createBoxSideTriangles (theDir);
|
||||
}
|
||||
else if (IsBoxEdge (theDir)
|
||||
&& myToDisplayEdges)
|
||||
{
|
||||
return createBoxEdgeTriangles (theDir);
|
||||
}
|
||||
else if (IsBoxCorner (theDir)
|
||||
&& myToDisplayVertices)
|
||||
{
|
||||
return createBoxCornerTriangles (theDir);
|
||||
}
|
||||
return Handle(Graphic3d_ArrayOfTriangles)();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : createBoxSideTriangles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Graphic3d_ArrayOfTriangles) AIS_ViewCube::createBoxSideTriangles (V3d_TypeOfOrientation theDirection) const
|
||||
{
|
||||
const gp_Dir aDir = V3d::GetProjAxis (theDirection);
|
||||
const gp_Pnt aPos = aDir.XYZ() * (mySize * 0.5 + myBoxFacetExtension);
|
||||
const gp_Ax2 aPosition (aPos, aDir.Reversed());
|
||||
|
||||
gp_Ax3 aSystem (aPosition);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aSystem, gp_Ax3());
|
||||
|
||||
return createRoundRectangleTriangles (gp_XY (mySize, mySize), myRoundRadius * mySize, aTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : createBoxEdgeTriangles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Graphic3d_ArrayOfTriangles) AIS_ViewCube::createBoxEdgeTriangles (V3d_TypeOfOrientation theDirection) const
|
||||
{
|
||||
const Standard_Real aThickness = Max (myBoxFacetExtension * gp_XY (1.0, 1.0).Modulus() - myBoxEdgeGap, myBoxEdgeMinSize);
|
||||
|
||||
const gp_Dir aDir = V3d::GetProjAxis (theDirection);
|
||||
const gp_Pnt aPos = aDir.XYZ() * (mySize * 0.5 * gp_XY (1.0, 1.0).Modulus() + myBoxFacetExtension * Cos (M_PI_4));
|
||||
const gp_Ax2 aPosition (aPos, aDir.Reversed());
|
||||
|
||||
gp_Ax3 aSystem (aPosition);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aSystem, gp_Ax3());
|
||||
|
||||
return createRoundRectangleTriangles (gp_XY (aThickness, mySize), myRoundRadius * mySize, aTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : createBoxCornerTriangles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Graphic3d_ArrayOfTriangles) AIS_ViewCube::createBoxCornerTriangles (V3d_TypeOfOrientation theDir) const
|
||||
{
|
||||
const Standard_Real aHSize = mySize * 0.5;
|
||||
const gp_Dir aDir = V3d::GetProjAxis (theDir);
|
||||
const gp_XYZ aHSizeDir = aDir.XYZ() * (aHSize * gp_Vec (1.0, 1.0, 1.0).Magnitude());
|
||||
if (myRoundRadius > 0.0)
|
||||
{
|
||||
const Standard_Real anEdgeHWidth = myBoxFacetExtension * gp_XY (1.0, 1.0).Modulus() * 0.5;
|
||||
const Standard_Real aHeight = anEdgeHWidth * Sqrt (2.0 / 3.0); // tetrahedron height
|
||||
const gp_Pnt aPos = aDir.XYZ() * (aHSize * gp_Vec (1.0, 1.0, 1.0).Magnitude() + aHeight);
|
||||
const gp_Ax2 aPosition (aPos, aDir.Reversed());
|
||||
gp_Ax3 aSystem (aPosition);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aSystem, gp_Ax3());
|
||||
const Standard_Real aRadius = Max (myBoxFacetExtension * 0.5 / Cos (M_PI_4), myCornerMinSize);
|
||||
return Prs3d_ToolDisk::Create (0.0, aRadius, THE_NB_DISK_SLICES, 1, aTrsf);
|
||||
}
|
||||
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles (3, 3, Graphic3d_ArrayFlags_VertexNormal);
|
||||
|
||||
aTris->AddVertex (aHSizeDir + myBoxFacetExtension * gp_Dir (aDir.X(), 0.0, 0.0).XYZ());
|
||||
aTris->AddVertex (aHSizeDir + myBoxFacetExtension * gp_Dir (0.0, aDir.Y(), 0.0).XYZ());
|
||||
aTris->AddVertex (aHSizeDir + myBoxFacetExtension * gp_Dir (0.0, 0.0, aDir.Z()).XYZ());
|
||||
|
||||
const gp_XYZ aNode1 = aTris->Vertice (1).XYZ();
|
||||
const gp_XYZ aNode2 = aTris->Vertice (2).XYZ();
|
||||
const gp_XYZ aNode3 = aTris->Vertice (3).XYZ();
|
||||
const gp_XYZ aNormTri = ((aNode2 - aNode1).Crossed (aNode3 - aNode1));
|
||||
if (aNormTri.Dot (aDir.XYZ()) < 0.0)
|
||||
{
|
||||
aTris->AddEdges (1, 3, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
aTris->AddEdges (1, 2, 3);
|
||||
}
|
||||
|
||||
for (Standard_Integer aVertIter = 1; aVertIter <= aTris->VertexNumber(); ++aVertIter)
|
||||
{
|
||||
aTris->SetVertexNormal (aVertIter, aDir);
|
||||
}
|
||||
return aTris;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
thePrs->SetInfiniteState (true);
|
||||
if (theMode != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const gp_Pnt aLocation = (mySize * 0.5 + myBoxFacetExtension + myAxesPadding) * gp_XYZ (-1.0, -1.0, -1.0);
|
||||
|
||||
// Display axes
|
||||
if (myToDisplayAxes)
|
||||
{
|
||||
const Standard_Real anAxisSize = mySize + 2.0 * myBoxFacetExtension + myAxesPadding;
|
||||
const Handle(Prs3d_DatumAspect)& aDatumAspect = myDrawer->DatumAspect();
|
||||
for (Standard_Integer anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter)
|
||||
{
|
||||
const Prs3d_DatumParts aPart = (Prs3d_DatumParts )anAxisIter;
|
||||
if (!aDatumAspect->DrawDatumPart (aPart))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
gp_Ax1 anAx1;
|
||||
switch (aPart)
|
||||
{
|
||||
case Prs3d_DP_XAxis: anAx1 = gp_Ax1 (aLocation, gp::DX()); break;
|
||||
case Prs3d_DP_YAxis: anAx1 = gp_Ax1 (aLocation, gp::DY()); break;
|
||||
case Prs3d_DP_ZAxis: anAx1 = gp_Ax1 (aLocation, gp::DZ()); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) anAxisGroup = thePrs->NewGroup();
|
||||
anAxisGroup->SetGroupPrimitivesAspect (aDatumAspect->ShadingAspect (aPart)->Aspect());
|
||||
|
||||
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);
|
||||
anAxisGroup->AddPrimitiveArray (aTriangleArray);
|
||||
|
||||
TCollection_AsciiString anAxisLabel;
|
||||
if (aDatumAspect->ToDrawLabels()
|
||||
&& myAxesLabels.Find (aPart, anAxisLabel)
|
||||
&& !anAxisLabel.IsEmpty())
|
||||
{
|
||||
Handle(Graphic3d_Group) anAxisLabelGroup = thePrs->NewGroup();
|
||||
gp_Pnt aTextOrigin = anAx1.Location().Translated (gp_Vec (anAx1.Direction().X() * (anAxisSize + anArrowLength),
|
||||
anAx1.Direction().Y() * (anAxisSize + anArrowLength),
|
||||
anAx1.Direction().Z() * (anAxisSize + anArrowLength)));
|
||||
Prs3d_Text::Draw (anAxisLabelGroup, aDatumAspect->TextAspect(), TCollection_ExtendedString (anAxisLabel), aTextOrigin);
|
||||
}
|
||||
}
|
||||
|
||||
// Display center
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
Handle(Prs3d_ShadingAspect) anAspectCen = new Prs3d_ShadingAspect();
|
||||
anAspectCen->SetColor (Quantity_NOC_WHITE);
|
||||
aGroup->SetGroupPrimitivesAspect (anAspectCen->Aspect());
|
||||
Prs3d_ToolSphere aTool (4.0, THE_NB_DISK_SLICES, THE_NB_DISK_SLICES);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTranslation (gp_Vec (gp::Origin(), aLocation));
|
||||
Handle(Graphic3d_ArrayOfTriangles) aCenterArray;
|
||||
aTool.FillArray (aCenterArray, aTrsf);
|
||||
aGroup->AddPrimitiveArray (aCenterArray);
|
||||
}
|
||||
}
|
||||
|
||||
// Display box
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroupSides = thePrs->NewGroup(), aGroupEdges = thePrs->NewGroup(), aGroupCorners = thePrs->NewGroup();
|
||||
aGroupSides->SetClosed (true); // should be replaced by forced back-face culling aspect
|
||||
aGroupSides->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
|
||||
aGroupEdges->SetClosed (true);
|
||||
aGroupEdges->SetGroupPrimitivesAspect (myBoxEdgeAspect->Aspect());
|
||||
|
||||
aGroupCorners->SetClosed (true);
|
||||
aGroupCorners->SetGroupPrimitivesAspect (myBoxCornerAspect->Aspect());
|
||||
|
||||
Handle(Graphic3d_Group) aTextGroup = thePrs->NewGroup();
|
||||
//aTextGroup->SetClosed (true);
|
||||
aTextGroup->SetGroupPrimitivesAspect (myDrawer->TextAspect()->Aspect());
|
||||
for (Standard_Integer aPartIter = 0; aPartIter <= Standard_Integer(V3d_XnegYnegZneg); ++aPartIter)
|
||||
{
|
||||
const V3d_TypeOfOrientation anOrient = (V3d_TypeOfOrientation )aPartIter;
|
||||
if (Handle(Graphic3d_ArrayOfTriangles) aTris = createBoxPartTriangles (anOrient))
|
||||
{
|
||||
if (IsBoxSide (anOrient))
|
||||
{
|
||||
aGroupSides->AddPrimitiveArray (aTris);
|
||||
|
||||
TCollection_AsciiString aLabel;
|
||||
if (!myBoxSideLabels.Find (anOrient, aLabel)
|
||||
|| aLabel.IsEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const gp_Dir aDir = V3d::GetProjAxis (anOrient);
|
||||
gp_Dir anUp = myIsYup ? gp::DY() : gp::DZ();
|
||||
if (myIsYup)
|
||||
{
|
||||
if (anOrient == V3d_Ypos
|
||||
|| anOrient == V3d_Yneg)
|
||||
{
|
||||
anUp = -gp::DZ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (anOrient == V3d_Zpos)
|
||||
{
|
||||
anUp = gp::DY();
|
||||
}
|
||||
else if (anOrient == V3d_Zneg)
|
||||
{
|
||||
anUp = -gp::DY();
|
||||
}
|
||||
}
|
||||
|
||||
const Standard_Real anOffset = 2.0; // extra offset to avoid overlapping with triangulation
|
||||
const gp_Pnt aPos = aDir.XYZ() * (mySize * 0.5 + myBoxFacetExtension + anOffset);
|
||||
const gp_Ax2 aPosition (aPos, aDir, anUp.Crossed (aDir));
|
||||
Prs3d_Text::Draw (aTextGroup, myDrawer->TextAspect(), aLabel, aPosition);
|
||||
}
|
||||
else if (IsBoxEdge (anOrient))
|
||||
{
|
||||
aGroupEdges->AddPrimitiveArray (aTris);
|
||||
}
|
||||
else if (IsBoxCorner (anOrient))
|
||||
{
|
||||
aGroupCorners->AddPrimitiveArray (aTris);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ViewCube::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (theMode != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Standard_Integer aPartIter = 0; aPartIter <= Standard_Integer(V3d_XnegYnegZneg); ++aPartIter)
|
||||
{
|
||||
const V3d_TypeOfOrientation anOri = (V3d_TypeOfOrientation )aPartIter;
|
||||
if (Handle(Graphic3d_ArrayOfTriangles) aTris = createBoxPartTriangles (anOri))
|
||||
{
|
||||
Standard_Integer aSensitivity = 2;
|
||||
if (IsBoxCorner (anOri))
|
||||
{
|
||||
aSensitivity = 8;
|
||||
}
|
||||
else if (IsBoxEdge (anOri))
|
||||
{
|
||||
aSensitivity = 4;
|
||||
}
|
||||
Handle(AIS_ViewCubeOwner) anOwner = new AIS_ViewCubeOwner (this, anOri);
|
||||
Handle(AIS_ViewCubeSensitive) aTriSens = new AIS_ViewCubeSensitive (anOwner, aTris);
|
||||
aTriSens->SetSensitivityFactor (aSensitivity);
|
||||
theSelection->Add (aTriSens);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasAnimation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_ViewCube::HasAnimation() const
|
||||
{
|
||||
return !myViewAnimation->IsStopped();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : StartAnimation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ViewCube::StartAnimation (const Handle(AIS_ViewCubeOwner)& theOwner)
|
||||
{
|
||||
Handle(V3d_View) aView = GetContext()->LastActiveView();
|
||||
if (theOwner.IsNull()
|
||||
|| aView.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myStartState->Copy (aView->Camera());
|
||||
myEndState ->Copy (aView->Camera());
|
||||
|
||||
{
|
||||
Handle(Graphic3d_Camera) aBackupCamera = new Graphic3d_Camera (aView->Camera());
|
||||
|
||||
const bool wasImmediateUpdate = aView->SetImmediateUpdate (false);
|
||||
aView->SetCamera (myEndState);
|
||||
aView->SetProj (theOwner->MainOrientation(), myIsYup);
|
||||
|
||||
const gp_Dir aNewDir = aView->Camera()->Direction();
|
||||
if (!myToResetCameraUp
|
||||
&& !aNewDir.IsEqual (aBackupCamera->Direction(), Precision::Angular()))
|
||||
{
|
||||
// find the Up direction closest to current instead of default one
|
||||
const gp_Ax1 aNewDirAx1 (gp::Origin(), aNewDir);
|
||||
const gp_Dir anOldUp = aBackupCamera->Up();
|
||||
const gp_Dir anUpList[4] =
|
||||
{
|
||||
aView->Camera()->Up(),
|
||||
aView->Camera()->Up().Rotated (aNewDirAx1, M_PI_2),
|
||||
aView->Camera()->Up().Rotated (aNewDirAx1, M_PI),
|
||||
aView->Camera()->Up().Rotated (aNewDirAx1, M_PI * 1.5),
|
||||
};
|
||||
|
||||
Standard_Real aBestAngle = Precision::Infinite();
|
||||
gp_Dir anUpBest;
|
||||
for (Standard_Integer anUpIter = 0; anUpIter < 4; ++anUpIter)
|
||||
{
|
||||
Standard_Real anAngle = anUpList[anUpIter].Angle (anOldUp);
|
||||
if (aBestAngle > anAngle)
|
||||
{
|
||||
aBestAngle = anAngle;
|
||||
anUpBest = anUpList[anUpIter];
|
||||
}
|
||||
}
|
||||
aView->Camera()->SetUp (anUpBest);
|
||||
}
|
||||
|
||||
const Bnd_Box aBndSelected = myToFitSelected ? GetContext()->BoundingBoxOfSelection() : Bnd_Box();
|
||||
if (!aBndSelected.IsVoid())
|
||||
{
|
||||
aView->FitAll (aBndSelected, 0.01, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
aView->FitAll (0.01, false);
|
||||
}
|
||||
aView->SetCamera (aBackupCamera);
|
||||
aView->SetImmediateUpdate (wasImmediateUpdate);
|
||||
}
|
||||
|
||||
myViewAnimation->SetView (aView);
|
||||
myViewAnimation->SetCameraStart (myStartState);
|
||||
myViewAnimation->SetCameraEnd (myEndState);
|
||||
myViewAnimation->SetOwnDuration (myDuration);
|
||||
myViewAnimation->StartTimer (0.0, 1.0, true, false);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : updateAnimation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_ViewCube::updateAnimation()
|
||||
{
|
||||
const Standard_Real aPts = myViewAnimation->UpdateTimer();
|
||||
if (aPts >= myDuration)
|
||||
{
|
||||
myViewAnimation->Stop();
|
||||
onAnimationFinished();
|
||||
myViewAnimation->SetView (Handle(V3d_View)());
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateAnimation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_ViewCube::UpdateAnimation (const Standard_Boolean theToUpdate)
|
||||
{
|
||||
Handle(V3d_View) aView = myViewAnimation->View();
|
||||
if (!HasAnimation()
|
||||
|| !updateAnimation())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if (theToUpdate
|
||||
&& !aView.IsNull())
|
||||
{
|
||||
aView->IsInvalidated() ? aView->Redraw() : aView->RedrawImmediate();
|
||||
}
|
||||
|
||||
onAfterAnimation();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HandleClick
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ViewCube::HandleClick (const Handle(AIS_ViewCubeOwner)& theOwner)
|
||||
{
|
||||
if (!myToAutoStartAnim)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StartAnimation (theOwner);
|
||||
if (!myIsFixedAnimation)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (; HasAnimation(); )
|
||||
{
|
||||
UpdateAnimation (true);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HilightOwnerWithColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ViewCube::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Drawer)& theStyle,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner)
|
||||
{
|
||||
if (theOwner.IsNull()
|
||||
|| !thePrsMgr->IsImmediateModeOn())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Graphic3d_ZLayerId aLayer = theStyle->ZLayer() != Graphic3d_ZLayerId_UNKNOWN ? theStyle->ZLayer() : myDrawer->ZLayer();
|
||||
const AIS_ViewCubeOwner* aCubeOwner = dynamic_cast<AIS_ViewCubeOwner* >(theOwner.get());
|
||||
|
||||
Handle(Prs3d_Presentation) aHiPrs = GetHilightPresentation (thePrsMgr);
|
||||
aHiPrs->Clear();
|
||||
aHiPrs->CStructure()->ViewAffinity = thePrsMgr->StructureManager()->ObjectAffinity (Handle(Standard_Transient)(this));
|
||||
aHiPrs->SetTransformPersistence (TransformPersistence());
|
||||
aHiPrs->SetZLayer (aLayer);
|
||||
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = aHiPrs->NewGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (theStyle->ShadingAspect()->Aspect());
|
||||
if (Handle(Graphic3d_ArrayOfTriangles) aTris = createBoxPartTriangles (aCubeOwner->MainOrientation()))
|
||||
{
|
||||
aGroup->AddPrimitiveArray (aTris);
|
||||
}
|
||||
}
|
||||
|
||||
if (thePrsMgr->IsImmediateModeOn())
|
||||
{
|
||||
thePrsMgr->AddToImmediateList (aHiPrs);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HilightSelected
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ViewCube::HilightSelected (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
const SelectMgr_SequenceOfOwner& theSeq)
|
||||
{
|
||||
// this method should never be called since AIS_InteractiveObject::HandleClick() has been overridden
|
||||
if (theSeq.Size() == 1)
|
||||
{
|
||||
//HandleClick (Handle(AIS_ViewCubeOwner)::DownCast (theSeq.First()));
|
||||
}
|
||||
}
|
645
src/AIS/AIS_ViewCube.hxx
Normal file
645
src/AIS/AIS_ViewCube.hxx
Normal file
@@ -0,0 +1,645 @@
|
||||
// Created on: 2017-07-25
|
||||
// Created by: Anastasia BOBYLEVA
|
||||
// Copyright (c) 2017-2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_ViewCube_HeaderFile
|
||||
#define _AIS_ViewCube_HeaderFile
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Graphic3d_Camera.hxx>
|
||||
#include <Graphic3d_Vec2.hxx>
|
||||
#include <Prs3d_DatumParts.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <V3d_TypeOfOrientation.hxx>
|
||||
|
||||
class AIS_AnimationCamera;
|
||||
class AIS_ViewCubeOwner;
|
||||
class Graphic3d_ArrayOfTriangles;
|
||||
|
||||
//! Interactive object for displaying the view manipulation cube.
|
||||
//!
|
||||
//! View cube consists of several parts that are responsible for different camera manipulations:
|
||||
//! @li Cube sides represent main views: top, bottom, left, right, front and back.
|
||||
//! @li Edges represent rotation of one of main views on 45 degrees.
|
||||
//! @li Vertices represent rotation of one of man views in two directions.
|
||||
//!
|
||||
//! The object is expected to behave like a trihedron in the view corner,
|
||||
//! therefore its position should be defined using transformation persistence flags:
|
||||
//! @code SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_TriedronPers, Aspect_TOTP_LEFT_LOWER, Graphic3d_Vec2i (100, 100)); @endcode
|
||||
//!
|
||||
//! View Cube parts are sensitive to detection, or dynamic highlighting (but not selection),
|
||||
//! and every its owner AIS_ViewCubeOwner corresponds to camera transformation.
|
||||
//! @code
|
||||
//! for (aViewCube->StartAnimation (aDetectedOwner); aViewCube->HasAnimation(); )
|
||||
//! {
|
||||
//! aViewCube->UpdateAnimation();
|
||||
//! ... // updating of application window
|
||||
//! }
|
||||
//! @endcode
|
||||
//! or
|
||||
//! @code aViewCube->HandleClick (aDetectedOwner); @endcode
|
||||
//! that includes transformation loop.
|
||||
//! This loop allows external actions like application updating. For this purpose AIS_ViewCube has virtual interface onAfterAnimation(),
|
||||
//! that is to be redefined on application level.
|
||||
class AIS_ViewCube : public AIS_InteractiveObject
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_ViewCube, AIS_InteractiveObject)
|
||||
public:
|
||||
|
||||
//! Return TRUE if specified orientation belongs to box side.
|
||||
Standard_EXPORT static bool IsBoxSide (V3d_TypeOfOrientation theOrient);
|
||||
|
||||
//! Return TRUE if specified orientation belongs to box edge.
|
||||
Standard_EXPORT static bool IsBoxEdge (V3d_TypeOfOrientation theOrient);
|
||||
|
||||
//! Return TRUE if specified orientation belongs to box corner (vertex).
|
||||
Standard_EXPORT static bool IsBoxCorner (V3d_TypeOfOrientation theOrient);
|
||||
|
||||
public:
|
||||
|
||||
//! Empty constructor.
|
||||
Standard_EXPORT AIS_ViewCube();
|
||||
|
||||
//! Return view animation.
|
||||
const Handle(AIS_AnimationCamera)& ViewAnimation() const { return myViewAnimation; }
|
||||
|
||||
//! Set view animation.
|
||||
void SetViewAnimation (const Handle(AIS_AnimationCamera)& theAnimation) { myViewAnimation = theAnimation; }
|
||||
|
||||
//! Return TRUE if automatic camera transformation on selection (highlighting) is enabled; TRUE by default.
|
||||
Standard_Boolean ToAutoStartAnimation() const { return myToAutoStartAnim; }
|
||||
|
||||
//! Enable/disable automatic camera transformation on selection (highlighting).
|
||||
//! The automatic logic can be disabled if application wants performing action manually
|
||||
//! basing on picking results (AIS_ViewCubeOwner).
|
||||
void SetAutoStartAnimation (bool theToEnable) { myToAutoStartAnim = theToEnable; }
|
||||
|
||||
//! Return TRUE if camera animation should be done in uninterruptible loop; TRUE by default.
|
||||
Standard_Boolean IsFixedAnimationLoop() const { return myIsFixedAnimation; }
|
||||
|
||||
//! Set if camera animation should be done in uninterruptible loop.
|
||||
void SetFixedAnimationLoop (bool theToEnable) { myIsFixedAnimation = theToEnable; }
|
||||
|
||||
//! Reset all size and style parameters to default.
|
||||
//! @warning It doesn't reset position of View Cube
|
||||
Standard_EXPORT void ResetStyles();
|
||||
|
||||
protected:
|
||||
|
||||
//! Set default visual attributes
|
||||
Standard_EXPORT void setDefaultAttributes();
|
||||
|
||||
//! Set default dynamic highlight properties
|
||||
Standard_EXPORT void setDefaultHighlightAttributes();
|
||||
|
||||
public: //! @name Geometry management API
|
||||
|
||||
//! @return size (width and height) of View cube sides; 100 by default.
|
||||
Standard_Real Size() const { return mySize; }
|
||||
|
||||
//! Sets size (width and height) of View cube sides.
|
||||
//! @param theToAdaptAnother if TRUE, then other parameters will be adapted to specified size
|
||||
Standard_EXPORT void SetSize (Standard_Real theValue,
|
||||
Standard_Boolean theToAdaptAnother = true);
|
||||
|
||||
//! Return box facet extension to edge/corner facet split; 10 by default.
|
||||
Standard_Real BoxFacetExtension() const { return myBoxFacetExtension; }
|
||||
|
||||
//! Set new value of box facet extension.
|
||||
void SetBoxFacetExtension (Standard_Real theValue)
|
||||
{
|
||||
if (Abs (myBoxFacetExtension - theValue) > Precision::Confusion())
|
||||
{
|
||||
myBoxFacetExtension = theValue;
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//! Return padding between axes and 3D part (box); 10 by default.
|
||||
Standard_Real AxesPadding() const { return myAxesPadding; }
|
||||
|
||||
//! Set new value of padding between axes and 3D part (box).
|
||||
void SetAxesPadding (Standard_Real theValue)
|
||||
{
|
||||
if (Abs (myAxesPadding - theValue) > Precision::Confusion())
|
||||
{
|
||||
myAxesPadding = theValue;
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//! Return gap between box edges and box sides; 0 by default.
|
||||
Standard_Real BoxEdgeGap() const { return myBoxEdgeGap; }
|
||||
|
||||
//! Set new value of box edges gap.
|
||||
void SetBoxEdgeGap (Standard_Real theValue)
|
||||
{
|
||||
if (Abs (myBoxEdgeGap - theValue) > Precision::Confusion())
|
||||
{
|
||||
myBoxEdgeGap = theValue;
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//! Return minimal size of box edge; 2 by default.
|
||||
Standard_Real BoxEdgeMinSize() const { return myBoxEdgeMinSize; }
|
||||
|
||||
//! Set new value of box edge minimal size.
|
||||
void SetBoxEdgeMinSize (Standard_Real theValue)
|
||||
{
|
||||
if (Abs (myBoxEdgeMinSize - theValue) > Precision::Confusion())
|
||||
{
|
||||
myBoxEdgeMinSize = theValue;
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//! Return minimal size of box corner; 2 by default.
|
||||
Standard_Real BoxCornerMinSize() const { return myCornerMinSize; }
|
||||
|
||||
//! Set new value of box corner minimal size.
|
||||
void SetBoxCornerMinSize (Standard_Real theValue)
|
||||
{
|
||||
if (Abs (myCornerMinSize - theValue) > Precision::Confusion())
|
||||
{
|
||||
myCornerMinSize = theValue;
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//! Return relative radius of side corners (round rectangle); 0.0 by default.
|
||||
//! The value in within [0, 0.5] range meaning absolute radius = RoundRadius() / Size().
|
||||
Standard_Real RoundRadius() const { return myRoundRadius; }
|
||||
|
||||
//! Set relative radius of View Cube sides corners (round rectangle).
|
||||
//! The value should be within [0, 0.5] range.
|
||||
Standard_EXPORT void SetRoundRadius (const Standard_Real theValue);
|
||||
|
||||
//! @return TRUE if trihedron is drawn; TRUE by default.
|
||||
Standard_Boolean ToDrawAxes() const { return myToDisplayAxes; }
|
||||
|
||||
//! Enable/disable drawing of trihedron.
|
||||
void SetDrawAxes (Standard_Boolean theValue)
|
||||
{
|
||||
if (myToDisplayAxes != theValue)
|
||||
{
|
||||
myToDisplayAxes = theValue;
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//! @return TRUE if edges of View Cube is drawn; TRUE by default.
|
||||
Standard_Boolean ToDrawEdges() const { return myToDisplayEdges; }
|
||||
|
||||
//! Enable/disable drawing of edges of View Cube.
|
||||
void SetDrawEdges (Standard_Boolean theValue)
|
||||
{
|
||||
if (myToDisplayEdges != theValue)
|
||||
{
|
||||
myToDisplayEdges = theValue;
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//! Return TRUE if vertices (vertex) of View Cube is drawn; TRUE by default.
|
||||
Standard_Boolean ToDrawVertices() const { return myToDisplayVertices; }
|
||||
|
||||
//! Enable/disable drawing of vertices (corners) of View Cube.
|
||||
void SetDrawVertices (Standard_Boolean theValue)
|
||||
{
|
||||
if (myToDisplayVertices != theValue)
|
||||
{
|
||||
myToDisplayVertices = theValue;
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//! Return TRUE if application expects Y-up viewer orientation instead of Z-up; FALSE by default.
|
||||
Standard_Boolean IsYup() const { return myIsYup; }
|
||||
|
||||
//! Set if application expects Y-up viewer orientation instead of Z-up.
|
||||
Standard_EXPORT void SetYup (Standard_Boolean theIsYup,
|
||||
Standard_Boolean theToUpdateLabels = Standard_True);
|
||||
|
||||
public: //! @name Style management API
|
||||
|
||||
//! Return shading style of box sides.
|
||||
const Handle(Prs3d_ShadingAspect)& BoxSideStyle() const { return myDrawer->ShadingAspect(); }
|
||||
|
||||
//! Return shading style of box edges.
|
||||
const Handle(Prs3d_ShadingAspect)& BoxEdgeStyle() const { return myBoxEdgeAspect; }
|
||||
|
||||
//! Return shading style of box corners.
|
||||
const Handle(Prs3d_ShadingAspect)& BoxCornerStyle() const { return myBoxCornerAspect; }
|
||||
|
||||
//! Return value of front color for the 3D part of object.
|
||||
const Quantity_Color& BoxColor() const { return myDrawer->ShadingAspect()->Color(); }
|
||||
|
||||
//! Set new value of front color for the 3D part of object.
|
||||
//! @param theColor [in] input color value.
|
||||
void SetBoxColor (const Quantity_Color& theColor)
|
||||
{
|
||||
if (!myDrawer->ShadingAspect()->Color().IsEqual (theColor)
|
||||
|| !myBoxEdgeAspect ->Color().IsEqual (theColor)
|
||||
|| !myBoxCornerAspect->Color().IsEqual (theColor))
|
||||
{
|
||||
myDrawer->ShadingAspect()->SetColor (theColor);
|
||||
myBoxEdgeAspect->SetColor (theColor);
|
||||
myBoxCornerAspect->SetColor (theColor);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
}
|
||||
|
||||
//! Return transparency for 3D part of object.
|
||||
Standard_Real BoxTransparency() const { return myDrawer->ShadingAspect()->Transparency(); }
|
||||
|
||||
//! Set new value of transparency for 3D part of object.
|
||||
//! @param theValue [in] input transparency value
|
||||
void SetBoxTransparency (Standard_Real theValue)
|
||||
{
|
||||
if (Abs (myDrawer->ShadingAspect()->Transparency() - theValue) > Precision::Confusion()
|
||||
|| Abs (myBoxEdgeAspect ->Transparency() - theValue) > Precision::Confusion()
|
||||
|| Abs (myBoxCornerAspect->Transparency() - theValue) > Precision::Confusion())
|
||||
{
|
||||
myDrawer->ShadingAspect()->SetTransparency (theValue);
|
||||
myBoxEdgeAspect->SetTransparency (theValue);
|
||||
myBoxCornerAspect->SetTransparency (theValue);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
}
|
||||
|
||||
//! Return color of sides back material.
|
||||
const Quantity_Color& InnerColor() const { return myDrawer->ShadingAspect()->Color (Aspect_TOFM_BACK_SIDE); }
|
||||
|
||||
//! Set color of sides back material. Alias for:
|
||||
//! @code Attributes()->ShadingAspect()->Aspect()->ChangeBackMaterial().SetColor() @endcode
|
||||
void SetInnerColor (const Quantity_Color& theColor)
|
||||
{
|
||||
myDrawer->ShadingAspect()->SetColor (theColor, Aspect_TOFM_BACK_SIDE);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
//! Return box side label or empty string if undefined.
|
||||
//! Default labels: FRONT, BACK, LEFT, RIGHT, TOP, BOTTOM.
|
||||
TCollection_AsciiString BoxSideLabel (V3d_TypeOfOrientation theSide) const
|
||||
{
|
||||
const TCollection_AsciiString* aLabel = myBoxSideLabels.Seek (theSide);
|
||||
return aLabel != NULL ? *aLabel : TCollection_AsciiString();
|
||||
}
|
||||
|
||||
//! Set box side label.
|
||||
void SetBoxSideLabel (const V3d_TypeOfOrientation theSide,
|
||||
const TCollection_AsciiString& theLabel)
|
||||
{
|
||||
if (!IsBoxSide (theSide))
|
||||
{
|
||||
throw Standard_ProgramError ("AIS_ViewCube::SetBoxSideLabel(), invalid enumeration value");
|
||||
}
|
||||
myBoxSideLabels.Bind (theSide, theLabel);
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
//! Return text color of labels of box sides; BLACK by default.
|
||||
const Quantity_Color& TextColor() const { return myDrawer->TextAspect()->Aspect()->Color(); }
|
||||
|
||||
//! Set color of text labels on box sides. Alias for:
|
||||
//! @code Attributes()->TextAspect()->SetColor() @endcode
|
||||
void SetTextColor (const Quantity_Color& theColor)
|
||||
{
|
||||
myDrawer->TextAspect()->SetColor (theColor);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
//! Return font name that is used for displaying of sides and axes text. Alias for:
|
||||
//! @code Attributes()->TextAspect()->Aspect()->SetFont() @endcode
|
||||
const TCollection_AsciiString& Font() const { return myDrawer->TextAspect()->Aspect()->Font(); }
|
||||
|
||||
//! Set font name that is used for displaying of sides and axes text. Alias for:
|
||||
//! @code Attributes()->TextAspect()->SetFont() @endcode
|
||||
void SetFont (const TCollection_AsciiString& theFont)
|
||||
{
|
||||
myDrawer->TextAspect()->Aspect()->SetFont (theFont);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
//! Return height of font
|
||||
Standard_Real FontHeight() const { return myDrawer->TextAspect()->Height(); }
|
||||
|
||||
//! Change font height. Alias for:
|
||||
//! @code Attributes()->TextAspect()->SetHeight() @endcode
|
||||
void SetFontHeight (Standard_Real theValue)
|
||||
{
|
||||
if (Abs (myDrawer->TextAspect()->Height() - theValue) > Precision::Confusion())
|
||||
{
|
||||
myDrawer->TextAspect()->SetHeight (theValue);
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//! Return axes labels or empty string if undefined.
|
||||
//! Default labels: X, Y, Z.
|
||||
TCollection_AsciiString AxisLabel (Prs3d_DatumParts theAxis) const
|
||||
{
|
||||
const TCollection_AsciiString* aLabel = myAxesLabels.Seek (theAxis);
|
||||
return aLabel != NULL ? *aLabel : TCollection_AsciiString();
|
||||
}
|
||||
|
||||
//! Set axes labels.
|
||||
void SetAxesLabels (const TCollection_AsciiString& theX,
|
||||
const TCollection_AsciiString& theY,
|
||||
const TCollection_AsciiString& theZ)
|
||||
{
|
||||
myAxesLabels.Bind (Prs3d_DP_XAxis, theX);
|
||||
myAxesLabels.Bind (Prs3d_DP_YAxis, theY);
|
||||
myAxesLabels.Bind (Prs3d_DP_ZAxis, theZ);
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Set new value of color for the whole object.
|
||||
//! @param theColor [in] input color value.
|
||||
virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE
|
||||
{
|
||||
SetBoxColor (theColor);
|
||||
}
|
||||
|
||||
//! Reset color for the whole object.
|
||||
virtual void UnsetColor() Standard_OVERRIDE
|
||||
{
|
||||
myDrawer->ShadingAspect()->SetColor (Quantity_NOC_WHITE);
|
||||
myBoxEdgeAspect ->SetColor (Quantity_NOC_GRAY30);
|
||||
myBoxCornerAspect->SetColor (Quantity_NOC_GRAY30);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
//! Set new value of transparency for the whole object.
|
||||
//! @param theValue [in] input transparency value.
|
||||
virtual void SetTransparency (const Standard_Real theValue) Standard_OVERRIDE
|
||||
{
|
||||
SetBoxTransparency (theValue);
|
||||
}
|
||||
|
||||
//! Reset transparency for the whole object.
|
||||
virtual void UnsetTransparency() Standard_OVERRIDE
|
||||
{
|
||||
SetBoxTransparency (0.0f);
|
||||
}
|
||||
|
||||
//! Sets the material for the interactive object.
|
||||
virtual void SetMaterial (const Graphic3d_MaterialAspect& theMat) Standard_OVERRIDE
|
||||
{
|
||||
myDrawer->ShadingAspect()->SetMaterial (theMat);
|
||||
myBoxEdgeAspect ->SetMaterial (theMat);
|
||||
myBoxCornerAspect->SetMaterial (theMat);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
//! Sets the material for the interactive object.
|
||||
virtual void UnsetMaterial() Standard_OVERRIDE
|
||||
{
|
||||
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_UserDefined);
|
||||
aMat.SetColor (Quantity_NOC_WHITE);
|
||||
aMat.SetAmbientColor (Quantity_NOC_GRAY60);
|
||||
myDrawer->ShadingAspect()->SetMaterial (aMat);
|
||||
myBoxEdgeAspect ->SetMaterial (aMat);
|
||||
myBoxEdgeAspect ->SetColor (Quantity_NOC_GRAY30);
|
||||
myBoxCornerAspect->SetMaterial (aMat);
|
||||
myBoxCornerAspect->SetColor (Quantity_NOC_GRAY30);
|
||||
SynchronizeAspects();
|
||||
}
|
||||
|
||||
public: //! @name animation methods
|
||||
|
||||
//! Return duration of animation in seconds; 0.5 sec by default
|
||||
Standard_Real Duration() const { return myDuration; }
|
||||
|
||||
//! Set duration of animation.
|
||||
//! @param theValue [in] input value of duration in seconds
|
||||
void SetDuration (Standard_Real theValue) { myDuration = theValue; }
|
||||
|
||||
//! Return TRUE if new camera Up direction should be always set to default value for a new camera Direction; FALSE by default.
|
||||
//! When this flag is FALSE, the new camera Up will be set as current Up orthogonalized to the new camera Direction,
|
||||
//! and will set to default Up on second click.
|
||||
Standard_Boolean ToResetCameraUp() const { return myToResetCameraUp; }
|
||||
|
||||
//! Set if new camera Up direction should be always set to default value for a new camera Direction.
|
||||
void SetResetCamera (Standard_Boolean theToReset) { myToResetCameraUp = theToReset; }
|
||||
|
||||
//! Return TRUE if animation should fit selected objects and FALSE to fit entire scene; TRUE by default.
|
||||
Standard_Boolean ToFitSelected() const { return myToFitSelected; }
|
||||
|
||||
//! Set if animation should fit selected objects or to fit entire scene.
|
||||
void SetFitSelected (Standard_Boolean theToFitSelected) { myToFitSelected = theToFitSelected; }
|
||||
|
||||
//! @return TRUE if View Cube has unfinished animation of view camera.
|
||||
Standard_EXPORT Standard_Boolean HasAnimation() const;
|
||||
|
||||
//! Start camera transformation corresponding to the input detected owner.
|
||||
//! @param theOwner [in] detected owner.
|
||||
Standard_EXPORT virtual void StartAnimation (const Handle(AIS_ViewCubeOwner)& theOwner);
|
||||
|
||||
//! Perform one step of current camera transformation.
|
||||
//! theToUpdate [in] enable/disable update of view.
|
||||
//! @return TRUE if animation is not stopped.
|
||||
Standard_EXPORT virtual Standard_Boolean UpdateAnimation (const Standard_Boolean theToUpdate);
|
||||
|
||||
//! Perform camera transformation corresponding to the input detected owner.
|
||||
Standard_EXPORT virtual void HandleClick (const Handle(AIS_ViewCubeOwner)& theOwner);
|
||||
|
||||
protected:
|
||||
|
||||
//! Perform internal single step of animation.
|
||||
//! @return FALSE if animation has been finished
|
||||
Standard_EXPORT Standard_Boolean updateAnimation();
|
||||
|
||||
protected: //! @name protected virtual API
|
||||
|
||||
//! Method that is called after one step of transformation.
|
||||
virtual void onAfterAnimation() {}
|
||||
|
||||
//! Method that is called after transformation finish.
|
||||
virtual void onAnimationFinished() {}
|
||||
|
||||
public: //! @name Presentation computation
|
||||
|
||||
//! Return TRUE for supported display mode.
|
||||
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
|
||||
|
||||
//! Global selection has no meaning for this class.
|
||||
virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE { return Handle(SelectMgr_EntityOwner)(); }
|
||||
|
||||
//! Compute 3D part of View Cube.
|
||||
//! @param thePrsMgr [in] presentation manager.
|
||||
//! @param thePrs [in] input presentation that is to be filled with flat presentation primitives.
|
||||
//! @param theMode [in] display mode.
|
||||
//! @warning this object accept only 0 display mode.
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode = 0) Standard_OVERRIDE;
|
||||
|
||||
//! Redefine computing of sensitive entities for View Cube.
|
||||
//! @param theSelection [in] input selection object that is to be filled with sensitive entities.
|
||||
//! @param theMode [in] selection mode.
|
||||
//! @warning object accepts only 0 selection mode.
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden methods.
|
||||
virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE { return Standard_False; }
|
||||
|
||||
//! Method which clear all selected owners belonging to this selectable object.
|
||||
//! @warning this object does not support selection.
|
||||
virtual void ClearSelected() Standard_OVERRIDE {}
|
||||
|
||||
//! Method which highlights input owner belonging to this selectable object.
|
||||
//! @param thePM [in] presentation manager
|
||||
//! @param theStyle [in] style for dynamic highlighting.
|
||||
//! @param theOwner [in] input entity owner.
|
||||
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const Handle(Prs3d_Drawer)& theStyle,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
|
||||
|
||||
//! Method which draws selected owners.
|
||||
Standard_EXPORT virtual void HilightSelected (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const SelectMgr_SequenceOfOwner& theSeq) Standard_OVERRIDE;
|
||||
|
||||
//! Set default parameters for visual attributes
|
||||
//! @sa Attributes()
|
||||
virtual void UnsetAttributes() Standard_OVERRIDE
|
||||
{
|
||||
setDefaultAttributes();
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
//! Set default parameters for dynamic highlighting attributes, reset highlight attributes
|
||||
virtual void UnsetHilightAttributes() Standard_OVERRIDE
|
||||
{
|
||||
myHilightDrawer.Nullify();
|
||||
setDefaultHighlightAttributes();
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
protected: //! @name Auxiliary classes to fill presentation with proper primitives
|
||||
|
||||
//! Create triangulation for a box part - for presentation and selection purposes.
|
||||
Standard_EXPORT virtual Handle(Graphic3d_ArrayOfTriangles) createBoxPartTriangles (V3d_TypeOfOrientation theDir) const;
|
||||
|
||||
//! Create triangulation for a box side.
|
||||
Standard_EXPORT virtual Handle(Graphic3d_ArrayOfTriangles) createBoxSideTriangles (V3d_TypeOfOrientation theDir) const;
|
||||
|
||||
//! Create triangulation for a box edge.
|
||||
Standard_EXPORT virtual Handle(Graphic3d_ArrayOfTriangles) createBoxEdgeTriangles (V3d_TypeOfOrientation theDir) const;
|
||||
|
||||
//! Create triangulation for a box corner (vertex).
|
||||
Standard_EXPORT virtual Handle(Graphic3d_ArrayOfTriangles) createBoxCornerTriangles (V3d_TypeOfOrientation theDir) const;
|
||||
|
||||
protected:
|
||||
|
||||
//! Create triangulation for a rectangle with round corners.
|
||||
//! @param theSize rectangle dimensions
|
||||
//! @param theRadius radius at corners
|
||||
//! @param theTrsf transformation
|
||||
Standard_EXPORT static Handle(Graphic3d_ArrayOfTriangles) createRoundRectangleTriangles (const gp_XY& theSize,
|
||||
Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf);
|
||||
|
||||
protected:
|
||||
|
||||
//! Trivial hasher to avoid ambiguity with enumeration type.
|
||||
struct IntegerHasher
|
||||
{
|
||||
static Standard_Integer HashCode (Standard_Integer theValue, Standard_Integer theUpper) { return ::HashCode (theValue, theUpper); }
|
||||
static Standard_Boolean IsEqual (Standard_Integer theA, Standard_Integer theB) { return theA == theB; }
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
NCollection_DataMap<V3d_TypeOfOrientation, TCollection_AsciiString, IntegerHasher>
|
||||
myBoxSideLabels; //!< map with box side labels
|
||||
NCollection_DataMap<Prs3d_DatumParts, TCollection_AsciiString, IntegerHasher>
|
||||
myAxesLabels; //!< map with axes labels
|
||||
Handle(Prs3d_ShadingAspect) myBoxEdgeAspect; //!< style for box edges
|
||||
Handle(Prs3d_ShadingAspect) myBoxCornerAspect; //!< style for box corner
|
||||
|
||||
Standard_Real mySize; //!< size of box side, length of one axis
|
||||
Standard_Real myBoxEdgeMinSize; //!< minimal size of box edge
|
||||
Standard_Real myBoxEdgeGap; //!< gap between box side and box edge
|
||||
Standard_Real myBoxFacetExtension; //!< box facet extension
|
||||
Standard_Real myAxesPadding; //!< Padding between box and axes
|
||||
Standard_Real myCornerMinSize; //!< minimal size of box corner
|
||||
Standard_Real myRoundRadius; //!< relative round radius within [0; 0.5] range
|
||||
Standard_Boolean myToDisplayAxes; //!< trihedron visibility
|
||||
Standard_Boolean myToDisplayEdges; //!< box edges visibility
|
||||
Standard_Boolean myToDisplayVertices; //!< box corners (vertices) visibility
|
||||
Standard_Boolean myIsYup; //!< flag indicating that application expects Y-up viewer orientation instead of Z-up
|
||||
|
||||
protected: //! @name Animation options
|
||||
|
||||
Handle(AIS_AnimationCamera) myViewAnimation; //!< Camera animation object
|
||||
Handle(Graphic3d_Camera) myStartState; //!< Start state of view camera
|
||||
Handle(Graphic3d_Camera) myEndState; //!< End state of view camera
|
||||
Standard_Real myDuration; //!< Duration of animation. By default it is half a second
|
||||
Standard_Boolean myToAutoStartAnim; //!< start animation automatically on click
|
||||
Standard_Boolean myIsFixedAnimation; //!< fixed-loop animation
|
||||
Standard_Boolean myToFitSelected; //!< fit selected or fit entire scene
|
||||
Standard_Boolean myToResetCameraUp; //!< always reset camera up direction to default
|
||||
|
||||
};
|
||||
|
||||
//! Redefined entity owner that is highlighted when owner is detected,
|
||||
//! even if Interactive Context highlighted on last detection procedure.
|
||||
class AIS_ViewCubeOwner : public SelectMgr_EntityOwner
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_ViewCubeOwner, SelectMgr_EntityOwner)
|
||||
public:
|
||||
|
||||
//! Main constructor.
|
||||
AIS_ViewCubeOwner (const Handle(AIS_ViewCube)& theObject,
|
||||
V3d_TypeOfOrientation theOrient,
|
||||
Standard_Integer thePriority = 5)
|
||||
: SelectMgr_EntityOwner ((const Handle(SelectMgr_SelectableObject)& )theObject, thePriority),
|
||||
myMainOrient (theOrient)
|
||||
{
|
||||
myFromDecomposition = true;
|
||||
}
|
||||
|
||||
//! @return TRUE. This owner will always call method
|
||||
//! Hilight for its Selectable Object when the owner is detected.
|
||||
virtual Standard_Boolean IsForcedHilight() const Standard_OVERRIDE { return Standard_True; }
|
||||
|
||||
//! Return new orientation to set.
|
||||
V3d_TypeOfOrientation MainOrientation() const { return myMainOrient; }
|
||||
|
||||
//! Handle mouse button click event.
|
||||
virtual Standard_Boolean HandleMouseClick (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButton,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsDoubleClick) Standard_OVERRIDE
|
||||
{
|
||||
(void )thePoint; (void )theButton; (void )theModifiers; (void )theIsDoubleClick;
|
||||
AIS_ViewCube* aCubePrs = dynamic_cast<AIS_ViewCube* >(mySelectable);
|
||||
aCubePrs->HandleClick (this);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
V3d_TypeOfOrientation myMainOrient; //!< new orientation to set
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_ViewCube_HeaderFile
|
153
src/AIS/AIS_ViewInputBuffer.hxx
Normal file
153
src/AIS/AIS_ViewInputBuffer.hxx
Normal file
@@ -0,0 +1,153 @@
|
||||
// Copyright (c) 2016-2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_ViewInputBuffer_HeaderFile
|
||||
#define _AIS_ViewInputBuffer_HeaderFile
|
||||
|
||||
#include <Aspect_ScrollDelta.hxx>
|
||||
|
||||
#include <Graphic3d_Vec2.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
#include <V3d_TypeOfOrientation.hxx>
|
||||
|
||||
//! Selection mode
|
||||
enum AIS_ViewSelectionTool
|
||||
{
|
||||
AIS_ViewSelectionTool_Picking, //!< pick to select
|
||||
AIS_ViewSelectionTool_RubberBand, //!< rubber-band to select
|
||||
AIS_ViewSelectionTool_Polygon //!< polyline to select
|
||||
};
|
||||
|
||||
//! Input buffer type.
|
||||
enum AIS_ViewInputBufferType
|
||||
{
|
||||
AIS_ViewInputBufferType_UI, //!< input buffer for filling from UI thread
|
||||
AIS_ViewInputBufferType_GL, //!< input buffer accessible from GL thread
|
||||
};
|
||||
|
||||
//! Auxiliary structure defining viewer events
|
||||
class AIS_ViewInputBuffer
|
||||
{
|
||||
public:
|
||||
|
||||
bool IsNewGesture; //!< transition from one action to another
|
||||
|
||||
NCollection_Sequence<Aspect_ScrollDelta> ZoomActions; //!< the queue with zoom actions
|
||||
|
||||
struct _orientation
|
||||
{
|
||||
bool ToFitAll; //!< perform FitAll operation
|
||||
bool ToSetViewOrient; //!< set new view orientation
|
||||
V3d_TypeOfOrientation ViewOrient; //!< new view orientation
|
||||
|
||||
_orientation() : ToFitAll (false), ToSetViewOrient (false), ViewOrient (V3d_Xpos) {}
|
||||
} Orientation;
|
||||
|
||||
struct _highlighting
|
||||
{
|
||||
bool ToHilight; //!< perform dynamic highlighting at specified point
|
||||
Graphic3d_Vec2i Point; //!< the new point for dynamic highlighting
|
||||
|
||||
_highlighting() : ToHilight (false) {}
|
||||
} MoveTo;
|
||||
|
||||
struct _selection
|
||||
{
|
||||
AIS_ViewSelectionTool Tool; //!< perform selection
|
||||
bool IsXOR; //!< perform shift selection
|
||||
NCollection_Sequence<Graphic3d_Vec2i>
|
||||
Points; //!< the points for selection
|
||||
bool ToApplyTool; //!< apply rubber-band selection tool
|
||||
|
||||
_selection() : Tool (AIS_ViewSelectionTool_Picking), IsXOR (false), ToApplyTool (false) {}
|
||||
} Selection;
|
||||
|
||||
struct _panningParams
|
||||
{
|
||||
bool ToStart; //!< start panning
|
||||
Graphic3d_Vec2i PointStart; //!< panning start point
|
||||
bool ToPan; //!< perform panning
|
||||
Graphic3d_Vec2i Delta; //!< panning delta
|
||||
|
||||
_panningParams() : ToStart (false), ToPan (false) {}
|
||||
} Panning;
|
||||
|
||||
struct _draggingParams
|
||||
{
|
||||
bool ToStart; //!< start dragging
|
||||
bool ToStop; //!< stop dragging
|
||||
bool ToAbort; //!< abort dragging (restore previous position)
|
||||
Graphic3d_Vec2i PointStart; //!< drag start point
|
||||
Graphic3d_Vec2i PointTo; //!< drag end point
|
||||
|
||||
_draggingParams() : ToStart (false), ToStop (false), ToAbort (false) {}
|
||||
} Dragging;
|
||||
|
||||
struct _orbitRotation
|
||||
{
|
||||
bool ToStart; //!< start orbit rotation
|
||||
Graphic3d_Vec2d PointStart; //!< orbit rotation start point
|
||||
bool ToRotate; //!< perform orbit rotation
|
||||
Graphic3d_Vec2d PointTo; //!< orbit rotation end point
|
||||
|
||||
_orbitRotation() : ToStart (false), ToRotate (false) {}
|
||||
} OrbitRotation;
|
||||
|
||||
struct _viewRotation
|
||||
{
|
||||
bool ToStart; //!< start view rotation
|
||||
Graphic3d_Vec2d PointStart; //!< view rotation start point
|
||||
bool ToRotate; //!< perform view rotation
|
||||
Graphic3d_Vec2d PointTo; //!< view rotation end point
|
||||
|
||||
_viewRotation() : ToStart (false), ToRotate (false) {}
|
||||
} ViewRotation;
|
||||
|
||||
struct _zrotateParams
|
||||
{
|
||||
Graphic3d_Vec2i Point; //!< Z rotation start point
|
||||
double Angle; //!< Z rotation angle
|
||||
bool ToRotate; //!< start Z rotation
|
||||
|
||||
_zrotateParams() : Angle (0.0), ToRotate (false) {}
|
||||
} ZRotate;
|
||||
|
||||
public:
|
||||
|
||||
AIS_ViewInputBuffer()
|
||||
: IsNewGesture (false) {}
|
||||
|
||||
//! Reset events buffer.
|
||||
void Reset()
|
||||
{
|
||||
Orientation.ToFitAll = false;
|
||||
Orientation.ToSetViewOrient = false;
|
||||
MoveTo.ToHilight = false;
|
||||
Selection.ToApplyTool = false;
|
||||
IsNewGesture = false;
|
||||
ZoomActions.Clear();
|
||||
Panning.ToStart = false;
|
||||
Panning.ToPan = false;
|
||||
Dragging.ToStart = false;
|
||||
Dragging.ToStop = false;
|
||||
Dragging.ToAbort = false;
|
||||
OrbitRotation.ToStart = false;
|
||||
OrbitRotation.ToRotate = false;
|
||||
ViewRotation.ToStart = false;
|
||||
ViewRotation.ToRotate = false;
|
||||
ZRotate.ToRotate = false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_ViewInputBuffer_HeaderFile
|
115
src/AIS/AIS_WalkDelta.hxx
Normal file
115
src/AIS/AIS_WalkDelta.hxx
Normal file
@@ -0,0 +1,115 @@
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_WalkDelta_HeaderFile
|
||||
#define _AIS_WalkDelta_HeaderFile
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
|
||||
//! Walking translation components.
|
||||
enum AIS_WalkTranslation
|
||||
{
|
||||
AIS_WalkTranslation_Forward = 0, //!< translation delta, Forward walk
|
||||
AIS_WalkTranslation_Side, //!< translation delta, Side walk
|
||||
AIS_WalkTranslation_Up, //!< translation delta, Up walk
|
||||
};
|
||||
|
||||
//! Walking rotation components.
|
||||
enum AIS_WalkRotation
|
||||
{
|
||||
AIS_WalkRotation_Yaw = 0, //!< yaw rotation angle
|
||||
AIS_WalkRotation_Pitch, //!< pitch rotation angle
|
||||
AIS_WalkRotation_Roll, //!< roll rotation angle
|
||||
};
|
||||
|
||||
//! Walking value.
|
||||
struct AIS_WalkPart
|
||||
{
|
||||
Standard_Real Value; //!< value
|
||||
Standard_Real Pressure; //!< key pressure
|
||||
Standard_Real Duration; //!< duration
|
||||
|
||||
//! Return TRUE if delta is empty.
|
||||
bool IsEmpty() const { return Abs (Value) <= RealSmall(); }
|
||||
|
||||
//! Empty constructor.
|
||||
AIS_WalkPart() : Value (0.0), Pressure (1.0), Duration (0.0) {}
|
||||
};
|
||||
|
||||
//! Walking values.
|
||||
struct AIS_WalkDelta
|
||||
{
|
||||
//! Empty constructor.
|
||||
AIS_WalkDelta()
|
||||
: myIsJumping (false), myIsCrouching (false), myIsRunning (false) {}
|
||||
|
||||
//! Return translation component.
|
||||
const AIS_WalkPart& operator[] (AIS_WalkTranslation thePart) const { return myTranslation[thePart]; }
|
||||
|
||||
//! Return translation component.
|
||||
AIS_WalkPart& operator[] (AIS_WalkTranslation thePart) { return myTranslation[thePart]; }
|
||||
|
||||
//! Return rotation component.
|
||||
const AIS_WalkPart& operator[] (AIS_WalkRotation thePart) const { return myRotation[thePart]; }
|
||||
|
||||
//! Return rotation component.
|
||||
AIS_WalkPart& operator[] (AIS_WalkRotation thePart) { return myRotation[thePart]; }
|
||||
|
||||
//! Return jumping state.
|
||||
bool IsJumping() const { return myIsJumping; }
|
||||
|
||||
//! Set jumping state.
|
||||
void SetJumping (bool theIsJumping) { myIsJumping = theIsJumping; }
|
||||
|
||||
//! Return crouching state.
|
||||
bool IsCrouching() const { return myIsCrouching; }
|
||||
|
||||
//! Set crouching state.
|
||||
void SetCrouching (bool theIsCrouching) { myIsCrouching = theIsCrouching; }
|
||||
|
||||
//! Return running state.
|
||||
bool IsRunning() const { return myIsRunning; }
|
||||
|
||||
//! Set running state.
|
||||
void SetRunning (bool theIsRunning) { myIsRunning = theIsRunning; }
|
||||
|
||||
//! Return TRUE when both Rotation and Translation deltas are empty.
|
||||
bool IsEmpty() const { return !ToMove() && !ToRotate(); }
|
||||
|
||||
//! Return TRUE if translation delta is defined.
|
||||
bool ToMove() const
|
||||
{
|
||||
return !myTranslation[AIS_WalkTranslation_Forward].IsEmpty()
|
||||
|| !myTranslation[AIS_WalkTranslation_Side].IsEmpty()
|
||||
|| !myTranslation[AIS_WalkTranslation_Up].IsEmpty();
|
||||
}
|
||||
|
||||
//! Return TRUE if rotation delta is defined.
|
||||
bool ToRotate() const
|
||||
{
|
||||
return !myRotation[AIS_WalkRotation_Yaw].IsEmpty()
|
||||
|| !myRotation[AIS_WalkRotation_Pitch].IsEmpty()
|
||||
|| !myRotation[AIS_WalkRotation_Roll].IsEmpty();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
AIS_WalkPart myTranslation[3];
|
||||
AIS_WalkPart myRotation[3];
|
||||
bool myIsJumping;
|
||||
bool myIsCrouching;
|
||||
bool myIsRunning;
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_WalkDelta_HeaderFile
|
@@ -2,7 +2,6 @@ AIS.cxx
|
||||
AIS.hxx
|
||||
AIS_Animation.cxx
|
||||
AIS_Animation.hxx
|
||||
AIS_AnimationTimer.cxx
|
||||
AIS_AnimationTimer.hxx
|
||||
AIS_AnimationCamera.cxx
|
||||
AIS_AnimationCamera.hxx
|
||||
@@ -57,6 +56,7 @@ AIS_DimensionSelectionMode.hxx
|
||||
AIS_DisplayMode.hxx
|
||||
AIS_DisplaySpecialSymbol.hxx
|
||||
AIS_DisplayStatus.hxx
|
||||
AIS_DragAction.hxx
|
||||
AIS_EllipseRadiusDimension.cxx
|
||||
AIS_EllipseRadiusDimension.hxx
|
||||
AIS_EqualDistanceRelation.cxx
|
||||
@@ -105,6 +105,9 @@ AIS_MapIteratorOfMapOfInteractive.hxx
|
||||
AIS_MapOfInteractive.hxx
|
||||
AIS_MaxRadiusDimension.cxx
|
||||
AIS_MaxRadiusDimension.hxx
|
||||
AIS_MediaPlayer.cxx
|
||||
AIS_MediaPlayer.hxx
|
||||
AIS_MouseGesture.hxx
|
||||
AIS_MidPointRelation.cxx
|
||||
AIS_MidPointRelation.hxx
|
||||
AIS_MidPointRelation.lxx
|
||||
@@ -113,6 +116,7 @@ AIS_MinRadiusDimension.hxx
|
||||
AIS_MultipleConnectedInteractive.cxx
|
||||
AIS_MultipleConnectedInteractive.hxx
|
||||
AIS_MultipleConnectedInteractive.lxx
|
||||
AIS_NavigationMode.hxx
|
||||
AIS_NListOfEntityOwner.hxx
|
||||
AIS_OffsetDimension.cxx
|
||||
AIS_OffsetDimension.hxx
|
||||
@@ -134,6 +138,7 @@ AIS_RadiusDimension.cxx
|
||||
AIS_RadiusDimension.hxx
|
||||
AIS_Relation.cxx
|
||||
AIS_Relation.hxx
|
||||
AIS_RotationMode.hxx
|
||||
AIS_RubberBand.hxx
|
||||
AIS_RubberBand.cxx
|
||||
AIS_Selection.cxx
|
||||
@@ -174,3 +179,9 @@ AIS_TypeOfAxis.hxx
|
||||
AIS_TypeOfDist.hxx
|
||||
AIS_TypeOfIso.hxx
|
||||
AIS_TypeOfPlane.hxx
|
||||
AIS_ViewController.cxx
|
||||
AIS_ViewController.hxx
|
||||
AIS_ViewInputBuffer.hxx
|
||||
AIS_ViewCube.cxx
|
||||
AIS_ViewCube.hxx
|
||||
AIS_WalkDelta.hxx
|
||||
|
@@ -458,7 +458,7 @@ GeomAbs_CurveType Adaptor2d_OffsetCurve::GetType() const {
|
||||
return GeomAbs_Circle;
|
||||
|
||||
default:
|
||||
return GeomAbs_OtherCurve;
|
||||
return GeomAbs_OffsetCurve;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -650,3 +650,34 @@ Handle(Geom2d_BSplineCurve) Adaptor2d_OffsetCurve::BSpline() const
|
||||
"Adaptor2d_OffsetCurve::BSpline() - wrong curve type");
|
||||
return myCurve->BSpline();
|
||||
}
|
||||
|
||||
static Standard_Integer nbPoints(const Handle(Adaptor2d_HCurve2d)& theCurve)
|
||||
{
|
||||
|
||||
Standard_Integer nbs = 20;
|
||||
|
||||
if (theCurve->GetType() == GeomAbs_Line)
|
||||
nbs = 2;
|
||||
else if (theCurve->GetType() == GeomAbs_BezierCurve)
|
||||
{
|
||||
nbs = 3 + theCurve->NbPoles();
|
||||
}
|
||||
else if (theCurve->GetType() == GeomAbs_BSplineCurve) {
|
||||
nbs = theCurve->NbKnots();
|
||||
nbs *= theCurve->Degree();
|
||||
}
|
||||
|
||||
if (nbs > 200)
|
||||
nbs = 200;
|
||||
return nbs;
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : NbSamples
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer Adaptor2d_OffsetCurve::NbSamples() const
|
||||
{
|
||||
return nbPoints(myCurve);
|
||||
}
|
||||
|
@@ -174,6 +174,7 @@ public:
|
||||
|
||||
Standard_EXPORT Handle(Geom2d_BSplineCurve) BSpline() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Integer NbSamples() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
@@ -954,6 +954,10 @@ Standard_Boolean Adaptor3d_CurveOnSurface::IsClosed() const
|
||||
|
||||
Standard_Boolean Adaptor3d_CurveOnSurface::IsPeriodic() const
|
||||
{
|
||||
if (myType == GeomAbs_Circle ||
|
||||
myType == GeomAbs_Ellipse)
|
||||
return Standard_True;
|
||||
|
||||
return myCurve->IsPeriodic();
|
||||
}
|
||||
|
||||
@@ -964,6 +968,10 @@ Standard_Boolean Adaptor3d_CurveOnSurface::IsPeriodic() const
|
||||
|
||||
Standard_Real Adaptor3d_CurveOnSurface::Period() const
|
||||
{
|
||||
if (myType == GeomAbs_Circle ||
|
||||
myType == GeomAbs_Ellipse)
|
||||
return (2.*M_PI);
|
||||
|
||||
return myCurve->Period();
|
||||
}
|
||||
|
||||
|
@@ -117,6 +117,12 @@ public:
|
||||
//! changes the first and the last constraint points.
|
||||
Standard_EXPORT void SetConstraints (const AppParCurves_Constraint firstC, const AppParCurves_Constraint lastC);
|
||||
|
||||
//! Sets periodic flag.
|
||||
//! If thePeriodic = Standard_True, algorith tries to build periodic
|
||||
//! multicurve using corresponding C1 boundary condition for first and last multipoints.
|
||||
//! Multiline must be closed.
|
||||
Standard_EXPORT void SetPeriodic(const Standard_Boolean thePeriodic);
|
||||
|
||||
//! returns False if at a moment of the approximation,
|
||||
//! the status NoApproximation has been sent by the user
|
||||
//! when more points were needed.
|
||||
@@ -199,6 +205,7 @@ private:
|
||||
Standard_Integer mycont;
|
||||
Standard_Real mylambda1;
|
||||
Standard_Real mylambda2;
|
||||
Standard_Boolean myPeriodic;
|
||||
|
||||
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,8 @@
|
||||
#include <Approx_Status.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
const static Standard_Integer MAXSEGM = 1000;
|
||||
|
||||
//=======================================================================
|
||||
//function : Approx_ComputeCLine
|
||||
//purpose : The MultiLine <Line> will be approximated until tolerances
|
||||
@@ -50,7 +52,8 @@ const AppParCurves_Constraint LastC)
|
||||
mycut = cutting;
|
||||
myfirstC = FirstC;
|
||||
mylastC = LastC;
|
||||
myMaxSegments = IntegerLast();
|
||||
myMaxSegments = MAXSEGM;
|
||||
myInvOrder = Standard_True;
|
||||
alldone = Standard_False;
|
||||
Perform(Line);
|
||||
}
|
||||
@@ -77,7 +80,8 @@ const AppParCurves_Constraint LastC)
|
||||
mycut = cutting;
|
||||
myfirstC = FirstC;
|
||||
mylastC = LastC;
|
||||
myMaxSegments = IntegerLast();
|
||||
myMaxSegments = MAXSEGM;
|
||||
myInvOrder = Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -244,33 +248,117 @@ Standard_Boolean Approx_ComputeCLine::Compute(const MultiLine& Line,
|
||||
{
|
||||
|
||||
|
||||
Standard_Integer deg, NbPoints = 24;
|
||||
const Standard_Integer NbPointsMax = 24;
|
||||
const Standard_Real aMinRatio = 0.05;
|
||||
const Standard_Integer aMaxDeg = 8;
|
||||
//
|
||||
Standard_Integer deg, NbPoints;
|
||||
Standard_Boolean mydone;
|
||||
Standard_Real Fv;
|
||||
|
||||
for (deg = mydegremin; deg <= mydegremax; deg++) {
|
||||
|
||||
AppCont_LeastSquare LSquare(Line, Ufirst, Ulast, myfirstC, mylastC, deg, NbPoints);
|
||||
mydone = LSquare.IsDone();
|
||||
if (mydone) {
|
||||
LSquare.Error(Fv, TheTol3d, TheTol2d);
|
||||
if (TheTol3d <= mytol3d && TheTol2d <= mytol2d) {
|
||||
AppParCurves_MultiCurve aPrevCurve;
|
||||
Standard_Real aPrevTol3d = RealLast(), aPrevTol2d = RealLast();
|
||||
Standard_Boolean aPrevIsOk = Standard_False;
|
||||
Standard_Boolean anInvOrder = myInvOrder;
|
||||
if (anInvOrder && mydegremax > aMaxDeg)
|
||||
{
|
||||
if ((Ulast - Ufirst) / (Line.LastParameter() - Line.FirstParameter()) < aMinRatio)
|
||||
{
|
||||
anInvOrder = Standard_False;
|
||||
}
|
||||
}
|
||||
if (anInvOrder)
|
||||
{
|
||||
for (deg = mydegremax; deg >= mydegremin; deg--) {
|
||||
NbPoints = Min(2 * deg + 1, NbPointsMax);
|
||||
AppCont_LeastSquare LSquare(Line, Ufirst, Ulast, myfirstC, mylastC, deg, NbPoints);
|
||||
mydone = LSquare.IsDone();
|
||||
if (mydone)
|
||||
{
|
||||
LSquare.Error(Fv, TheTol3d, TheTol2d);
|
||||
if (TheTol3d <= mytol3d && TheTol2d <= mytol2d)
|
||||
{
|
||||
if (deg == mydegremin)
|
||||
{
|
||||
// Stockage de la multicurve approximee.
|
||||
tolreached = Standard_True;
|
||||
myMultiCurves.Append(LSquare.Value());
|
||||
myfirstparam.Append(Ufirst);
|
||||
mylastparam.Append(Ulast);
|
||||
Tolers3d.Append(TheTol3d);
|
||||
Tolers2d.Append(TheTol2d);
|
||||
return Standard_True;
|
||||
}
|
||||
aPrevTol3d = TheTol3d;
|
||||
aPrevTol2d = TheTol2d;
|
||||
aPrevCurve = LSquare.Value();
|
||||
aPrevIsOk = Standard_True;
|
||||
continue;
|
||||
}
|
||||
else if (aPrevIsOk)
|
||||
{
|
||||
// Stockage de la multicurve approximee.
|
||||
tolreached = Standard_True;
|
||||
TheTol3d = aPrevTol3d;
|
||||
TheTol2d = aPrevTol2d;
|
||||
myMultiCurves.Append(aPrevCurve);
|
||||
myfirstparam.Append(Ufirst);
|
||||
mylastparam.Append(Ulast);
|
||||
Tolers3d.Append(aPrevTol3d);
|
||||
Tolers2d.Append(aPrevTol2d);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
else if (aPrevIsOk)
|
||||
{
|
||||
// Stockage de la multicurve approximee.
|
||||
tolreached = Standard_True;
|
||||
myMultiCurves.Append(LSquare.Value());
|
||||
TheTol3d = aPrevTol3d;
|
||||
TheTol2d = aPrevTol2d;
|
||||
myMultiCurves.Append(aPrevCurve);
|
||||
myfirstparam.Append(Ufirst);
|
||||
mylastparam.Append(Ulast);
|
||||
Tolers3d.Append(TheTol3d);
|
||||
Tolers2d.Append(TheTol2d);
|
||||
Tolers3d.Append(aPrevTol3d);
|
||||
Tolers2d.Append(aPrevTol2d);
|
||||
return Standard_True;
|
||||
}
|
||||
if (!aPrevIsOk && deg == mydegremax)
|
||||
{
|
||||
TheMultiCurve = LSquare.Value();
|
||||
currenttol3d = TheTol3d;
|
||||
currenttol2d = TheTol2d;
|
||||
aPrevTol3d = TheTol3d;
|
||||
aPrevTol2d = TheTol2d;
|
||||
aPrevCurve = TheMultiCurve;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (deg == mydegremax) {
|
||||
TheMultiCurve = LSquare.Value();
|
||||
currenttol3d = TheTol3d;
|
||||
currenttol2d = TheTol2d;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (deg = mydegremin; deg <= mydegremax; deg++) {
|
||||
NbPoints = Min(2 * deg + 1, NbPointsMax);
|
||||
AppCont_LeastSquare LSquare(Line, Ufirst, Ulast, myfirstC, mylastC, deg, NbPoints);
|
||||
mydone = LSquare.IsDone();
|
||||
if (mydone) {
|
||||
LSquare.Error(Fv, TheTol3d, TheTol2d);
|
||||
if (TheTol3d <= mytol3d && TheTol2d <= mytol2d) {
|
||||
// Stockage de la multicurve approximee.
|
||||
tolreached = Standard_True;
|
||||
myMultiCurves.Append(LSquare.Value());
|
||||
myfirstparam.Append(Ufirst);
|
||||
mylastparam.Append(Ulast);
|
||||
Tolers3d.Append(TheTol3d);
|
||||
Tolers2d.Append(TheTol2d);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
if (deg == mydegremax) {
|
||||
TheMultiCurve = LSquare.Value();
|
||||
currenttol3d = TheTol3d;
|
||||
currenttol2d = TheTol2d;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -335,6 +423,15 @@ void Approx_ComputeCLine::SetMaxSegments(const Standard_Integer theMaxSegments)
|
||||
myMaxSegments = theMaxSegments;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetInvOrder
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Approx_ComputeCLine::SetInvOrder(const Standard_Boolean theInvOrder)
|
||||
{
|
||||
myInvOrder = theInvOrder;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsAllApproximated
|
||||
//purpose : returns False if at a moment of the approximation,
|
||||
|
@@ -64,6 +64,12 @@ public:
|
||||
//! Changes the max number of segments, which is allowed for cutting.
|
||||
Standard_EXPORT void SetMaxSegments (const Standard_Integer theMaxSegments);
|
||||
|
||||
//! Set inverse order of degree selection:
|
||||
//! if theInvOrdr = true, current degree is chosen by inverse order -
|
||||
//! from maxdegree to mindegree.
|
||||
//! By default inverse order is used.
|
||||
Standard_EXPORT void SetInvOrder(const Standard_Boolean theInvOrder);
|
||||
|
||||
//! returns False if at a moment of the approximation,
|
||||
//! the status NoApproximation has been sent by the user
|
||||
//! when more points were needed.
|
||||
@@ -118,6 +124,7 @@ private:
|
||||
AppParCurves_Constraint myfirstC;
|
||||
AppParCurves_Constraint mylastC;
|
||||
Standard_Integer myMaxSegments;
|
||||
Standard_Boolean myInvOrder;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -64,6 +64,12 @@ public:
|
||||
//! Changes the max number of segments, which is allowed for cutting.
|
||||
Standard_EXPORT void SetMaxSegments (const Standard_Integer theMaxSegments);
|
||||
|
||||
//! Set inverse order of degree selection:
|
||||
//! if theInvOrdr = true, current degree is chosen by inverse order -
|
||||
//! from maxdegree to mindegree.
|
||||
//! By default inverse order is used.
|
||||
Standard_EXPORT void SetInvOrder(const Standard_Boolean theInvOrder);
|
||||
|
||||
//! returns False if at a moment of the approximation,
|
||||
//! the status NoApproximation has been sent by the user
|
||||
//! when more points were needed.
|
||||
@@ -118,7 +124,7 @@ private:
|
||||
AppParCurves_Constraint myfirstC;
|
||||
AppParCurves_Constraint mylastC;
|
||||
Standard_Integer myMaxSegments;
|
||||
|
||||
Standard_Boolean myInvOrder;
|
||||
|
||||
};
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user