1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

Compare commits

..

31 Commits

Author SHA1 Message Date
nds
3a8ba84200 0030791: Visualization - possibility to display materials by different hatching style for clipping
# move capping style from presentation into drawer
# crash in capping by setting projection as
# several hatch templates
2019-09-04 00:49:54 +03:00
nds
4d6db8fb0c 0030857: Visualization - using one implementation of Text in graphic group - warnings correction - merge correction
#issue remarks correction
2019-08-16 13:01:41 +03:00
nds
cbf87d0753 Revert "0030901: Visualization - OSD_MemInfo moving memory computation out of the constructor" 2019-08-15 11:48:32 +03:00
nds
f834363dc3 0030901: Visualization - OSD_MemInfo moving memory computation out of the constructor 2019-08-15 08:48:14 +03:00
nds
a8959620a2 0030901: Visualization - OSD_MemInfo moving memory computation out of the constructor 2019-08-15 08:40:14 +03:00
nds
b7949b1dca 0030857: Visualization - using one implementation of Text in graphic group - warnings correction 2019-08-05 07:46:57 +03:00
nds
87c7ff6548 0030857: Visualization - using one implementation of Text in graphic group 2019-08-05 07:42:47 +03:00
nds
b416dd9bb6 0029451: Information Message Alert to debug an algorithm or object functionality
Dump/Init implementation in OCCT object and parsing it in VInspector (partially)
2019-08-02 08:07:13 +03:00
nds
9e7172d372 0030537: Visualization - wrapping text in font text formatter - correction after review 2019-08-02 07:11:31 +03:00
nds
79db594820 0029451: Information Message Alert to debug an algorithm or object functionality
Dump/Init implementation in OCCT object and parsing it in MessageView (VInspector later)
2019-07-17 13:54:31 +03:00
nds
fafcc26452 0030791: Visualization - possibility to display materials by different hatching style for clipping 2019-06-18 15:44:43 +03:00
nds
120f8788ff 0030728: Visualization - using one implementation of highlight/unhighlight in context - compilation correction
# check of NULL global selection owner (e.g. AIS_RubberBand has no global owner)
2019-06-17 13:45:49 +03:00
nds
9e58a20735 0030784: Visualization - check if selectable of owner in internal container in AIS_InteractiveContext before using
# todo - add similar check for other places where needed
2019-06-17 13:12:38 +03:00
nds
cafd762c93 0030268: Inspectors - improvements in VInspector plugin,
0029451: Information Message Alert to debug an algorithm or object functionality
2019-06-14 10:39:35 +03:00
nds
c9d8f1a93a 0029451: Information Message Alert to debug an algorithm or object functionality
Modifications:
 - Message_AlertExtended to store additional parameters (attributes, composite alert container, performance meter)
 - Message_Attribute and inherited classes to store custom information about alert
 - Message_CompositeAlerts to have hierarchical structure of alerts
 - Message_PerfMeter to automatically calculate time between alerts adding into report
 - Message_ReportCall back to be able to react to message report filling.
 - Import/Export message report report. Currently it is implemented using XmlDrivers_MessageReportStorage
 - MessageView/MessageModel - Inspector plugin for GUI presentation of Message_Report

(cherry picked from commit e4529dcf83b12759e47efb89ded8207f802556a7)

Conflicts:
	tools/ViewControl/FILES
	tools/ViewControl/ViewControl_PropertyView.cxx
	tools/ViewControl/ViewControl_PropertyView.hxx
	tools/ViewControl/ViewControl_Table.cxx
	tools/ViewControl/ViewControl_Table.hxx
	tools/ViewControl/ViewControl_TableModel.hxx
	tools/ViewControl/ViewControl_TableModelFilter.cxx
	tools/ViewControl/ViewControl_TableModelFilter.hxx
	tools/ViewControl/ViewControl_TableModelValues.hxx
	tools/ViewControl/ViewControl_TableProperty.cxx
	tools/ViewControl/ViewControl_TableProperty.hxx
	tools/ViewControl/ViewControl_Tools.cxx
	tools/ViewControl/ViewControl_Tools.hxx
(cherry picked from commit 68876fcc5a)
(cherry picked from commit 9a3d03bedb29dbf0124f5d53478d331d7ba877ff)
2019-06-13 01:21:48 +03:00
nds
f9778348a4 0030728: Visualization - using one implementation of highlight/unhighlight in context - compilation correction 2019-06-11 14:24:23 +03:00
nds
b65ce1439c 0030725: Visualization - remove Display calling from SetSelected methods of context
AIS_InteractiveContext::Load/ClearGlobal is modified for correct processing SetSelected for child objects.
As Display/Erase of object with children displays/erases these children, then the children status inside context should also be updated.

(cherry picked from commit 26b44c42ba1c2d999edf10d8dab4c02eae2c5ff7)

# Conflicts:
#	src/AIS/AIS_InteractiveContext.hxx
2019-06-11 13:50:37 +03:00
nds
184a20c4fa 0030737: Visualization - implementing new selection schemes in context
#apply selection scheme to container of owners

(cherry picked from commit 91ed0554e0c7d8b8cca6f86b8fe1a0891e55c3ed)

# Conflicts:
#	src/AIS/AIS_InteractiveContext_1.cxx
2019-06-11 13:48:25 +03:00
nds
73794e88be 0030737: Visualization - implementing new selection schemes in context
(cherry picked from commit f9d4ea66dbba0c6fb70d0232d9fd326722e83fbc)
(cherry picked from commit 1c7d53e55a)
(cherry picked from commit e2b319869af281f741ad97595c23de6d3128bce2)

# Conflicts:
#	src/AIS/AIS_InteractiveContext_1.cxx
2019-06-11 13:46:58 +03:00
nds
9e9c9c84bd 0030728: Visualization - using one implementation of highlight/unhighlight in context
(cherry picked from commit 36b87936acf5a89d573663b5e8d086a4a4a084d3)

# Conflicts:
#	src/AIS/AIS_InteractiveContext_1.cxx
(cherry picked from commit 7fc133f086611b4f4e36b658f99c29012da921d1)

# Conflicts:
#	src/AIS/AIS_InteractiveContext_1.cxx
(cherry picked from commit a06b8e8308)
(cherry picked from commit 0d5a72ab1638e4ed3d3eb72b15430ee7337f69bc)

# Conflicts:
#	src/AIS/AIS_InteractiveContext.cxx
2019-06-11 13:45:22 +03:00
nds
eb4bec0547 0030695: Visualization - selection by box should use clipping planes set for viewer - moving check on touching the clipping plane in selection only.
(cherry picked from commit 2fb3ed87a5)
(cherry picked from commit 618238791bf6f511e36455e89a780c62c401da50)

# Conflicts:
#	src/SelectMgr/SelectMgr_ViewerSelector.cxx
2019-06-11 13:44:34 +03:00
nds
ba793f42f8 0030537: Visualization - wrapping text in font text formatter
(cherry picked from commit 8016b09836)

# Conflicts:
#	src/Graphic3d/Graphic3d_Group.hxx
#	src/OpenGl/OpenGl_Text.hxx
(cherry picked from commit c0a38f3a5294cc0f168bc592f17f4ec9837d5a48)
2019-06-11 13:41:41 +03:00
nds
8fe265bf96 0030484: Visualization - 2d persistent: order of detection doesn't coincide with order of objects creation
(cherry picked from commit a151681f49)
(cherry picked from commit 555748a0d1583c1951fe4d85530c14a87edfdec8)
2019-06-11 13:41:13 +03:00
nds
b412a87c5c 0030425: Visualization - possibility to redefine AIS_Selection
(cherry picked from commit 672fb1a467)
(cherry picked from commit 28ab6a20977f69318559db4f2bd3dd8f49ac3b28)
2019-06-11 13:40:54 +03:00
snn
b7fb7db6ae 0030392: XCAFDoc_GraphNode doesn't copy backward links
(cherry picked from commit 6131065fae)
(cherry picked from commit 713624228050b8f7db4d8b2e22c7edfd8c832471)
2019-06-11 13:40:22 +03:00
nds
8688b82341 0030352: DRAW - Extending interface of ViewerTest_EventManager to process mouse button event
(cherry picked from commit 41e01634af5fccd37fc86931dac6f5c5569a63da)
(cherry picked from commit 7660866377)
(cherry picked from commit a2cd3c1905a3a3c2fb96ceb8eaec1cc982a64c97)
2019-06-11 13:39:54 +03:00
nds
89d8a85dd8 refs 474:Possibility to create and play animations
(cherry picked from commit d9a231a9ce2499615952944cae1a0db6552db2e4)
(cherry picked from commit ab078490cd)
(cherry picked from commit 277ea0a15e589efd7128f915959a18a59ebdfd1c)
2019-06-11 13:39:13 +03:00
nds
72e4a10556 refs #355: Add possibility to hide clipping plane
(cherry picked from commit ca1f82f6c6860a2e1995d7d9a66ce8c152e9d3cc)
(cherry picked from commit 61f39b4dc7)
(cherry picked from commit 7b08ab936a5f6091651fc0311c5c255bd0dc9cb0)

# Conflicts:
#	src/XCAFDoc/XCAFDoc.hxx
2019-06-11 13:38:53 +03:00
nds
503d5141aa Fix reading name of shape from subtype of PRODUCT_DEFINITION STEP entity
(cherry picked from commit 87fc89a8b83565eba0616eebba1f6ce655777461)
(cherry picked from commit 7526e6c9e4)

# Conflicts:
#	src/STEPCAFControl/STEPCAFControl_Reader.cxx
(cherry picked from commit f4608bc37035abbcbe5233fbcafc79bf4ad02b94)
2019-06-11 13:36:36 +03:00
nds
a22653eb86 XCAFDoc/View fixes to store in the view: image, parts transparency, notes, notes positions
(cherry picked from commit b050e0a15c06403adfa545ad793555491a0b6b9f)
(cherry picked from commit 7099619e5d)
(cherry picked from commit ccd4b101f5ab18ab3518b9779e88d687e2db6ff1)

# Conflicts:
#	src/XCAFDoc/XCAFDoc.cxx
#	src/XCAFDoc/XCAFDoc.hxx
2019-06-11 13:35:56 +03:00
aba
11a53a3503 0028954: Visualization - implement interactive object for camera manipulations 2019-06-11 13:22:00 +03:00
686 changed files with 44203 additions and 18295 deletions

View File

@@ -633,26 +633,6 @@ 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}")

View File

@@ -1,4 +1,4 @@
TModelingData TKShapeView
TModelingData TKShapeView TKMessageModel TKMessageView
TVisualization TKView TKVInspector
TApplicationFramework TKTreeModel TKTInspectorAPI TKDFBrowser
TTool TKTInspector TKToolsDraw TInspectorEXE

View File

@@ -440,6 +440,4 @@ t TKVCAF
n XCAFView
n XCAFNoteObjects
t TKRWMesh
n RWGltf
n RWMesh
n RWObj

View File

@@ -73,7 +73,7 @@ if (WIN32)
set (CSF_OpenGlLibs "opengl32.lib")
endif()
else()
else()
if (APPLE)
set (CSF_objc "objc")
@@ -117,6 +117,5 @@ else()
endif()
set (CSF_XwLibs "X11 Xext Xmu Xi")
set (CSF_dl "dl")
set (CSF_fontconfig "fontconfig")
endif()
endif()

View File

@@ -1,86 +0,0 @@
# 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)

View File

@@ -94,7 +94,6 @@ 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 ")
@@ -162,10 +161,6 @@ 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")

View File

@@ -189,9 +189,6 @@ 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
@@ -459,9 +456,6 @@ 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
@@ -570,8 +564,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 12 -sticky e
grid .myFrame.myChecks.myQt4Lbl -row $aCheckRowIter -column 13 -sticky w
grid .myFrame.myChecks.myQt4Check -row $aCheckRowIter -column 10 -sticky e
grid .myFrame.myChecks.myQt4Lbl -row $aCheckRowIter -column 11 -sticky w
incr aCheckRowIter
grid .myFrame.myChecks.myFFmpegCheck -row $aCheckRowIter -column 0 -sticky e
@@ -584,8 +578,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 12 -sticky e
grid .myFrame.myChecks.myJDKLbl -row $aCheckRowIter -column 13 -sticky w
grid .myFrame.myChecks.myJDKCheck -row $aCheckRowIter -column 10 -sticky e
grid .myFrame.myChecks.myJDKLbl -row $aCheckRowIter -column 11 -sticky w
incr aCheckRowIter
if { "$::tcl_platform(os)" == "Darwin" } {
@@ -594,10 +588,6 @@ 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

View File

@@ -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_RAPIDJSON HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo}
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo}
foreach anEnvIter $THE_ENV_VARIABLES {
set ${anEnvIter} "false"
if { [info exists ::env(${anEnvIter})] } {
@@ -858,25 +858,6 @@ 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"

View File

@@ -1393,7 +1393,6 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
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"

View File

@@ -63,7 +63,6 @@ win32 {
CSF_TclTkLibs = -lX11 -ltk8.6
CSF_XwLibs = -lX11 -lXext -lXmu -lXi
CSF_MotifLibs = -lX11
CSF_fontconfig = -lfontconfig
HAVE_GLES2 { CSF_OpenGlLibs = -lEGL -lGLESv2 }
}

View File

@@ -24,7 +24,6 @@ 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="
@@ -164,7 +163,6 @@ 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=;"

BIN
data/images/hatch_1_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

BIN
data/images/hatch_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

BIN
data/images/hatch_3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

BIN
data/images/hatch_4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

BIN
data/images/hatch_5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 B

BIN
data/images/hatch_6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 B

BIN
data/images/hatch_7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 B

BIN
data/images/hatch_8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -878,18 +878,7 @@ 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 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
@subsubsection testmanual_5_1_7 demo
This group allows demonstrating how testing cases are created, and testing DRAW commands and the test system as a whole.
@@ -900,7 +889,7 @@ This group allows demonstrating how testing cases are created, and testing DRAW
| samples | | OCCT samples |
@subsubsection testmanual_5_1_9 draft
@subsubsection testmanual_5_1_8 draft
This group allows testing draft operations.
@@ -911,7 +900,7 @@ DRAW module: MODELING.
| Angle | depouille | Drafts with angle (inclined walls) |
@subsubsection testmanual_5_1_10 feat
@subsubsection testmanual_5_1_9 feat
This group allows testing creation of features on a shape.
@@ -925,7 +914,7 @@ DRAW module: MODELING (package *BRepTest*).
| featrevol | | |
| featrf | | |
@subsubsection testmanual_5_1_11 heal
@subsubsection testmanual_5_1_10 heal
This group allows testing the functionality provided by *ShapeHealing* toolkit.
@@ -954,7 +943,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_12 mesh
@subsubsection testmanual_5_1_11 mesh
This group allows testing shape tessellation (*BRepMesh*) and shading.
@@ -971,7 +960,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_13 mkface
@subsubsection testmanual_5_1_12 mkface
This group allows testing creation of simple surfaces.
@@ -986,7 +975,7 @@ DRAW module: MODELING (package *BRepTest*)
| after_revsurf_and_offset | mkface | |
| mkplane | mkplane | |
@subsubsection testmanual_5_1_14 nproject
@subsubsection testmanual_5_1_13 nproject
This group allows testing normal projection of edges and wires onto a face.
@@ -996,7 +985,7 @@ DRAW module: MODELING (package *BRepTest*)
| :---- | :----- | :------- |
| Base | nproject | |
@subsubsection testmanual_5_1_15 offset
@subsubsection testmanual_5_1_14 offset
This group allows testing offset functionality for curves and surfaces.
@@ -1012,7 +1001,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_16 pipe
@subsubsection testmanual_5_1_15 pipe
This group allows testing construction of pipes (sweeping of a contour along profile).
@@ -1022,7 +1011,7 @@ DRAW module: MODELING (package *BRepTest*)
| :---- | :----- | :------- |
| Standard | pipe | |
@subsubsection testmanual_5_1_17 prism
@subsubsection testmanual_5_1_16 prism
This group allows testing construction of prisms.
@@ -1032,7 +1021,7 @@ DRAW module: MODELING (package *BRepTest*)
| :---- | :----- | :------- |
| seminf | prism | |
@subsubsection testmanual_5_1_18 sewing
@subsubsection testmanual_5_1_17 sewing
This group allows testing sewing of faces by connecting edges.
@@ -1044,7 +1033,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_19 thrusection
@subsubsection testmanual_5_1_18 thrusection
This group allows testing construction of shell or a solid passing through a set of sections in a given sequence (loft).
@@ -1053,7 +1042,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_20 xcaf
@subsubsection testmanual_5_1_19 xcaf
This group allows testing extended data exchange packages.

View File

@@ -222,7 +222,6 @@ 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 |

View File

@@ -5595,7 +5595,7 @@ Draw provides command to create curves and surfaces by approximation.
* **appro** fits a curve through 3d points;
* **surfapp** and **grilapp** fit a surface through 3d points by approximation;
* **surfint** fit a surface through 3d points by interpolation;
* **2dinterpole** interpolates a curve.
* **2dinterpolate** interpolates a curve.
@subsubsection occt_draw_6_8_1 appro, dapprox

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1341,26 +1341,7 @@ 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>
@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.
This algorithm is implemented in the *Bnd_OBB::ReBuild(...)* method.
@subsubsection occt_modat_6_1_2 Creation of OBB based on Axes of inertia

View File

@@ -82,6 +82,19 @@
const Standard_Real SquareTolerance = Precision::SquareConfusion();
namespace
{
static Standard_CString AIS_Table_PrintDisplayStatus[3] =
{
"DISPLAYED", "ERASED", "NONE"
};
static Standard_CString AIS_Table_PrintKindOfInteractive[6] =
{
"NONE", "DATUM", "SHAPE", "OBJECT", "RELATION", "DIMENSION"
};
}
//=======================================================================
//function : Nearest
//purpose :
@@ -783,7 +796,6 @@ 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)
{
@@ -802,6 +814,7 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
{
aPlane = surf2->Plane();
aSurfType = AIS_KOS_Plane;
Offset = 0.;
Result = Standard_True;
}
@@ -817,6 +830,7 @@ 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;
}
}
@@ -825,6 +839,7 @@ 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)
{
@@ -837,6 +852,7 @@ Standard_Boolean AIS::GetPlaneFromFace(const TopoDS_Face& aFace,
TheType == STANDARD_TYPE(Geom_ToroidalSurface))
{
aSurf = (Handle( Geom_OffsetSurface )::DownCast( aSurf ))->Surface();
Offset = 0.0e0;
}
else
{
@@ -896,18 +912,20 @@ gp_Pnt AIS::ProjectPointOnLine( const gp_Pnt & aPoint, const gp_Lin & aLine )
//function : InitFaceLength
//purpose :
//=======================================================================
void AIS::InitFaceLength (const TopoDS_Face& theFace,
gp_Pln& thePlane,
Handle(Geom_Surface)& theSurface,
AIS_KindOfSurface& theSurfaceType,
Standard_Real& theOffset)
void AIS::InitFaceLength (const TopoDS_Face& aFace,
gp_Pln & aPlane,
Handle(Geom_Surface) & aSurface,
AIS_KindOfSurface & aSurfaceType,
Standard_Real & anOffset)
{
if (AIS::GetPlaneFromFace (theFace, thePlane, theSurface, theSurfaceType, theOffset)
&& Abs (theOffset) > Precision::Confusion())
{
theSurface = new Geom_OffsetSurface (theSurface, theOffset);
theOffset = 0.0e0;
}
AIS::GetPlaneFromFace( aFace, aPlane, aSurface, aSurfaceType, anOffset );
if (Abs( anOffset ) > Precision::Confusion())
{
aSurface = new Geom_OffsetSurface( aSurface, anOffset );
anOffset = 0.0e0;
}
}
//=======================================================================
@@ -1533,3 +1551,63 @@ void AIS::ComputeProjVertexPresentation (const Handle( Prs3d_Presentation )& aPr
StdPrs_WFShape::Add (aPresentation, MakEd.Edge(), aDrawer);
}
}
//=======================================================================
//function : DisplayStatusToString
//purpose :
//=======================================================================
Standard_CString AIS::DisplayStatusToString (AIS_DisplayStatus theType)
{
return AIS_Table_PrintDisplayStatus[theType];
}
//=======================================================================
//function : DisplayStatusFromString
//purpose :
//=======================================================================
Standard_Boolean AIS::DisplayStatusFromString (Standard_CString theTypeString,
AIS_DisplayStatus& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= AIS_DS_None; ++aTypeIter)
{
Standard_CString aTypeName = AIS_Table_PrintDisplayStatus[aTypeIter];
if (aName == aTypeName)
{
theType = AIS_DisplayStatus (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : KindOfInteractiveToString
//purpose :
//=======================================================================
Standard_CString AIS::KindOfInteractiveToString (AIS_KindOfInteractive theType)
{
return AIS_Table_PrintKindOfInteractive[theType];
}
//=======================================================================
//function : KindOfInteractiveFromString
//purpose :
//=======================================================================
Standard_Boolean AIS::KindOfInteractiveFromString (Standard_CString theTypeString,
AIS_KindOfInteractive& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= AIS_KOI_Dimension; ++aTypeIter)
{
Standard_CString aTypeName = AIS_Table_PrintKindOfInteractive[aTypeIter];
if (aName == aTypeName)
{
theType = AIS_KindOfInteractive (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}

View File

@@ -17,6 +17,8 @@
#ifndef _AIS_HeaderFile
#define _AIS_HeaderFile
#include <AIS_DisplayStatus.hxx>
#include <AIS_KindOfInteractive.hxx>
#include <AIS_KindOfSurface.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Aspect_TypeOfMarker.hxx>
@@ -203,6 +205,50 @@ public:
Standard_EXPORT static void ComputeProjVertexPresentation (const Handle(Prs3d_Presentation)& aPres, const Handle(Prs3d_Drawer)& aDrawer, const TopoDS_Vertex& aVertex, const gp_Pnt& ProjPoint, const Quantity_NameOfColor aColor = Quantity_NOC_PURPLE, const Standard_Real aWidth = 2, const Aspect_TypeOfMarker aProjTOM = Aspect_TOM_PLUS, const Aspect_TypeOfLine aCallTOL = Aspect_TOL_DOT);
//! Returns the string name for a given enum type.
//! @param theType display status
//! @return string identifier
Standard_EXPORT static Standard_CString DisplayStatusToString (AIS_DisplayStatus theType);
//! Returns the display status from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return status type or AIS_DS_None if string identifier is invalid
static AIS_DisplayStatus DisplayStatusFromString (Standard_CString theTypeString)
{
AIS_DisplayStatus aType = AIS_DS_None;
DisplayStatusFromString (theTypeString, aType);
return aType;
}
//! Determines the shape type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected display status
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean DisplayStatusFromString (const Standard_CString theTypeString,
AIS_DisplayStatus& theType);
//! Returns the string name for a given enum type.
//! @param theType display status
//! @return string identifier
Standard_EXPORT static Standard_CString KindOfInteractiveToString (AIS_KindOfInteractive theType);
//! Returns the display status from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return status type or AIS_KOI_None if string identifier is invalid
static AIS_KindOfInteractive KindOfInteractiveFromString (Standard_CString theTypeString)
{
AIS_KindOfInteractive aType = AIS_KOI_None;
KindOfInteractiveFromString (theTypeString, aType);
return aType;
}
//! Determines the shape type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected display status
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean KindOfInteractiveFromString (const Standard_CString theTypeString,
AIS_KindOfInteractive& theType);
};
#endif // _AIS_HeaderFile

View File

@@ -26,6 +26,7 @@
#include <Graphic3d_AspectText3d.hxx>
#include <Graphic3d_GraphicDriver.hxx>
#include <Graphic3d_ArrayOfTriangles.hxx>
#include <Graphic3d_Text.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_ShadingAspect.hxx>
@@ -796,16 +797,14 @@ void AIS_ColorScale::drawText (const Handle(Graphic3d_Group)& theGroup,
const Graphic3d_VerticalTextAlignment theVertAlignment)
{
const Handle(Prs3d_TextAspect)& anAspect = myDrawer->TextAspect();
theGroup->Text (theText,
gp_Ax2 (gp_Pnt (theX, theY, 0.0), gp::DZ()),
anAspect->Height(),
anAspect->Angle(),
anAspect->Orientation(),
Graphic3d_HTA_LEFT,
theVertAlignment,
Standard_True,
Standard_False); // has own anchor
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (anAspect->Height());
aTextParams->SetText (theText.ToExtString());
aTextParams->SetOrientation (gp_Ax2 (gp_Pnt (theX, theY, 0.0), gp::DZ()));
aTextParams->SetOwnAnchorPoint (Standard_False);
aTextParams->SetVAlignment (theVertAlignment);
theGroup->AddText (aTextParams);
}
//=======================================================================

View File

@@ -633,9 +633,11 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation
{
aShadedGroup = thePrs->NewGroup();
aShadedGroup->SetClosed (isClosed);
if (isClosed
&& !myCappingStyle.IsNull())
aShadedGroup->SetGroupPrimitivesAspect (myCappingStyle);
if (isClosed)
{
if (aDrawer->HasOwnFillCappingAspect())
aShadedGroup->SetGroupPrimitivesAspect (aDrawer->FillCappingAspect());
}
}
aShadedGroup->SetPrimitivesAspect (aDrawer->ShadingAspect()->Aspect());
aShadedGroup->AddPrimitiveArray (aTriangles);

View File

@@ -161,7 +161,6 @@ myIsAutoActivateSelMode(Standard_True)
aStyle->SetMethod(Aspect_TOHM_COLOR);
aStyle->SetColor (Quantity_NOC_GRAY40);
}
InitAttributes();
}
@@ -1945,7 +1944,11 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
}
const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
unhighlightOwners (theIObj);
AIS_NListOfEntityOwner anOwners;
const Handle(SelectMgr_EntityOwner)& aGlobOwner = theIObj->GlobalSelOwner();
if (!aGlobOwner.IsNull())
anOwners.Append(aGlobOwner);
unhighlightOwners (anOwners);
myMainPM->SetVisibility (theIObj, aStatus->DisplayMode(), Standard_False);
if (!myLastPicked.IsNull()
@@ -1977,10 +1980,10 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
}
//=======================================================================
//function : unhighlightOwners
//function : unselectOwners
//purpose :
//=======================================================================
void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject)
void AIS_InteractiveContext::unselectOwners (const Handle(AIS_InteractiveObject)& theObject)
{
SelectMgr_SequenceOfOwner aSeq;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
@@ -2014,7 +2017,7 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
return;
}
unhighlightOwners (theIObj);
unselectOwners (theIObj);
myMainPM->Erase (theIObj, -1);
theIObj->ErasePresentations (true); // make sure highlighting presentations are properly erased
@@ -2522,15 +2525,6 @@ 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 :

View File

@@ -25,6 +25,8 @@
#include <AIS_ListOfInteractive.hxx>
#include <AIS_Selection.hxx>
#include <AIS_SelectionModesConcurrency.hxx>
#include <AIS_SelectionScheme.hxx>
#include <AIS_SelectionType.hxx>
#include <AIS_StatusOfDetection.hxx>
#include <AIS_StatusOfPick.hxx>
#include <AIS_TypeOfIso.hxx>
@@ -467,6 +469,24 @@ public: //! @name Selection management
return AddSelect (theObject->GlobalSelOwner());
}
//! Selects everything found in the bounding rectangle defined by the pixel minima and maxima, XPMin, YPMin, XPMax, and YPMax in the view.
//! The objects detected are passed to the main viewer, which is then updated.
Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer theXPMin,
const Standard_Integer theYPMin,
const Standard_Integer theXPMax,
const Standard_Integer theYPMax,
const Handle(V3d_View)& theView,
const AIS_SelectionScheme theSelScheme);
//! polyline selection; clears the previous picked list
Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& thePolyline,
const Handle(V3d_View)& theView,
const AIS_SelectionScheme theSelScheme);
//! Stores and hilights the previous detected; Unhilights the previous picked.
//! @sa MoveTo().
Standard_EXPORT AIS_StatusOfPick Select (const AIS_SelectionScheme theSelScheme);
//! Selects everything found in the bounding rectangle defined by the pixel minima and maxima, XPMin, YPMin, XPMax, and YPMax in the view.
//! The objects detected are passed to the main viewer, which is then updated.
Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer theXPMin,
@@ -505,6 +525,13 @@ public: //! @name Selection management
const Handle(V3d_View)& theView,
const Standard_Boolean theToUpdateViewer);
//! Sets list of owner selected/deselected using selection scheme
//! It is possible that selection of other objects is changed relatively selection scheme .
//! \param theOwner owners to change selection state
//! \param theSelScheme selection scheme
Standard_EXPORT AIS_StatusOfPick Select (const AIS_NListOfEntityOwner& theOwners,
const AIS_SelectionScheme theSelScheme);
//! 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,
@@ -557,14 +584,6 @@ 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);
@@ -824,9 +843,6 @@ 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!
@@ -1203,6 +1219,13 @@ public: //! @name sub-intensity management (deprecated)
Standard_EXPORT void SubIntensityOff (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Boolean theToUpdateViewer);
//! Sets selection instance to manipulate a container of selected owners
//! \param theSelection an instance of the selection
void SetSelection (const Handle(AIS_Selection)& theSelection) { mySelection = theSelection; }
//! Returns selection instance
const Handle(AIS_Selection)& Selection() const { return mySelection; }
protected: //! @name internal methods
Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
@@ -1222,7 +1245,7 @@ protected: //! @name internal methods
Standard_EXPORT Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr);
//! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
Standard_EXPORT void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
Standard_EXPORT void unselectOwners (const Handle(AIS_InteractiveObject)& theObject);
//! Helper function that highlights the owner given with <theStyle> without
//! performing AutoHighlight checks, e.g. is used for dynamic highlight.
@@ -1233,12 +1256,17 @@ protected: //! @name internal methods
//! for AutoHighlight, e.g. is used for selection.
Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner);
//! Helper function that highlights the owners given with <theStyle> with check
//! for AutoHighlight, e.g. is used for selection.
Standard_EXPORT void highlightOwners (const AIS_NListOfEntityOwner& theOwners,
const Standard_Boolean& theToUseObjectDisplayMode);
//! Helper function that highlights global owner of the object given with <theStyle> with check
//! for AutoHighlight, e.g. is used for selection.
//! If global owner is null, it simply highlights the whole object
Standard_EXPORT void highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theDispMode) const;
const Standard_Integer theDispMode);
//! Helper function that unhighlights all owners that are stored in current AIS_Selection.
//! The function updates global status and selection state of owner and interactive object.
@@ -1246,9 +1274,14 @@ protected: //! @name internal methods
//! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
Standard_EXPORT void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
//! Helper function that highlights the owners given with <theStyle> with check
//! for AutoHighlight, e.g. is used for selection.
Standard_EXPORT void unhighlightOwners (const AIS_NListOfEntityOwner& theOwners,
const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
//! Helper function that unhighlights global selection owner of given interactive.
//! The function does not perform any updates of global or owner status
Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj) const;
Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj);
//! Helper function that turns on sub-intensity in global status and highlights
//! given objects with sub-intensity color
@@ -1391,7 +1424,6 @@ protected: //! @name internal fields
SelectMgr_PickingStrategy myPickingStrategy; //!< picking strategy to be applied within MoveTo()
Standard_Boolean myAutoHilight;
Standard_Boolean myIsAutoActivateSelMode;
};
DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, Standard_Transient)

View File

@@ -85,30 +85,9 @@ void AIS_InteractiveContext::highlightWithColor (const Handle(SelectMgr_EntityOw
//=======================================================================
void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner)
{
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
if (anObj.IsNull())
{
return;
}
if (!theOwner->IsAutoHilight())
{
SelectMgr_SequenceOfOwner aSeq;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
if (aSelIter.Value()->IsSameSelectable (anObj))
{
aSeq.Append (aSelIter.Value());
}
}
anObj->HilightSelected (myMainPM, aSeq);
}
else
{
const Handle(Prs3d_Drawer)& aStyle = getSelStyle (anObj, theOwner);
const Standard_Integer aHiMode = getHilightMode (anObj, aStyle, -1);
theOwner->HilightWithColor (myMainPM, aStyle, aHiMode);
}
AIS_NListOfEntityOwner anOwners;
anOwners.Append (theOwner);
highlightOwners (anOwners, Standard_False/*check if it is really important*/);
}
//=======================================================================
@@ -117,14 +96,15 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn
//=======================================================================
void AIS_InteractiveContext::highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theDispMode) const
const Standard_Integer /*theDispMode*/)
{
if (theObj.IsNull())
{
return;
}
const Standard_Integer aHiMode = getHilightMode (theObj, theStyle, theDispMode);
const Handle(AIS_GlobalStatus)& aStatus = myObjects (theObj);
const Standard_Integer aHiMode = getHilightMode (theObj, theStyle, aStatus->DisplayMode());
const Handle(SelectMgr_EntityOwner)& aGlobOwner = theObj->GlobalSelOwner();
if (aGlobOwner.IsNull())
@@ -133,22 +113,9 @@ void AIS_InteractiveContext::highlightGlobal (const Handle(AIS_InteractiveObject
return;
}
if (!aGlobOwner->IsAutoHilight())
{
SelectMgr_SequenceOfOwner aSeq;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
if (aSelIter.Value()->IsSameSelectable (theObj))
{
aSeq.Append (aSelIter.Value());
}
}
theObj->HilightSelected (myMainPM, aSeq);
}
else
{
aGlobOwner->HilightWithColor (myMainPM, theStyle, aHiMode);
}
AIS_NListOfEntityOwner anOwners;
anOwners.Append (aGlobOwner);
highlightOwners (anOwners, Standard_True);
}
//=======================================================================
@@ -156,24 +123,30 @@ void AIS_InteractiveContext::highlightGlobal (const Handle(AIS_InteractiveObject
//purpose :
//=======================================================================
void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity)
{
unhighlightOwners (mySelection->Objects(), theIsToHilightSubIntensity);
}
//=======================================================================
//function : unhighlightOwners
//purpose :
//=======================================================================
void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& theOwners,
const Standard_Boolean theIsToHilightSubIntensity)
{
NCollection_IndexedMap<Handle(AIS_InteractiveObject)> anObjToClear;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
for (AIS_NListOfEntityOwner::Iterator aSelIter (theOwners); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anInteractive = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
Handle(AIS_GlobalStatus) aStatus;
if (!myObjects.Find (anInteractive, aStatus))
{
continue;
}
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anInteractive);
if (anOwner->IsAutoHilight())
{
anOwner->Unhilight (myMainPM);
if (theIsToHilightSubIntensity)
{
if (aStatus->IsSubIntensityOn())
if (!aStatus.IsNull() && aStatus->IsSubIntensityOn())
{
const Standard_Integer aHiMode = getHilightMode (anInteractive, aStatus->HilightStyle(), aStatus->DisplayMode());
highlightWithSubintensity (anOwner, aHiMode);
@@ -184,9 +157,9 @@ void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsTo
{
anObjToClear.Add (anInteractive);
}
if (anOwner == anInteractive->GlobalSelOwner())
if (!aStatus.IsNull() && anOwner == anInteractive->GlobalSelOwner())
{
myObjects.ChangeFind (anInteractive)->SetHilightStatus (Standard_False);
aStatus->SetHilightStatus (Standard_False);
}
}
for (NCollection_IndexedMap<Handle(AIS_InteractiveObject)>::Iterator anIter (anObjToClear); anIter.More(); anIter.Next())
@@ -201,7 +174,7 @@ void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsTo
//function : unhighlightGlobal
//purpose :
//=======================================================================
void AIS_InteractiveContext::unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj) const
void AIS_InteractiveContext::unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj)
{
if (theObj.IsNull())
{
@@ -215,15 +188,9 @@ void AIS_InteractiveContext::unhighlightGlobal (const Handle(AIS_InteractiveObje
return;
}
if (aGlobOwner->IsAutoHilight())
{
aGlobOwner->Unhilight (myMainPM);
}
else
{
myMainPM->Unhighlight (theObj);
theObj->ClearSelected();
}
AIS_NListOfEntityOwner anOwners;
anOwners.Append (aGlobOwner);
unhighlightOwners (anOwners);
}
//=======================================================================
@@ -485,37 +452,22 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
const Standard_Integer theXPMax,
const Standard_Integer theYPMax,
const Handle(V3d_View)& theView,
const Standard_Boolean toUpdateViewer)
const AIS_SelectionScheme theSelScheme)
{
if (theView->Viewer() != myMainVwr)
{
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
}
// all objects detected by the selector are taken, previous current objects are emptied,
// new objects are put...
ClearSelected (Standard_False);
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
AIS_NListOfEntityOwner aPickedOwners;
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
const Handle(SelectMgr_EntityOwner)& aCurOwner = myMainSel->Picked (aPickIter);
if (aCurOwner.IsNull() || !aCurOwner->HasSelectable() || !myFilters->IsOk (aCurOwner))
continue;
mySelection->Select (aCurOwner);
aPickedOwners.Append (myMainSel->Picked (aPickIter));
}
if (myAutoHilight)
{
HilightSelected (toUpdateViewer);
}
Standard_Integer aSelNum = NbSelected();
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
return Select (aPickedOwners, theSelScheme);
}
//=======================================================================
@@ -524,94 +476,87 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& thePolyline,
const Handle(V3d_View)& theView,
const Standard_Boolean toUpdateViewer)
const AIS_SelectionScheme theSelScheme)
{
if (theView->Viewer() != myMainVwr)
{
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
}
// all objects detected by the selector are taken, previous current objects are emptied,
// new objects are put...
ClearSelected (Standard_False);
myMainSel->Pick (thePolyline, theView);
AIS_NListOfEntityOwner aPickedOwners;
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
const Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aPickIter);
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
mySelection->Select (anOwner);
aPickedOwners.Append (myMainSel->Picked (aPickIter));
}
if (myAutoHilight)
{
HilightSelected (toUpdateViewer);
}
Standard_Integer aSelNum = NbSelected();
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
return Select (aPickedOwners, theSelScheme);
}
//=======================================================================
//function : Select
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdateViewer)
AIS_StatusOfPick AIS_InteractiveContext::Select (const AIS_SelectionScheme theSelScheme)
{
if (!myLastPicked.IsNull())
// special case: single selection of detected owner - is it necessary ?
/*if (myWasLastMain && !myLastPicked.IsNull() && !myAutoHilight &&
(myLastPicked->IsSelected()
&& !myLastPicked->IsForcedHilight()
&& NbSelected() <= 1))
{
if (myAutoHilight)
{
clearDynamicHighlight();
}
if (!myLastPicked->IsSelected()
|| myLastPicked->IsForcedHilight()
|| NbSelected() > 1)
{
SetSelected (myLastPicked, Standard_False);
if(toUpdateViewer)
{
UpdateCurrentViewer();
}
}
}
else
{
ClearSelected (toUpdateViewer);
}
mySelection->selectOwner(myLastPicked, aPrevSelected, SelectionScheme (AIS_SelectionType_Select));
return getStatusOfPick (NbSelected());
}*/
Standard_Integer aSelNum = NbSelected();
AIS_NListOfEntityOwner aPickedOwners;
aPickedOwners.Append (myLastPicked);
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
return Select (aPickedOwners, theSelScheme);
}
//=======================================================================
//function : Select
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMin,
const Standard_Integer theYPMin,
const Standard_Integer theXPMax,
const Standard_Integer theYPMax,
const Handle(V3d_View)& theView,
const Standard_Boolean)
{
return Select (theXPMin, theYPMin, theXPMax, theYPMax, theView, AIS_SelectionScheme_ClearAndAdd);
}
//=======================================================================
//function : Select
//purpose : Selection by polyline
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& thePolyline,
const Handle(V3d_View)& theView,
const Standard_Boolean)
{
return Select (thePolyline, theView, AIS_SelectionScheme_ClearAndAdd);
}
//=======================================================================
//function : Select
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean)
{
return Select (AIS_SelectionScheme_ClearAndAdd);
}
//=======================================================================
//function : ShiftSelect
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Boolean toUpdateViewer)
AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Boolean)
{
if (myAutoHilight)
{
clearDynamicHighlight();
}
if (!myLastPicked.IsNull())
{
AddOrRemoveSelected (myLastPicked, toUpdateViewer);
}
Standard_Integer aSelNum = NbSelected();
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
return Select (AIS_SelectionScheme_Switch);
}
//=======================================================================
@@ -623,38 +568,9 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
const Standard_Integer theXPMax,
const Standard_Integer theYPMax,
const Handle(V3d_View)& theView,
const Standard_Boolean toUpdateViewer)
const Standard_Boolean)
{
if (theView->Viewer() != myMainVwr)
{
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
}
if (myAutoHilight)
{
UnhilightSelected (Standard_False);
}
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
const Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aPickIter);
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
mySelection->Select (anOwner);
}
if (myAutoHilight)
{
HilightSelected (toUpdateViewer);
}
Standard_Integer aSelNum = NbSelected();
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
return Select (theXPMin, theYPMin, theXPMax, theYPMax, theView, AIS_SelectionScheme_Switch);
}
//=======================================================================
@@ -663,30 +579,31 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d& thePolyline,
const Handle(V3d_View)& theView,
const Standard_Boolean toUpdateViewer)
const Standard_Boolean)
{
if (theView->Viewer() != myMainVwr)
{
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
}
return Select (thePolyline, theView, AIS_SelectionScheme_Switch);
}
//=======================================================================
//function : Select
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const AIS_NListOfEntityOwner& theOwners,
const AIS_SelectionScheme theSelScheme)
{
// all objects detected by the selector are taken, previous current objects are emptied,
// new objects are put...
if (myAutoHilight)
{
clearDynamicHighlight();
UnhilightSelected (Standard_False);
}
myMainSel->Pick (thePolyline, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
const Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aPickIter);
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
mySelection->Select (anOwner);
}
mySelection->SelectOwners (theOwners, theSelScheme, myFilters);
if (myAutoHilight)
{
HilightSelected (toUpdateViewer);
HilightSelected (Standard_False);
}
Standard_Integer aSelNum = NbSelected();
@@ -704,14 +621,31 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
{
// In case of selection without using local context
clearDynamicHighlight();
highlightOwners (mySelection->Objects(), Standard_True);
if (theToUpdateViewer)
UpdateCurrentViewer();
}
//=======================================================================
//function : highlightOwners
//purpose :
//=======================================================================
void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theOwners,
const Standard_Boolean& theToUseObjectDisplayMode)
{
AIS_MapOfObjSelectedOwners anObjOwnerMap;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
for (AIS_NListOfEntityOwner::Iterator aSelIter (theOwners); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
if (anObj.IsNull())
continue;
const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anObj, anOwner);
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind(anObj);
if (anOwner == anObj->GlobalSelOwner())
if (theToUseObjectDisplayMode && anOwner == anObj->GlobalSelOwner())
{
aState->SetHilightStatus (Standard_True);
aState->SetHilightStyle (anObjSelStyle);
@@ -732,7 +666,7 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
}
else
{
const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, aState->DisplayMode());
const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, theToUseObjectDisplayMode ? aState->DisplayMode() : -1);
anOwner->HilightWithColor (myMainPM, anObjSelStyle, aHiMode);
}
}
@@ -745,9 +679,6 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
}
anObjOwnerMap.Clear();
}
if (theToUpdateViewer)
UpdateCurrentViewer();
}
//=======================================================================
@@ -756,17 +687,7 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
//=======================================================================
void AIS_InteractiveContext::UnhilightSelected (const Standard_Boolean theToUpdateViewer)
{
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
if (anOwner == anObj->GlobalSelOwner())
{
myObjects.ChangeFind (anObj)->SetHilightStatus (Standard_False);
}
anOwner->Unhilight (myMainPM);
}
unhighlightSelected();
if (theToUpdateViewer)
UpdateCurrentViewer();
@@ -921,13 +842,6 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
}
}
if (myAutoHilight && theOwner == anObject->GlobalSelOwner())
{
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObject);
aState->SetHilightStatus (Standard_True);
aState->SetHilightStyle (anObjSelStyle);
}
if (theToUpdateViewer)
UpdateCurrentViewer();
}
@@ -974,28 +888,19 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
if (myAutoHilight)
{
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
const Standard_Boolean isGlobal = anObj->GlobalSelOwner() == theOwner;
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
if (!myObjects.IsBound(anObj)) // e.g. AIS_ViewCubeFlat is not displayed
return;
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
if (theOwner->IsSelected())
{
highlightSelected (theOwner);
if (isGlobal)
{
aStatus->SetHilightStatus (Standard_True);
aStatus->SetHilightStyle (getSelStyle (anObj, theOwner));
}
}
else
{
if (theOwner->IsAutoHilight())
{
theOwner->Unhilight (myMainPM);
}
else
{
anObj->ClearSelected();
}
aStatus->SetHilightStatus (Standard_False);
AIS_NListOfEntityOwner anOwners;
anOwners.Append (theOwner);
unhighlightOwners (anOwners);
aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
}
}
@@ -1004,43 +909,6 @@ 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

View File

@@ -84,37 +84,6 @@ void AIS_InteractiveObject::SetContext (const Handle(AIS_InteractiveContext)& th
}
}
//=======================================================================
//function : SetCappingStyle
//purpose :
//=======================================================================
void AIS_InteractiveObject::SetCappingStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle)
{
myCappingStyle = theStyle;
// Modify existing presentations
for (Standard_Integer aPrsIter = 1, n = myPresentations.Length(); aPrsIter <= n; ++aPrsIter)
{
const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter);
if (!aPrs3d.IsNull())
{
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
if (!aStruct.IsNull())
{
const Graphic3d_SequenceOfGroup& aGroups = aStruct->Groups();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next())
{
Handle(Graphic3d_Group)& aGrp = aGroupIter.ChangeValue();
if (aGrp.IsNull())
continue;
aGrp->SetGroupPrimitivesAspect (theStyle);
}
}
}
}
}
//=======================================================================
//function : HasPresentation
//purpose :
@@ -175,3 +144,26 @@ void AIS_InteractiveObject::SetAspect(const Handle(Prs3d_BasicAspect)& theAspect
aGroup->SetGroupPrimitivesAspect (aTextAspect->Aspect());
}
}
const TCollection_AsciiString AIS_InteractiveObject_ClassName = "AIS_InteractiveObject";
// =======================================================================
// function : Dump
// purpose :
// =======================================================================
void AIS_InteractiveObject::Dump (Standard_OStream& OS) const
{
DUMP_START_KEY (OS, AIS_InteractiveObject_ClassName);
{
Standard_SStream aTmpStream;
SelectMgr_SelectableObject::Dump (aTmpStream);
DUMP_VALUES (OS, "SelectMgr_SelectableObject", TCollection::ToDumpString (aTmpStream));
}
DUMP_VALUES (OS, "InteractiveContext", TCollection::GetPointerInfo (myCTXPtr));
DUMP_VALUES (OS, "Owner", TCollection::GetPointerInfo (myOwner));
DUMP_STOP_KEY (OS, AIS_InteractiveObject_ClassName);
}

View File

@@ -104,12 +104,6 @@ public:
void ClearOwner() { myOwner.Nullify(); }
public:
//! Set style of filling capping section created by clipping planes.
Standard_EXPORT virtual void SetCappingStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle);
//! Returns style for filling capping section created by clipping planes.
const Handle(Graphic3d_AspectFillCapping)& CappingStyle() const { return myCappingStyle; }
//! Returns the context pointer to the interactive context.
Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
@@ -124,6 +118,9 @@ public:
Standard_DEPRECATED("Deprecated method, results might be undefined")
Standard_EXPORT void SetAspect (const Handle(Prs3d_BasicAspect)& anAspect);
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
protected:
//! The TypeOfPresention3d means that the interactive object
@@ -134,7 +131,6 @@ protected:
AIS_InteractiveContext* myCTXPtr; //!< pointer to Interactive Context, where object is currently displayed; @sa SetContext()
Handle(Standard_Transient) myOwner; //!< application-specific owner object
Handle(Graphic3d_AspectFillCapping) myCappingStyle;
};

View File

@@ -1035,21 +1035,15 @@ 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())
{

View File

@@ -1,36 +0,0 @@
// 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

View File

@@ -1,33 +0,0 @@
// 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

View File

@@ -15,6 +15,8 @@
#include <AIS_Selection.hxx>
#include <AIS_InteractiveObject.hxx>
#include <AIS_SelectionScheme.hxx>
#include <SelectMgr_Filter.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_Selection, Standard_Transient)
@@ -130,3 +132,71 @@ AIS_SelectStatus AIS_Selection::AddSelect (const Handle(SelectMgr_EntityOwner)&
theObject->SetSelected (Standard_True);
return AIS_SS_Added;
}
//=======================================================================
//function : SelectOwners
//purpose :
//=======================================================================
void AIS_Selection::SelectOwners (const AIS_NListOfEntityOwner& thePickedOwners,
const int theSelScheme,
const Handle(SelectMgr_Filter)& theFilter)
{
int aSelScheme = theSelScheme;
AIS_NListOfEntityOwner aPrevSelected = Objects();
if (theSelScheme & AIS_SelectionScheme_Clear)
{
Clear();
if (theSelScheme & AIS_SelectionScheme_Switch &&
theSelScheme & AIS_SelectionScheme_PickedIfEmpty &&
thePickedOwners.Size() < aPrevSelected.Size())
{
// check if all picked objects are in previous selected list, if so, all objects will be deselected,
// but in mode AIS_SelectionScheme_PickedIfEmpty new picked objects should be selected, here, after Clear, Add
Standard_Boolean anOtherFound = Standard_False;
for (AIS_NListOfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
{
anOtherFound = !aPrevSelected.Contains (aSelIter.Value());
if (anOtherFound)
break;
}
if (!anOtherFound)
aSelScheme = AIS_SelectionScheme_Add;
}
}
for (AIS_NListOfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
{
selectOwner(aSelIter.Value(), aPrevSelected, aSelScheme, theFilter);
}
}
//=======================================================================
//function : selectOwner
//purpose :
//=======================================================================
AIS_SelectStatus AIS_Selection::selectOwner (const Handle(SelectMgr_EntityOwner)& theOwner,
const AIS_NListOfEntityOwner& thePreviousSelected,
const int theSelScheme,
const Handle(SelectMgr_Filter)& theFilter)
{
if (theOwner.IsNull() || !theOwner->HasSelectable() || !theFilter->IsOk (theOwner))
return AIS_SS_NotDone;
if (theSelScheme & AIS_SelectionScheme_Add)
{
return AddSelect (theOwner);
}
else if (theSelScheme & AIS_SelectionScheme_Switch)
{
if (thePreviousSelected.Contains (theOwner)) // was selected, should not be now
{
if (theOwner->IsSelected())
return Select (theOwner); // deselect
}
else
return AddSelect (theOwner); // was not selected, should be now
}
return AIS_SS_NotDone;
}

View File

@@ -22,6 +22,8 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
class SelectMgr_Filter;
//! Class holding the list of selected owners.
class AIS_Selection : public Standard_Transient
{
@@ -32,18 +34,18 @@ public:
Standard_EXPORT AIS_Selection();
//! removes all the object of the selection.
Standard_EXPORT void Clear();
Standard_EXPORT virtual void Clear();
//! if the object is not yet in the selection, it will be added.
//! if the object is already in the selection, it will be removed.
Standard_EXPORT AIS_SelectStatus Select (const Handle(SelectMgr_EntityOwner)& theObject);
Standard_EXPORT virtual AIS_SelectStatus Select (const Handle(SelectMgr_EntityOwner)& theObject);
//! the object is always add int the selection.
//! faster when the number of objects selected is great.
Standard_EXPORT AIS_SelectStatus AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
Standard_EXPORT virtual AIS_SelectStatus AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
//! clears the selection and adds the object in the selection.
void ClearAndSelect (const Handle(SelectMgr_EntityOwner)& theObject)
virtual void ClearAndSelect (const Handle(SelectMgr_EntityOwner)& theObject)
{
Clear();
Select (theObject);
@@ -75,6 +77,28 @@ public:
//! Return selected object at iterator position.
const Handle(SelectMgr_EntityOwner)& Value() const { return myIterator.Value(); }
//! Select or deselect owners depending on the selection scheme
//! \param theOwners elements to change selection state
//! \param theSelScheme selection scheme, defines how owner is selected
//! \param theFilter context filter to skip not acceptable owners
//! \return result of selection
Standard_EXPORT virtual void SelectOwners (const AIS_NListOfEntityOwner& thePickedOwners,
const int theSelScheme,
const Handle(SelectMgr_Filter)& theFilter);
protected:
//! Select or deselect owner depending on the selection scheme
//! \param theOwner element to change selection state
//! \param thePreviousSelected previous selected objects
//! \param theSelScheme selection scheme, defines how owner is selected
//! \param theFilter context filter to skip not acceptable owners
//! \return result of selection
Standard_EXPORT virtual AIS_SelectStatus selectOwner (const Handle(SelectMgr_EntityOwner)& theOwner,
const AIS_NListOfEntityOwner& thePreviousSelected,
const int theSelScheme,
const Handle(SelectMgr_Filter)& theFilter);
private:
AIS_NListOfEntityOwner myresult;

View File

@@ -0,0 +1,34 @@
// 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_SelectionScheme_HeaderFile
#define _AIS_SelectionScheme_HeaderFile
//! Sets selection schemes for interactive contexts.
//! It is possible to use combination of schemes.
enum AIS_SelectionScheme
{
AIS_SelectionScheme_Empty = 0x0000, // do nothing
AIS_SelectionScheme_Clear = 0x0001, // clears current selection
AIS_SelectionScheme_Add = 0x0002, // add detected object to current selection
AIS_SelectionScheme_Switch = 0x0004, // switch selection state in values selected/deselected
AIS_SelectionScheme_PickedIfEmpty = 0x0008, // if after switch, result selection is empty, select picked objects
AIS_SelectionScheme_ClearAndSwitch = AIS_SelectionScheme_Clear | AIS_SelectionScheme_Switch,
AIS_SelectionScheme_ClearAndAdd = AIS_SelectionScheme_Clear | AIS_SelectionScheme_Add,
AIS_SelectionScheme_ClearAndSwitchAndPicked = AIS_SelectionScheme_ClearAndSwitch | AIS_SelectionScheme_PickedIfEmpty,
AIS_SelectionScheme_Custom // reserved item for custom selection scheme
};
#endif // _AIS_SelectionScheme_HeaderFile

View File

@@ -11,21 +11,21 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_NavigationMode_HeaderFile
#define _AIS_NavigationMode_HeaderFile
//! Camera navigation mode.
enum AIS_NavigationMode
#ifndef _AIS_SelectionType_HeaderFile
#define _AIS_SelectionType_HeaderFile
//! Sets selection schemes for interactive contexts.
//! It is possible to use combination of schemes.
enum AIS_SelectionType
{
AIS_NavigationMode_Orbit, //!< orbit rotation
AIS_NavigationMode_FirstPersonFlight, //!< flight rotation (first person)
AIS_NavigationMode_FirstPersonWalk, //!< walking mode (first person)
AIS_SelectionType_Select,
AIS_SelectionType_SelectInRect,
AIS_SelectionType_SelectInPoly,
AIS_SelectionType_ShiftSelect,
AIS_SelectionType_ShiftSelectInRect,
AIS_SelectionType_ShiftSelectInPoly
};
enum
{
AIS_NavigationMode_LOWER = 0,
AIS_NavigationMode_UPPER = AIS_NavigationMode_FirstPersonWalk
};
#endif // _V3d_NavigationMode_HeaderFile
#endif // _AIS_SelectionType_HeaderFile

View File

@@ -180,7 +180,7 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
try
{
OCC_CATCH_SIGNALS
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer, myCappingStyle);
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer, myDrawer->FillCappingAspect());
}
catch (Standard_Failure const& anException)
{

File diff suppressed because it is too large Load Diff

View File

@@ -1,658 +0,0 @@
// 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_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; }
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 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_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_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

2106
src/AIS/AIS_ViewCube.cxx Normal file

File diff suppressed because it is too large Load Diff

1060
src/AIS/AIS_ViewCube.hxx Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,153 +0,0 @@
// 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

View File

@@ -1,115 +0,0 @@
// 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

View File

@@ -56,7 +56,6 @@ AIS_DimensionSelectionMode.hxx
AIS_DisplayMode.hxx
AIS_DisplaySpecialSymbol.hxx
AIS_DisplayStatus.hxx
AIS_DragAction.hxx
AIS_EllipseRadiusDimension.cxx
AIS_EllipseRadiusDimension.hxx
AIS_EqualDistanceRelation.cxx
@@ -107,7 +106,6 @@ AIS_MaxRadiusDimension.cxx
AIS_MaxRadiusDimension.hxx
AIS_MediaPlayer.cxx
AIS_MediaPlayer.hxx
AIS_MouseGesture.hxx
AIS_MidPointRelation.cxx
AIS_MidPointRelation.hxx
AIS_MidPointRelation.lxx
@@ -116,7 +114,6 @@ AIS_MinRadiusDimension.hxx
AIS_MultipleConnectedInteractive.cxx
AIS_MultipleConnectedInteractive.hxx
AIS_MultipleConnectedInteractive.lxx
AIS_NavigationMode.hxx
AIS_NListOfEntityOwner.hxx
AIS_OffsetDimension.cxx
AIS_OffsetDimension.hxx
@@ -138,13 +135,14 @@ AIS_RadiusDimension.cxx
AIS_RadiusDimension.hxx
AIS_Relation.cxx
AIS_Relation.hxx
AIS_RotationMode.hxx
AIS_RubberBand.hxx
AIS_RubberBand.cxx
AIS_Selection.cxx
AIS_Selection.hxx
AIS_SelectStatus.hxx
AIS_SelectionModesConcurrency.hxx
AIS_SelectionScheme.hxx
AIS_SelectionType.hxx
AIS_SequenceOfDimension.hxx
AIS_SequenceOfInteractive.hxx
AIS_Shape.cxx
@@ -179,7 +177,5 @@ AIS_TypeOfAxis.hxx
AIS_TypeOfDist.hxx
AIS_TypeOfIso.hxx
AIS_TypeOfPlane.hxx
AIS_ViewController.cxx
AIS_ViewController.hxx
AIS_ViewInputBuffer.hxx
AIS_WalkDelta.hxx
AIS_ViewCube.hxx
AIS_ViewCube.cxx

452
src/Aspect/Aspect.cxx Normal file
View File

@@ -0,0 +1,452 @@
// Copyright (c) 2018 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 <Aspect.hxx>
#include <TCollection_AsciiString.hxx>
namespace
{
static Standard_CString Aspect_Table_PrintTypeOfDeflection[2] =
{
"RELATIVE", "ABSOLUTE"
};
static Standard_CString Aspect_Table_PrintTypeOfFacingModel[3] =
{
"BOTH", "BACK", "FRONT"
};
static Standard_CString Aspect_Table_PrintTypeOfHighlightMethod[2] =
{
"COLOR", "BOUNDBOX"
};
static Standard_CString Aspect_Table_PrintTypeOfLine[6] =
{
"EMPTY", "SOLID", "DASH", "DOT", "DOT_DASH", "USER_DEFINED"
};
static Standard_CString Aspect_Table_PrintTypeOfMarker[15] =
{
"EMPTY", "POINT", "PLUS", "STAR", "X", "O", "O_POINT", "O_PLUS", "O_STAR", "O_X",
"RING1", "RING2", "RING3", "BALL", "USER_DEFINED"
};
static Standard_CString Aspect_Table_PrintTypeOfDisplayText[6] =
{
"NORMAL", "SUBTITLE", "DEKALE", "BLEND", "DIMENSION", "SHADOW"
};
static Standard_CString Aspect_Table_PrintTypeOfStyleText[2] =
{
"NORMAL", "ANNOTATION"
};
static Standard_CString Aspect_Table_PrintInteriorStyle[6] =
{
"EMPTY", "HOLLOW", "HATCH", "SOLID", "HIDDEN_LINE", "POINT"
};
static Standard_CString Aspect_Table_PrintPolygonOffsetMode[7] =
{
"OFF", "FILL", "LINE", "POINT", "ALL", "NONE", "MASK"
};
static Standard_CString Aspect_Table_PrintHatchStyle[14] =
{
"SOLID", "HORIZONTAL", "HORIZONTAL_WIDE", "VERTICAL", "VERTICAL_WIDE",
"DIAGONAL_45", "DIAGONAL_45_WIDE", "DIAGONAL_135", "DIAGONAL_135_WIDE",
"GRID", "GRID_WIDE", "GRID_DIAGONAL", "GRID_DIAGONAL_WIDE", "NB"
};
static Standard_CString Aspect_Table_PrintTypeOfTriedronPosition[9] =
{
"CENTER", "TOP", "BOTTOM", "LEFT", "RIGHT", "LEFT_LOWER", "LEFT_UPPER", "RIGHT_LOWER", "RIGHT_UPPER"
};
}
//=======================================================================
//function : TypeOfDeflectionToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfDeflectionToString (Aspect_TypeOfDeflection theType)
{
return Aspect_Table_PrintTypeOfDeflection[theType];
}
//=======================================================================
//function : TypeOfDeflectionFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfDeflectionFromString (Standard_CString theTypeString,
Aspect_TypeOfDeflection& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Aspect_TOD_ABSOLUTE; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintTypeOfDeflection[aTypeIter];
if (aName == aTypeName)
{
theType = Aspect_TypeOfDeflection (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfFacingModelToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfFacingModelToString (Aspect_TypeOfFacingModel theType)
{
return Aspect_Table_PrintTypeOfFacingModel[theType];
}
//=======================================================================
//function : TypeOfFacingModelFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfFacingModelFromString (Standard_CString theTypeString,
Aspect_TypeOfFacingModel& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Aspect_TOFM_FRONT_SIDE; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintTypeOfFacingModel[aTypeIter];
if (aName == aTypeName)
{
theType = Aspect_TypeOfFacingModel (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfHighlightMethodToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfHighlightMethodToString (Aspect_TypeOfHighlightMethod theType)
{
return Aspect_Table_PrintTypeOfHighlightMethod[theType];
}
//=======================================================================
//function : TypeOfHighlightMethodFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfHighlightMethodFromString (Standard_CString theTypeString,
Aspect_TypeOfHighlightMethod& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Aspect_TOHM_BOUNDBOX; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintTypeOfHighlightMethod[aTypeIter];
if (aName == aTypeName)
{
theType = Aspect_TypeOfHighlightMethod (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfLineToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfLineToString (Aspect_TypeOfLine theType)
{
return Aspect_Table_PrintTypeOfLine[theType];
}
//=======================================================================
//function : TypeOfLineFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfLineFromString (Standard_CString theTypeString,
Aspect_TypeOfLine& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Aspect_TOL_EMPTY; aTypeIter <= Aspect_TOL_USERDEFINED; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintTypeOfLine[aTypeIter + 1];
if (aName == aTypeName)
{
theType = Aspect_TypeOfLine (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfMarkerToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfMarkerToString (Aspect_TypeOfMarker theType)
{
return Aspect_Table_PrintTypeOfMarker[theType];
}
//=======================================================================
//function : TypeOfMarkerFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfMarkerFromString (Standard_CString theTypeString,
Aspect_TypeOfMarker& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Aspect_TOM_EMPTY; aTypeIter <= Aspect_TOM_USERDEFINED; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintTypeOfMarker[aTypeIter + 1];
if (aName == aTypeName)
{
theType = Aspect_TypeOfMarker (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfDisplayTextToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfDisplayTextToString (Aspect_TypeOfDisplayText theType)
{
return Aspect_Table_PrintTypeOfDisplayText[theType];
}
//=======================================================================
//function : TypeOfDisplayTextFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfDisplayTextFromString (Standard_CString theTypeString,
Aspect_TypeOfDisplayText& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Aspect_TODT_NORMAL; aTypeIter <= Aspect_TODT_SHADOW; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintTypeOfDisplayText[aTypeIter];
if (aName == aTypeName)
{
theType = Aspect_TypeOfDisplayText (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfStyleTextToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfStyleTextToString (Aspect_TypeOfStyleText theType)
{
return Aspect_Table_PrintTypeOfStyleText[theType];
}
//=======================================================================
//function : TypeOfStyleTextFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfStyleTextFromString (Standard_CString theTypeString,
Aspect_TypeOfStyleText& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Aspect_TOST_NORMAL; aTypeIter <= Aspect_TOST_ANNOTATION; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintTypeOfStyleText[aTypeIter];
if (aName == aTypeName)
{
theType = Aspect_TypeOfStyleText (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : InteriorStyleToString
//purpose :
//=======================================================================
Standard_CString Aspect::InteriorStyleToString (Aspect_InteriorStyle theType)
{
return Aspect_Table_PrintInteriorStyle[theType];
}
//=======================================================================
//function : InteriorStyleFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::InteriorStyleFromString (Standard_CString theTypeString,
Aspect_InteriorStyle& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Aspect_IS_EMPTY; aTypeIter <= Aspect_IS_POINT; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintInteriorStyle[aTypeIter];
if (aName == aTypeName)
{
theType = Aspect_InteriorStyle (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : PolygonOffsetModeToString
//purpose :
//=======================================================================
Standard_CString Aspect::PolygonOffsetModeToString (Aspect_PolygonOffsetMode theType)
{
switch (theType)
{
case Aspect_POM_Off: return Aspect_Table_PrintPolygonOffsetMode[0];
case Aspect_POM_Fill: return Aspect_Table_PrintPolygonOffsetMode[1];
case Aspect_POM_Line: return Aspect_Table_PrintPolygonOffsetMode[2];
case Aspect_POM_Point: return Aspect_Table_PrintPolygonOffsetMode[3];
case Aspect_POM_All: return Aspect_Table_PrintPolygonOffsetMode[4];
case Aspect_POM_None: return Aspect_Table_PrintPolygonOffsetMode[5];
case Aspect_POM_Mask: return Aspect_Table_PrintPolygonOffsetMode[6];
}
return "";
}
//=======================================================================
//function : PolygonOffsetModeFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::PolygonOffsetModeFromString (Standard_CString theTypeString,
Aspect_PolygonOffsetMode& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
if (aName == Aspect_Table_PrintPolygonOffsetMode[0]) { theType = Aspect_POM_Off; return Standard_True; }
else if (aName == Aspect_Table_PrintPolygonOffsetMode[1]) { theType = Aspect_POM_Fill; return Standard_True; }
else if (aName == Aspect_Table_PrintPolygonOffsetMode[2]) { theType = Aspect_POM_Line; return Standard_True; }
else if (aName == Aspect_Table_PrintPolygonOffsetMode[3]) { theType = Aspect_POM_Point; return Standard_True; }
else if (aName == Aspect_Table_PrintPolygonOffsetMode[4]) { theType = Aspect_POM_All; return Standard_True; }
else if (aName == Aspect_Table_PrintPolygonOffsetMode[5]) { theType = Aspect_POM_None; return Standard_True; }
else if (aName == Aspect_Table_PrintPolygonOffsetMode[6]) { theType = Aspect_POM_Mask; return Standard_True; }
return Standard_False;
}
//=======================================================================
//function : HatchStyleToString
//purpose :
//=======================================================================
Standard_CString Aspect::HatchStyleToString (Aspect_HatchStyle theType)
{
return Aspect_Table_PrintHatchStyle[theType];
switch (theType)
{
case Aspect_HS_SOLID: return Aspect_Table_PrintHatchStyle[0];
case Aspect_HS_HORIZONTAL: return Aspect_Table_PrintHatchStyle[1];
case Aspect_HS_HORIZONTAL_WIDE: return Aspect_Table_PrintHatchStyle[2];
case Aspect_HS_VERTICAL: return Aspect_Table_PrintHatchStyle[3];
case Aspect_HS_VERTICAL_WIDE: return Aspect_Table_PrintHatchStyle[4];
case Aspect_HS_DIAGONAL_45: return Aspect_Table_PrintHatchStyle[5];
case Aspect_HS_DIAGONAL_45_WIDE: return Aspect_Table_PrintHatchStyle[6];
case Aspect_HS_DIAGONAL_135: return Aspect_Table_PrintHatchStyle[7];
case Aspect_HS_DIAGONAL_135_WIDE: return Aspect_Table_PrintHatchStyle[8];
case Aspect_HS_GRID: return Aspect_Table_PrintHatchStyle[9];
case Aspect_HS_GRID_WIDE: return Aspect_Table_PrintHatchStyle[10];
case Aspect_HS_GRID_DIAGONAL: return Aspect_Table_PrintHatchStyle[11];
case Aspect_HS_GRID_DIAGONAL_WIDE: return Aspect_Table_PrintHatchStyle[12];
case Aspect_HS_NB: return Aspect_Table_PrintHatchStyle[13];
}
return "";
}
//=======================================================================
//function : HatchStyleFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::HatchStyleFromString (Standard_CString theTypeString,
Aspect_HatchStyle& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
if (aName == Aspect_Table_PrintHatchStyle[0]) { theType = Aspect_HS_SOLID; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[1]) { theType = Aspect_HS_HORIZONTAL; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[2]) { theType = Aspect_HS_HORIZONTAL_WIDE; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[3]) { theType = Aspect_HS_VERTICAL; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[4]) { theType = Aspect_HS_VERTICAL_WIDE; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[5]) { theType = Aspect_HS_DIAGONAL_45; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[6]) { theType = Aspect_HS_DIAGONAL_45_WIDE; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[7]) { theType = Aspect_HS_DIAGONAL_135; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[8]) { theType = Aspect_HS_DIAGONAL_135_WIDE; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[9]) { theType = Aspect_HS_GRID; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[10]) { theType = Aspect_HS_GRID_WIDE; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[11]) { theType = Aspect_HS_GRID_DIAGONAL; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[12]) { theType = Aspect_HS_GRID_DIAGONAL_WIDE; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[13]) { theType = Aspect_HS_NB; return Standard_True; }
return Standard_False;
}
//=======================================================================
//function : TypeOfTriedronPositionToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfTriedronPositionToString (Aspect_TypeOfTriedronPosition theType)
{
return Aspect_Table_PrintTypeOfTriedronPosition[theType];
switch (theType)
{
case Aspect_TOTP_CENTER: return Aspect_Table_PrintTypeOfTriedronPosition[0];
case Aspect_TOTP_TOP: return Aspect_Table_PrintTypeOfTriedronPosition[1];
case Aspect_TOTP_BOTTOM: return Aspect_Table_PrintTypeOfTriedronPosition[2];
case Aspect_TOTP_LEFT: return Aspect_Table_PrintTypeOfTriedronPosition[3];
case Aspect_TOTP_RIGHT: return Aspect_Table_PrintTypeOfTriedronPosition[4];
case Aspect_TOTP_LEFT_LOWER: return Aspect_Table_PrintTypeOfTriedronPosition[5];
case Aspect_TOTP_LEFT_UPPER: return Aspect_Table_PrintTypeOfTriedronPosition[6];
case Aspect_TOTP_RIGHT_LOWER: return Aspect_Table_PrintTypeOfTriedronPosition[7];
case Aspect_TOTP_RIGHT_UPPER: return Aspect_Table_PrintTypeOfTriedronPosition[8];
}
return "";
}
//=======================================================================
//function : TypeOfTriedronPositionFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfTriedronPositionFromString (Standard_CString theTypeString,
Aspect_TypeOfTriedronPosition& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
if (aName == Aspect_Table_PrintTypeOfTriedronPosition[0]) { theType = Aspect_TOTP_CENTER; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[1]) { theType = Aspect_TOTP_TOP; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[2]) { theType = Aspect_TOTP_BOTTOM; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[3]) { theType = Aspect_TOTP_LEFT; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[4]) { theType = Aspect_TOTP_RIGHT; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[5]) { theType = Aspect_TOTP_LEFT_LOWER; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[6]) { theType = Aspect_TOTP_LEFT_UPPER; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[7]) { theType = Aspect_TOTP_RIGHT_LOWER; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[8]) { theType = Aspect_TOTP_RIGHT_UPPER; return Standard_True; }
return Standard_False;
}

284
src/Aspect/Aspect.hxx Normal file
View File

@@ -0,0 +1,284 @@
// Copyright (c) 2018 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 _Aspect_HeaderFile
#define _Aspect_HeaderFile
#include <Aspect_HatchStyle.hxx>
#include <Aspect_InteriorStyle.hxx>
#include <Aspect_PolygonOffsetMode.hxx>
#include <Aspect_TypeOfDeflection.hxx>
#include <Aspect_TypeOfDisplayText.hxx>
#include <Aspect_TypeOfFacingModel.hxx>
#include <Aspect_TypeOfHighlightMethod.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Aspect_TypeOfMarker.hxx>
#include <Aspect_TypeOfStyleText.hxx>
#include <Aspect_TypeOfTriedronPosition.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Type.hxx>
//! Provides methods to cast enumerations of package to string value
class Aspect
{
public:
DEFINE_STANDARD_ALLOC
//! Returns the string name for a given type.
//! @param theType an enumeration type
//! @return string identifier from the enumeration list
Standard_EXPORT static Standard_CString TypeOfDeflectionToString (Aspect_TypeOfDeflection theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TOFM_BOTH_SIDE if string identifier is invalid
static Aspect_TypeOfDeflection TypeOfDeflectionFromString (Standard_CString theTypeString)
{
Aspect_TypeOfDeflection aType = Aspect_TOD_RELATIVE;
TypeOfDeflectionFromString (theTypeString, aType);
return aType;
}
//! Determines the type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean TypeOfDeflectionFromString (const Standard_CString theTypeString,
Aspect_TypeOfDeflection& theType);
//! Returns the string name for a given type.
//! @param theType an enumeration type
//! @return string identifier from the enumeration list
Standard_EXPORT static Standard_CString TypeOfFacingModelToString (Aspect_TypeOfFacingModel theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TOFM_BOTH_SIDE if string identifier is invalid
static Aspect_TypeOfFacingModel TypeOfFacingModelFromString (Standard_CString theTypeString)
{
Aspect_TypeOfFacingModel aType = Aspect_TOFM_BOTH_SIDE;
TypeOfFacingModelFromString (theTypeString, aType);
return aType;
}
//! Determines the type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean TypeOfFacingModelFromString (const Standard_CString theTypeString,
Aspect_TypeOfFacingModel& theType);
//! Returns the string name for a given type.
//! @param theType an enumeration type
//! @return string identifier from the enumeration list
Standard_EXPORT static Standard_CString TypeOfHighlightMethodToString (Aspect_TypeOfHighlightMethod theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TOHM_COLOR if string identifier is invalid
static Aspect_TypeOfHighlightMethod TypeOfHighlightMethodFromString (Standard_CString theTypeString)
{
Aspect_TypeOfHighlightMethod aType = Aspect_TOHM_COLOR;
TypeOfHighlightMethodFromString (theTypeString, aType);
return aType;
}
//! Determines the type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean TypeOfHighlightMethodFromString (const Standard_CString theTypeString,
Aspect_TypeOfHighlightMethod& theType);
//! Returns the string name for a given type.
//! @param theType an enumeration type
//! @return string identifier from the enumeration list
Standard_EXPORT static Standard_CString TypeOfLineToString (Aspect_TypeOfLine theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TOL_EMPTY if string identifier is invalid
static Aspect_TypeOfLine TypeOfLineFromString (Standard_CString theTypeString)
{
Aspect_TypeOfLine aType = Aspect_TOL_EMPTY;
TypeOfLineFromString (theTypeString, aType);
return aType;
}
//! Determines the type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean TypeOfLineFromString (const Standard_CString theTypeString,
Aspect_TypeOfLine& theType);
//! Returns the string name for a given type.
//! @param theType an enumeration type
//! @return string identifier from the enumeration list
Standard_EXPORT static Standard_CString TypeOfMarkerToString (Aspect_TypeOfMarker theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TOM_EMPTY if string identifier is invalid
static Aspect_TypeOfMarker TypeOfMarkerFromString (Standard_CString theTypeString)
{
Aspect_TypeOfMarker aType = Aspect_TOM_EMPTY;
TypeOfMarkerFromString (theTypeString, aType);
return aType;
}
//! Determines the type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean TypeOfMarkerFromString (const Standard_CString theTypeString,
Aspect_TypeOfMarker& theType);
//! Returns the string name for a given type.
//! @param theType an enumeration type
//! @return string identifier from the enumeration list
Standard_EXPORT static Standard_CString TypeOfDisplayTextToString (Aspect_TypeOfDisplayText theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TODT_NORMAL if string identifier is invalid
static Aspect_TypeOfDisplayText TypeOfDisplayTextFromString (Standard_CString theTypeString)
{
Aspect_TypeOfDisplayText aType = Aspect_TODT_NORMAL;
TypeOfDisplayTextFromString (theTypeString, aType);
return aType;
}
//! Determines the type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean TypeOfDisplayTextFromString (const Standard_CString theTypeString,
Aspect_TypeOfDisplayText& theType);
//! Returns the string name for a given type.
//! @param theType an enumeration type
//! @return string identifier from the enumeration list
Standard_EXPORT static Standard_CString TypeOfStyleTextToString (Aspect_TypeOfStyleText theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TODT_NORMAL if string identifier is invalid
static Aspect_TypeOfStyleText TypeOfStyleTextFromString (Standard_CString theTypeString)
{
Aspect_TypeOfStyleText aType = Aspect_TOST_NORMAL;
TypeOfStyleTextFromString (theTypeString, aType);
return aType;
}
//! Determines the type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean TypeOfStyleTextFromString (const Standard_CString theTypeString,
Aspect_TypeOfStyleText& theType);
//! Returns the string name for a given type.
//! @param theType an enumeration type
//! @return string identifier from the enumeration list
Standard_EXPORT static Standard_CString InteriorStyleToString (Aspect_InteriorStyle theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_IS_EMPTY if string identifier is invalid
static Aspect_InteriorStyle InteriorStyleFromString (Standard_CString theTypeString)
{
Aspect_InteriorStyle aType = Aspect_IS_EMPTY;
InteriorStyleFromString (theTypeString, aType);
return aType;
}
//! Determines the type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean InteriorStyleFromString (const Standard_CString theTypeString,
Aspect_InteriorStyle& theType);
//! Returns the string name for a given type.
//! @param theType an enumeration type
//! @return string identifier from the enumeration list
Standard_EXPORT static Standard_CString PolygonOffsetModeToString (Aspect_PolygonOffsetMode theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_POM_Off if string identifier is invalid
static Aspect_PolygonOffsetMode PolygonOffsetModeFromString (Standard_CString theTypeString)
{
Aspect_PolygonOffsetMode aType = Aspect_POM_Off;
PolygonOffsetModeFromString (theTypeString, aType);
return aType;
}
//! Determines the type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean PolygonOffsetModeFromString (const Standard_CString theTypeString,
Aspect_PolygonOffsetMode& theType);
//! Returns the string name for a given type.
//! @param theType an enumeration type
//! @return string identifier from the enumeration list
Standard_EXPORT static Standard_CString HatchStyleToString (Aspect_HatchStyle theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_POM_Off if string identifier is invalid
static Aspect_HatchStyle HatchStyleFromString (Standard_CString theTypeString)
{
Aspect_HatchStyle aType = Aspect_HS_SOLID;
HatchStyleFromString (theTypeString, aType);
return aType;
}
//! Determines the type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean HatchStyleFromString (const Standard_CString theTypeString,
Aspect_HatchStyle& theType);
//! Returns the string name for a given type.
//! @param theType an enumeration type
//! @return string identifier from the enumeration list
Standard_EXPORT static Standard_CString TypeOfTriedronPositionToString (Aspect_TypeOfTriedronPosition theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TOTP_CENTER if string identifier is invalid
static Aspect_TypeOfTriedronPosition TypeOfTriedronPositionFromString (Standard_CString theTypeString)
{
Aspect_TypeOfTriedronPosition aType = Aspect_TOTP_CENTER;
TypeOfTriedronPositionFromString (theTypeString, aType);
return aType;
}
//! Determines the type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean TypeOfTriedronPositionFromString (const Standard_CString theTypeString,
Aspect_TypeOfTriedronPosition& theType);
};
#endif // _Aspect_HeaderFile

View File

@@ -1,59 +0,0 @@
// 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 _Aspect_ScrollDelta_HeaderFile
#define _Aspect_ScrollDelta_HeaderFile
#include <Aspect_VKeyFlags.hxx>
#include <NCollection_Vec2.hxx>
#include <Standard_Real.hxx>
//! Parameters for mouse scroll action.
struct Aspect_ScrollDelta
{
NCollection_Vec2<int> Point; //!< scale position
Standard_Real Delta; //!< delta in pixels
Aspect_VKeyFlags Flags; //!< key flags
//! Return true if action has point defined.
bool HasPoint() const
{
return Point.x() >= 0
&& Point.y() >= 0;
}
//! Reset at point.
void ResetPoint()
{
Point.SetValues (-1, -1);
}
//! Empty constructor.
Aspect_ScrollDelta()
: Point (-1, -1), Delta (0.0), Flags (Aspect_VKeyFlags_NONE) {}
//! Constructor.
Aspect_ScrollDelta (const NCollection_Vec2<int>& thePnt,
Standard_Real theValue,
Aspect_VKeyFlags theFlags = Aspect_VKeyFlags_NONE)
: Point (thePnt), Delta (theValue), Flags (theFlags) {}
//! Constructor with undefined point.
Aspect_ScrollDelta (Standard_Real theValue,
Aspect_VKeyFlags theFlags = Aspect_VKeyFlags_NONE)
: Point (-1, -1), Delta (theValue), Flags (theFlags) {}
};
#endif // _Aspect_ScrollDelta_HeaderFile

View File

@@ -1,49 +0,0 @@
// 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 _Aspect_Touch_HeaderFile
#define _Aspect_Touch_HeaderFile
#include <NCollection_Vec2.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
//! Structure holding touch position - original and current location.
class Aspect_Touch
{
public:
NCollection_Vec2<Standard_Real> From; //!< original touch position
NCollection_Vec2<Standard_Real> To; //!< current touch position
Standard_Boolean IsPreciseDevice; //!< precise device input (e.g. mouse cursor, NOT emulated from touch screen)
//! Return values delta.
NCollection_Vec2<Standard_Real> Delta() const { return To - From; }
//! Empty constructor
Aspect_Touch()
: From (0.0, 0.0), To (0.0, 0.0), IsPreciseDevice (false) {}
//! Constructor with initialization.
Aspect_Touch (const NCollection_Vec2<Standard_Real>& thePnt,
Standard_Boolean theIsPreciseDevice)
: From (thePnt), To (thePnt), IsPreciseDevice (theIsPreciseDevice) {}
//! Constructor with initialization.
Aspect_Touch (Standard_Real theX, Standard_Real theY,
Standard_Boolean theIsPreciseDevice)
: From (theX, theY), To (theX, theY), IsPreciseDevice (theIsPreciseDevice) {}
};
#endif // _Aspect_Touch_HeaderFile

View File

@@ -1,199 +0,0 @@
// 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 _Aspect_VKey_HeaderFile
#define _Aspect_VKey_HeaderFile
#include <Aspect_VKeyFlags.hxx>
//! Define virtual key as integer number to allow extensions.
typedef unsigned int Aspect_VKey;
//! Enumeration defining virtual keys irrelevant to current keyboard layout for simplified hot-keys management logic.
enum Aspect_VKeyBasic
{
Aspect_VKey_UNKNOWN = 0,
// main latin alphabet keys
Aspect_VKey_A = 1,
Aspect_VKey_B,
Aspect_VKey_C,
Aspect_VKey_D,
Aspect_VKey_E,
Aspect_VKey_F,
Aspect_VKey_G,
Aspect_VKey_H,
Aspect_VKey_I,
Aspect_VKey_J,
Aspect_VKey_K,
Aspect_VKey_L,
Aspect_VKey_M,
Aspect_VKey_N,
Aspect_VKey_O,
Aspect_VKey_P,
Aspect_VKey_Q,
Aspect_VKey_R,
Aspect_VKey_S,
Aspect_VKey_T,
Aspect_VKey_U,
Aspect_VKey_V,
Aspect_VKey_W,
Aspect_VKey_X,
Aspect_VKey_Y,
Aspect_VKey_Z,
Aspect_VKey_0,
Aspect_VKey_1,
Aspect_VKey_2,
Aspect_VKey_3,
Aspect_VKey_4,
Aspect_VKey_5,
Aspect_VKey_6,
Aspect_VKey_7,
Aspect_VKey_8,
Aspect_VKey_9,
Aspect_VKey_F1,
Aspect_VKey_F2,
Aspect_VKey_F3,
Aspect_VKey_F4,
Aspect_VKey_F5,
Aspect_VKey_F6,
Aspect_VKey_F7,
Aspect_VKey_F8,
Aspect_VKey_F9,
Aspect_VKey_F10,
Aspect_VKey_F11,
Aspect_VKey_F12,
// standard keys
Aspect_VKey_Up,
Aspect_VKey_Down,
Aspect_VKey_Left,
Aspect_VKey_Right,
Aspect_VKey_Plus, //!< '+'
Aspect_VKey_Minus, //!< '-'
Aspect_VKey_Equal, //!< '=+'
Aspect_VKey_PageUp,
Aspect_VKey_PageDown,
Aspect_VKey_Home,
Aspect_VKey_End,
Aspect_VKey_Escape,
Aspect_VKey_Back,
Aspect_VKey_Enter,
Aspect_VKey_Backspace,
Aspect_VKey_Space,
Aspect_VKey_Delete,
Aspect_VKey_Tilde,
Aspect_VKey_Tab,
Aspect_VKey_Comma, //!< ','
Aspect_VKey_Period, //!< '.'
Aspect_VKey_Semicolon, //!< ';:'
Aspect_VKey_Slash, //!< '/?'
Aspect_VKey_BracketLeft, //!< '[{'
Aspect_VKey_Backslash, //!< '\|'
Aspect_VKey_BracketRight, //!< ']}'
Aspect_VKey_Apostrophe, //!< ''"'
Aspect_VKey_Numlock, //!< Num Lock key
Aspect_VKey_Scroll, //!< Scroll Lock key
// numpad keys
Aspect_VKey_Numpad0,
Aspect_VKey_Numpad1,
Aspect_VKey_Numpad2,
Aspect_VKey_Numpad3,
Aspect_VKey_Numpad4,
Aspect_VKey_Numpad5,
Aspect_VKey_Numpad6,
Aspect_VKey_Numpad7,
Aspect_VKey_Numpad8,
Aspect_VKey_Numpad9,
Aspect_VKey_NumpadMultiply, //!< numpad '*'
Aspect_VKey_NumpadAdd, //!< numpad '+'
Aspect_VKey_NumpadSubtract, //!< numpad '-'
Aspect_VKey_NumpadDivide, //!< numpad '/'
// Multimedia keys
Aspect_VKey_MediaNextTrack,
Aspect_VKey_MediaPreviousTrack,
Aspect_VKey_MediaStop,
Aspect_VKey_MediaPlayPause,
Aspect_VKey_VolumeMute,
Aspect_VKey_VolumeDown,
Aspect_VKey_VolumeUp,
Aspect_VKey_BrowserBack,
Aspect_VKey_BrowserForward,
Aspect_VKey_BrowserRefresh,
Aspect_VKey_BrowserStop,
Aspect_VKey_BrowserSearch,
Aspect_VKey_BrowserFavorites,
Aspect_VKey_BrowserHome,
// modifier keys, @sa Aspect_VKey_ModifiersLower and Aspect_VKey_ModifiersUpper below
Aspect_VKey_Shift,
Aspect_VKey_Control,
Aspect_VKey_Alt,
Aspect_VKey_Menu,
Aspect_VKey_Meta,
// virtual navigation keys, @sa Aspect_VKey_NavigationKeysLower and Aspect_VKey_NavigationKeysUpper below
Aspect_VKey_NavInteract, //!< interact
Aspect_VKey_NavForward, //!< go forward
Aspect_VKey_NavBackward, //!< go backward
Aspect_VKey_NavSlideLeft, //!< sidewalk, left
Aspect_VKey_NavSlideRight, //!< sidewalk, right
Aspect_VKey_NavSlideUp, //!< lift up
Aspect_VKey_NavSlideDown, //!< fall down
Aspect_VKey_NavRollCCW, //!< bank left (roll counter-clockwise)
Aspect_VKey_NavRollCW, //!< bank right (roll clockwise)
Aspect_VKey_NavLookLeft, //!< look left (yaw counter-clockwise)
Aspect_VKey_NavLookRight, //!< look right (yaw clockwise)
Aspect_VKey_NavLookUp, //!< look up (pitch clockwise)
Aspect_VKey_NavLookDown, //!< look down (pitch counter-clockwise)
Aspect_VKey_NavCrouch, //!< crouch walking
Aspect_VKey_NavJump, //!< jump
Aspect_VKey_NavThrustForward, //!< increase continuous velocity in forward direction
Aspect_VKey_NavThrustBackward, //!< increase continuous velocity in reversed direction
Aspect_VKey_NavThrustStop, //!< reset continuous velocity
Aspect_VKey_NavSpeedIncrease, //!< increase navigation speed
Aspect_VKey_NavSpeedDecrease, //!< decrease navigation speed
};
//! Auxiliary ranges.
enum
{
Aspect_VKey_Lower = 0,
Aspect_VKey_ModifiersLower = Aspect_VKey_Shift,
Aspect_VKey_ModifiersUpper = Aspect_VKey_Meta,
Aspect_VKey_NavigationKeysLower = Aspect_VKey_NavInteract,
Aspect_VKey_NavigationKeysUpper = Aspect_VKey_NavSpeedDecrease,
Aspect_VKey_Upper = Aspect_VKey_NavSpeedDecrease,
Aspect_VKey_NB = Aspect_VKey_Upper - Aspect_VKey_Lower + 1,
Aspect_VKey_MAX = 255
};
//! Return modifier flags for specified modifier key.
inline Aspect_VKeyFlags Aspect_VKey2Modifier (Aspect_VKey theKey)
{
switch (theKey)
{
case Aspect_VKey_Shift: return Aspect_VKeyFlags_SHIFT;
case Aspect_VKey_Control: return Aspect_VKeyFlags_CTRL;
case Aspect_VKey_Alt: return Aspect_VKeyFlags_ALT;
case Aspect_VKey_Menu: return Aspect_VKeyFlags_MENU;
case Aspect_VKey_Meta: return Aspect_VKeyFlags_META;
default: return 0;
}
}
#endif // _Aspect_VKey_HeaderFile

View File

@@ -1,49 +0,0 @@
// 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 _Aspect_VKeyFlags_HeaderFile
#define _Aspect_VKeyFlags_HeaderFile
//! Key modifier, for combining with general key from Aspect_VKey.
typedef unsigned int Aspect_VKeyFlags;
//! Key modifier, for combining with general key from Aspect_VKey.
enum
{
Aspect_VKeyFlags_NONE = 0,
// reserve first 8 bits to combine value with Aspect_VKey
Aspect_VKeyFlags_SHIFT = 1 << 8, //!< Aspect_VKey_Shift
Aspect_VKeyFlags_CTRL = 1 << 9, //!< Aspect_VKey_Control
Aspect_VKeyFlags_ALT = 1 << 10, //!< Aspect_VKey_Alt
Aspect_VKeyFlags_MENU = 1 << 11, //!< Aspect_VKey_Menu
Aspect_VKeyFlags_META = 1 << 12, //!< Aspect_VKey_Meta
Aspect_VKeyFlags_ALL = Aspect_VKeyFlags_SHIFT | Aspect_VKeyFlags_CTRL | Aspect_VKeyFlags_ALT | Aspect_VKeyFlags_MENU | Aspect_VKeyFlags_META
};
//! Mouse buttons, for combining with Aspect_VKey and Aspect_VKeyFlags.
typedef unsigned int Aspect_VKeyMouse;
//! Mouse button bitmask
enum
{
Aspect_VKeyMouse_NONE = 0, //!< no buttons
Aspect_VKeyMouse_LeftButton = 1 << 13, //!< mouse left button
Aspect_VKeyMouse_MiddleButton = 1 << 14, //!< mouse middle button (scroll)
Aspect_VKeyMouse_RightButton = 1 << 15, //!< mouse right button
Aspect_VKeyMouse_MainButtons = Aspect_VKeyMouse_LeftButton | Aspect_VKeyMouse_MiddleButton | Aspect_VKeyMouse_RightButton
};
#endif // _Aspect_VKeyFlags_HeaderFile

View File

@@ -1,150 +0,0 @@
// 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.
#include "Aspect_VKeySet.hxx"
IMPLEMENT_STANDARD_RTTIEXT(Aspect_VKeySet, Standard_Transient)
// ================================================================
// Function : As1pect_VKeySet
// Purpose :
// ================================================================
Aspect_VKeySet::Aspect_VKeySet()
: myKeys (0, Aspect_VKey_MAX),
myModifiers (Aspect_VKeyFlags_NONE)
{
//
}
// ================================================================
// Function : Reset
// Purpose :
// ================================================================
void Aspect_VKeySet::Reset()
{
Standard_Mutex::Sentry aLock (myLock);
myModifiers = 0;
for (NCollection_Array1<KeyState>::Iterator aKeyIter (myKeys); aKeyIter.More(); aKeyIter.Next())
{
aKeyIter.ChangeValue().Reset();
}
}
// ================================================================
// Function : KeyDown
// Purpose :
// ================================================================
void Aspect_VKeySet::KeyDown (Aspect_VKey theKey,
double theTime,
double thePressure)
{
Standard_Mutex::Sentry aLock (myLock);
if (myKeys[theKey].Status != KeyStatus_Pressed)
{
myKeys[theKey].Status = KeyStatus_Pressed;
myKeys[theKey].TimeDown = theTime;
}
myKeys[theKey].Pressure = thePressure;
const unsigned int aModif = Aspect_VKey2Modifier (theKey);
myModifiers = myModifiers | aModif;
}
// ================================================================
// Function : KeyUp
// Purpose :
// ================================================================
void Aspect_VKeySet::KeyUp (Aspect_VKey theKey,
double theTime)
{
Standard_Mutex::Sentry aLock (myLock);
if (myKeys[theKey].Status == KeyStatus_Pressed)
{
myKeys[theKey].Status = KeyStatus_Released;
myKeys[theKey].TimeUp = theTime;
}
const unsigned int aModif = Aspect_VKey2Modifier (theKey);
if (aModif != 0)
{
myModifiers = myModifiers & ~aModif;
}
}
// ================================================================
// Function : KeyFromAxis
// Purpose :
// ================================================================
void Aspect_VKeySet::KeyFromAxis (Aspect_VKey theNegative,
Aspect_VKey thePositive,
double theTime,
double thePressure)
{
Standard_Mutex::Sentry aLock (myLock);
if (thePressure != 0)
{
const Aspect_VKey aKeyDown = thePressure > 0 ? thePositive : theNegative;
const Aspect_VKey aKeyUp = thePressure < 0 ? thePositive : theNegative;
KeyDown (aKeyDown, theTime, Abs (thePressure));
if (myKeys[aKeyUp].Status == KeyStatus_Pressed)
{
KeyUp (aKeyUp, theTime);
}
}
else
{
if (myKeys[theNegative].Status == KeyStatus_Pressed)
{
KeyUp (theNegative, theTime);
}
if (myKeys[thePositive].Status == KeyStatus_Pressed)
{
KeyUp (thePositive, theTime);
}
}
}
// ================================================================
// Function : HoldDuration
// Purpose :
// ================================================================
bool Aspect_VKeySet::HoldDuration (Aspect_VKey theKey,
double theTime,
double& theDuration,
double& thePressure)
{
Standard_Mutex::Sentry aLock (myLock);
switch (myKeys[theKey].Status)
{
case KeyStatus_Free:
{
theDuration = 0.0;
return false;
}
case KeyStatus_Released:
{
myKeys[theKey].Status = KeyStatus_Free;
theDuration = myKeys[theKey].TimeUp - myKeys[theKey].TimeDown;
thePressure = myKeys[theKey].Pressure;
return true;
}
case KeyStatus_Pressed:
{
theDuration = theTime - myKeys[theKey].TimeDown;
thePressure = myKeys[theKey].Pressure;
return true;
}
}
return false;
}

View File

@@ -1,152 +0,0 @@
// 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 _Aspect_VKeySet_HeaderFile
#define _Aspect_VKeySet_HeaderFile
#include <Aspect_VKey.hxx>
#include <NCollection_Array1.hxx>
#include <OSD_Timer.hxx>
#include <Standard_Mutex.hxx>
#include <Standard_Transient.hxx>
//! Structure defining key state.
class Aspect_VKeySet : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Aspect_VKeySet, Standard_Transient)
public:
//! Main constructor.
Standard_EXPORT Aspect_VKeySet();
//! Return active modifiers.
Aspect_VKeyFlags Modifiers() const
{
Standard_Mutex::Sentry aLock (myLock);
return myModifiers;
}
//! Return timestamp of press event.
double DownTime (Aspect_VKey theKey) const
{
Standard_Mutex::Sentry aLock (myLock);
return myKeys[theKey].TimeDown;
}
//! Return timestamp of release event.
double TimeUp (Aspect_VKey theKey) const
{
Standard_Mutex::Sentry aLock (myLock);
return myKeys[theKey].TimeUp;
}
//! Return TRUE if key is in Free state.
bool IsFreeKey (Aspect_VKey theKey) const
{
Standard_Mutex::Sentry aLock (myLock);
return myKeys[theKey].Status == KeyStatus_Free;
}
//! Return TRUE if key is in Pressed state.
bool IsKeyDown (Aspect_VKey theKey) const
{
Standard_Mutex::Sentry aLock (myLock);
return myKeys[theKey].Status == KeyStatus_Pressed;
}
public:
//! Reset the key state into unpressed state.
Standard_EXPORT void Reset();
//! Press key.
//! @param theKey key pressed
//! @param theTime event timestamp
Standard_EXPORT void KeyDown (Aspect_VKey theKey,
double theTime,
double thePressure = 1.0);
//! Release key.
//! @param theKey key pressed
//! @param theTime event timestamp
Standard_EXPORT void KeyUp (Aspect_VKey theKey,
double theTime);
//! Simulate key up/down events from axis value.
Standard_EXPORT void KeyFromAxis (Aspect_VKey theNegative,
Aspect_VKey thePositive,
double theTime,
double thePressure);
//! Return duration of the button in pressed state.
//! @param theKey key to check
//! @param theTime current time (for computing duration from key down time)
//! @param theDuration key press duration
//! @return TRUE if key was in pressed state
bool HoldDuration (Aspect_VKey theKey,
double theTime,
double& theDuration)
{
double aPressure = -1.0;
return HoldDuration (theKey, theTime, theDuration, aPressure);
}
//! Return duration of the button in pressed state.
//! @param theKey key to check
//! @param theTime current time (for computing duration from key down time)
//! @param theDuration key press duration
//! @param thePressure key pressure
//! @return TRUE if key was in pressed state
Standard_EXPORT bool HoldDuration (Aspect_VKey theKey,
double theTime,
double& theDuration,
double& thePressure);
private:
//! Key state.
enum KeyStatus
{
KeyStatus_Free, //!< free status
KeyStatus_Pressed, //!< key is in pressed state
KeyStatus_Released, //!< key has been just released (transient state before KeyStatus_Free)
};
//! Structure defining key state.
struct KeyState
{
KeyState() : TimeDown (0.0), TimeUp (0.0), Pressure (1.0), Status (KeyStatus_Free) {}
void Reset()
{
Status = KeyStatus_Free;
TimeDown = 0.0;
TimeUp = 0.0;
Pressure = 1.0;
}
double TimeDown; //!< time of key press event
double TimeUp; //!< time of key release event
double Pressure; //!< key pressure
KeyStatus Status; //!< key status
};
private:
NCollection_Array1<KeyState> myKeys; //!< keys state
mutable Standard_Mutex myLock; //!< mutex for thread-safe updates
Aspect_VKeyFlags myModifiers; //!< active modifiers
};
#endif // _Aspect_VKeySet_HeaderFile

View File

@@ -16,21 +16,28 @@
#ifndef _Aspect_Window_HeaderFile
#define _Aspect_Window_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Aspect_Background.hxx>
#include <Aspect_GradientBackground.hxx>
#include <Aspect_FBConfig.hxx>
#include <Aspect_FillMethod.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Transient.hxx>
#include <Quantity_Color.hxx>
#include <Aspect_GradientFillMethod.hxx>
#include <Aspect_TypeOfResize.hxx>
#include <Standard_Integer.hxx>
#include <Aspect_Drawable.hxx>
#include <Standard.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
class Aspect_DisplayConnection;
class Aspect_WindowDefinitionError;
class Aspect_WindowError;
class Aspect_Background;
class Aspect_GradientBackground;
class Aspect_Window;
DEFINE_STANDARD_HANDLE(Aspect_Window, Standard_Transient)
//! Defines a window.
@@ -102,9 +109,6 @@ public:
//! Returns native Window FB config (GLXFBConfig on Xlib)
Standard_EXPORT virtual Aspect_FBConfig NativeFBConfig() const = 0;
//! Sets window title.
virtual void SetTitle (const TCollection_AsciiString& theTitle) { (void )theTitle; }
//! Invalidate entire window content.
//!
//! Implementation is expected to allow calling this method from non-GUI thread,

View File

@@ -1,3 +1,5 @@
Aspect.cxx
Aspect.hxx
Aspect_AspectFillAreaDefinitionError.hxx
Aspect_AspectLineDefinitionError.hxx
Aspect_AspectMarkerDefinitionError.hxx
@@ -34,9 +36,6 @@ Aspect_RectangularGrid.cxx
Aspect_RectangularGrid.hxx
Aspect_RenderingContext.hxx
Aspect_SequenceOfColor.hxx
Aspect_ScrollDelta.hxx
Aspect_Touch.hxx
Aspect_TouchMap.hxx
Aspect_TypeOfColorScaleData.hxx
Aspect_TypeOfColorScaleOrientation.hxx
Aspect_TypeOfColorScalePosition.hxx
@@ -50,10 +49,6 @@ Aspect_TypeOfResize.hxx
Aspect_TypeOfStyleText.hxx
Aspect_TypeOfTriedronPosition.hxx
Aspect_Units.hxx
Aspect_VKey.hxx
Aspect_VKeyFlags.hxx
Aspect_VKeySet.cxx
Aspect_VKeySet.hxx
Aspect_WidthOfLine.hxx
Aspect_Window.cxx
Aspect_Window.hxx

View File

@@ -93,8 +93,9 @@ public:
//! be ignored at all.
//! If theIsShapeToleranceUsed == TRUE then resulting box will be
//! extended on the tolerance of the shape.
//! theIsOptimal flag defines whether to look for the more tight
//! OBB for the cost of performance or not.
//! theIsOptimal flag defines the algorithm for construction of initial
//! Bnd_Box for the second method (if theIsOptimal == TRUE then
//! this box will be created by AddOptimal(...) method).
Standard_EXPORT static
void AddOBB(const TopoDS_Shape& theS,
Bnd_OBB& theOBB,

View File

@@ -293,7 +293,6 @@ static Standard_Integer IsWCS(const gp_Dir& theDir)
//=======================================================================
static Standard_Boolean CheckPoints(const TopoDS_Shape& theS,
const Standard_Boolean theIsTriangulationUsed,
const Standard_Boolean theIsOptimal,
const Standard_Boolean theIsShapeToleranceUsed,
Bnd_OBB& theOBB)
{
@@ -330,7 +329,7 @@ static Standard_Boolean CheckPoints(const TopoDS_Shape& theS,
}
#endif
theOBB.ReBuild(anArrPnts, aPtrArrTol, theIsOptimal);
theOBB.ReBuild(anArrPnts, aPtrArrTol);
return (!theOBB.IsVoid());
}
@@ -499,7 +498,7 @@ void BRepBndLib::AddOBB(const TopoDS_Shape& theS,
const Standard_Boolean theIsOptimal,
const Standard_Boolean theIsShapeToleranceUsed)
{
if (CheckPoints(theS, theIsTriangulationUsed, theIsOptimal, theIsShapeToleranceUsed, theOBB))
if(CheckPoints(theS, theIsTriangulationUsed, theIsShapeToleranceUsed, theOBB))
return;
ComputePCA(theS, theOBB, theIsTriangulationUsed, theIsOptimal, theIsShapeToleranceUsed);

View File

@@ -1437,13 +1437,16 @@ Standard_Boolean CheckAndOrientEdges(const TopTools_ListOfShape& theOrderedList
gp_Pnt2d ap = aCurve->Value(f);
Standard_Boolean bFirstFound = Standard_False;
Standard_Boolean bLastFound = Standard_False;
Standard_Boolean bforward = Standard_True;
if(ap.Distance(theFirstPoint) < aTolerance1) {
bforward = Standard_True;
if(theOrientedList.IsEmpty())
theOrientedList.Append(aEPrev.Oriented(TopAbs_FORWARD));
bFirstFound = Standard_True;
}
else if(ap.Distance(theLastPoint) < aTolerance1) {
bforward = Standard_False;
if(theOrientedList.IsEmpty())
theOrientedList.Append(aEPrev.Oriented(TopAbs_REVERSED));
bLastFound = Standard_True;
@@ -1451,31 +1454,36 @@ Standard_Boolean CheckAndOrientEdges(const TopTools_ListOfShape& theOrderedList
ap = aCurve->Value(l);
if(ap.Distance(theLastPoint) < aTolerance2) {
bforward = Standard_True;
if(theOrientedList.IsEmpty())
theOrientedList.Append(aEPrev.Oriented(TopAbs_FORWARD));
bLastFound = Standard_True;
}
else if(ap.Distance(theFirstPoint) < aTolerance2) {
bforward = Standard_False;
if(theOrientedList.IsEmpty())
theOrientedList.Append(aEPrev.Oriented(TopAbs_REVERSED));
bFirstFound = Standard_True;
}
if (!theOrientedList.IsEmpty())
aEPrev = TopoDS::Edge (theOrientedList.Last());
for(; anIt.More(); anIt.Next()) {
const TopoDS_Edge& aE = TopoDS::Edge(anIt.Value());
TopoDS_Vertex aV11, aV12;
TopExp::Vertices(aEPrev, aV11, aV12, Standard_True);
TopExp::Vertices(aEPrev, aV11, aV12);
TopoDS_Vertex aV21, aV22;
TopExp::Vertices(aE, aV21, aV22, Standard_False);
TopExp::Vertices(aE, aV21, aV22);
TopAbs_Orientation anOri = TopAbs_FORWARD;
TopAbs_Orientation anOri =
(aV12.IsSame (aV21) || aV11.IsSame (aV22)) ? TopAbs_FORWARD : TopAbs_REVERSED;
if(aV12.IsSame(aV21) || aV11.IsSame(aV22)) {
anOri = (bforward) ? TopAbs_FORWARD : TopAbs_REVERSED;
}
else {
anOri = (bforward) ? TopAbs_REVERSED : TopAbs_FORWARD;
}
theOrientedList.Append(aE.Oriented(anOri));
aEPrev = TopoDS::Edge (theOrientedList.Last());
aEPrev = aE;
aTolerance1 = (aV21.IsNull()) ? Precision::Confusion() : BRep_Tool::Tolerance(aV21);
aTolerance2 = (aV22.IsNull()) ? Precision::Confusion() : BRep_Tool::Tolerance(aV22);
utol = aBAS.UResolution(aTolerance1);
@@ -1503,7 +1511,9 @@ Standard_Boolean CheckAndOrientEdges(const TopTools_ListOfShape& theOrderedList
}
}
return bFirstFound && bLastFound;
if(!bFirstFound || !bLastFound)
return Standard_False;
return Standard_True;
}
// ----------------------------------------------------------------------------------------------------

View File

@@ -55,8 +55,6 @@ static Standard_Boolean findNearestValidPoint(
//
// the general step is computed using general curve resolution
Standard_Real aStep = theCurve.Resolution(theTol) * 1.01;
if (aStep < theEps)
aStep = theEps;
// aD1Mag is a threshold to consider local derivative magnitude too small
// and to accelerate going out of sphere
// (inverse of resolution is the maximal derivative);
@@ -161,19 +159,11 @@ Standard_Boolean BRepLib::FindValidRange
if (theParV2 - theParV1 < Precision::PConfusion())
return Standard_False;
Standard_Boolean isInfParV1 = Precision::IsInfinite (theParV1),
isInfParV2 = Precision::IsInfinite (theParV2);
Standard_Real anEps = Max(Max(theCurve.Resolution(theTolE) * 0.1,
Epsilon(Max(Abs(theParV1), Abs(theParV2)))),
Precision::PConfusion());
Standard_Real aMaxPar = 0.0;
if (!isInfParV1)
aMaxPar = Abs (theParV1);
if (!isInfParV2)
aMaxPar = Max (aMaxPar, Abs (theParV2));
Standard_Real anEps = Max (Max (theCurve.Resolution (theTolE) * 0.1, Epsilon (aMaxPar)),
Precision::PConfusion());
if (isInfParV1)
if (Precision::IsInfinite(theParV1))
theFirst = theParV1;
else
{
@@ -184,7 +174,7 @@ Standard_Boolean BRepLib::FindValidRange
return Standard_False;
}
if (isInfParV2)
if (Precision::IsInfinite(theParV2))
theLast = theParV2;
else
{

View File

@@ -65,7 +65,7 @@ void BRepMesh_BaseMeshAlgo::Perform(
commitSurfaceTriangulation();
}
}
catch (Standard_Failure const& /*theExeption*/)
catch (Standard_Failure& /*theExeption*/)
{
}

View File

@@ -83,12 +83,6 @@ public:
myFaceMax = theMax;
}
//! Retruns true if cell filter contains no circle.
inline Standard_Boolean IsEmpty () const
{
return mySelector.Circles ().IsEmpty ();
}
//! Binds the circle to the tool.
//! @param theIndex index a circle should be bound with.
//! @param theCircle circle to be bound.

View File

@@ -1,60 +0,0 @@
// Created on: 2019-07-08
// Copyright (c) 2019 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// 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 _BRepMesh_ConstrainedBaseMeshAlgo_HeaderFile
#define _BRepMesh_ConstrainedBaseMeshAlgo_HeaderFile
#include <BRepMesh_BaseMeshAlgo.hxx>
#include <NCollection_Shared.hxx>
#include <IMeshTools_Parameters.hxx>
class BRepMesh_DataStructureOfDelaun;
class BRepMesh_Delaun;
//! Class provides base fuctionality to build face triangulation using Dealunay approach.
//! Performs generation of mesh using raw data from model.
class BRepMesh_ConstrainedBaseMeshAlgo : public BRepMesh_BaseMeshAlgo
{
public:
//! Constructor.
BRepMesh_ConstrainedBaseMeshAlgo ()
{
}
//! Destructor.
virtual ~BRepMesh_ConstrainedBaseMeshAlgo ()
{
}
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ConstrainedBaseMeshAlgo, BRepMesh_BaseMeshAlgo)
protected:
//! Returns size of cell to be used by acceleration circles grid structure.
virtual std::pair<Standard_Integer, Standard_Integer> getCellsCount (const Standard_Integer /*theVerticesNb*/)
{
return std::pair<Standard_Integer, Standard_Integer> (-1, -1);
}
//! Perfroms processing of generated mesh.
//! By default does nothing.
//! Expected to be called from method generateMesh() in successor classes.
virtual void postProcessMesh (BRepMesh_Delaun& /*theMesher*/)
{
}
};
#endif

View File

@@ -26,7 +26,6 @@
#include <Adaptor3d_HCurveOnSurface.hxx>
#include <Adaptor2d_HCurve2d.hxx>
#include <Standard_Failure.hxx>
#include <GCPnts_AbscissaPoint.hxx>
//=======================================================================
//function : Constructor
@@ -80,28 +79,21 @@ void BRepMesh_CurveTessellator::init()
aPreciseLinDef *= 0.5;
}
aPreciseLinDef = Max (aPreciseLinDef, Precision::Confusion());
aPreciseAngDef = Max (aPreciseAngDef, Precision::Angular());
Standard_Real aMinSize = myParameters.MinSize;
if (myParameters.AdjustMinSize)
{
aMinSize = Min (aMinSize, myParameters.RelMinSize() * GCPnts_AbscissaPoint::Length (
myCurve, myCurve.FirstParameter(), myCurve.LastParameter(), aPreciseLinDef));
}
aPreciseLinDef = Max(aPreciseLinDef, Precision::Confusion());
aPreciseAngDef = Max(aPreciseAngDef, Precision::Angular());
mySquareEdgeDef = aPreciseLinDef * aPreciseLinDef;
mySquareMinSize = Max (mySquareEdgeDef, aMinSize * aMinSize);
mySquareMinSize = Max(mySquareEdgeDef, myParameters.MinSize * myParameters.MinSize);
myEdgeSqTol = BRep_Tool::Tolerance (myEdge);
myEdgeSqTol = BRep_Tool::Tolerance(myEdge);
myEdgeSqTol *= myEdgeSqTol;
const Standard_Integer aMinPntNb = (myCurve.GetType() == GeomAbs_Circle) ? 4 : 2; //OCC287
myDiscretTool.Initialize (myCurve,
myCurve.FirstParameter(), myCurve.LastParameter(),
aPreciseAngDef, aPreciseLinDef, aMinPntNb,
Precision::PConfusion(), aMinSize);
myDiscretTool.Initialize(myCurve,
myCurve.FirstParameter(), myCurve.LastParameter(),
aPreciseAngDef, aPreciseLinDef, aMinPntNb,
Precision::PConfusion(), myParameters.MinSize);
if (myCurve.IsCurveOnSurface())
{

View File

@@ -1,70 +0,0 @@
// Created on: 2019-06-07
// Copyright (c) 2019 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// 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 _BRepMesh_CustomBaseMeshAlgo_HeaderFile
#define _BRepMesh_CustomBaseMeshAlgo_HeaderFile
#include <BRepMesh_ConstrainedBaseMeshAlgo.hxx>
#include <NCollection_Shared.hxx>
#include <IMeshTools_Parameters.hxx>
#include <BRepMesh_Delaun.hxx>
#include <BRepMesh_MeshTool.hxx>
class BRepMesh_DataStructureOfDelaun;
//! Class provides base fuctionality to build face triangulation using custom triangulation algorithm.
//! Performs generation of mesh using raw data from model.
class BRepMesh_CustomBaseMeshAlgo : public BRepMesh_ConstrainedBaseMeshAlgo
{
public:
//! Constructor.
Standard_EXPORT BRepMesh_CustomBaseMeshAlgo ()
{
}
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_CustomBaseMeshAlgo ()
{
}
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_CustomBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
protected:
//! Generates mesh for the contour stored in data structure.
Standard_EXPORT virtual void generateMesh () Standard_OVERRIDE
{
const Handle (BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure ();
buildBaseTriangulation ();
std::pair<Standard_Integer, Standard_Integer> aCellsCount = this->getCellsCount (aStructure->NbNodes ());
BRepMesh_Delaun aMesher (aStructure, aCellsCount.first, aCellsCount.second, Standard_False);
aMesher.ProcessConstraints ();
BRepMesh_MeshTool aCleaner (aStructure);
aCleaner.EraseFreeLinks ();
postProcessMesh (aMesher);
}
protected:
//! Builds base triangulation using custom triangulation algorithm.
Standard_EXPORT virtual void buildBaseTriangulation() = 0;
};
#endif

View File

@@ -1,53 +0,0 @@
// Created on: 2019-06-07
// Copyright (c) 2019 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// 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 _BRepMesh_CustomDelaunayBaseMeshAlgo_HeaderFile
#define _BRepMesh_CustomDelaunayBaseMeshAlgo_HeaderFile
class BRepMesh_DataStructureOfDelaun;
class BRepMesh_Delaun;
//! Class provides base fuctionality to build face triangulation using custom
//! triangulation algorithm with possibility to modify final mesh.
//! Performs generation of mesh using raw data from model.
template<class BaseAlgo>
class BRepMesh_CustomDelaunayBaseMeshAlgo : public BaseAlgo
{
public:
//! Constructor.
BRepMesh_CustomDelaunayBaseMeshAlgo ()
{
}
//! Destructor.
virtual ~BRepMesh_CustomDelaunayBaseMeshAlgo ()
{
}
protected:
//! Perfroms processing of generated mesh.
virtual void postProcessMesh(BRepMesh_Delaun& theMesher)
{
BaseAlgo::postProcessMesh (theMesher);
const Handle(BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure();
std::pair<Standard_Integer, Standard_Integer> aCellsCount = this->getCellsCount (aStructure->NbNodes());
theMesher.InitCirclesTool (aCellsCount.first, aCellsCount.second);
}
};
#endif

View File

@@ -78,25 +78,6 @@ namespace {
}
} // anonymous namespace
//=======================================================================
//function : BRepMesh_Delaun
//purpose :
//=======================================================================
BRepMesh_Delaun::BRepMesh_Delaun (
const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
const Standard_Integer theCellsCountU,
const Standard_Integer theCellsCountV,
const Standard_Boolean isFillCircles)
: myMeshData ( theOldMesh ),
myCircles (new NCollection_IncAllocator(
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
{
if (isFillCircles)
{
InitCirclesTool (theCellsCountU, theCellsCountV);
}
}
//=======================================================================
//function : BRepMesh_Delaun
//purpose : Creates the triangulation with an empty Mesh data structure
@@ -122,8 +103,7 @@ BRepMesh_Delaun::BRepMesh_Delaun(
const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
IMeshData::Array1OfVertexOfDelaun& theVertices)
: myMeshData( theOldMesh ),
myCircles ( theVertices.Length(), new NCollection_IncAllocator(
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
myCircles ( theVertices.Length(), theOldMesh->Allocator() )
{
if ( theVertices.Length() > 2 )
{
@@ -139,8 +119,7 @@ BRepMesh_Delaun::BRepMesh_Delaun(
const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
IMeshData::VectorOfInteger& theVertexIndices)
: myMeshData( theOldMesh ),
myCircles ( theVertexIndices.Length(), new NCollection_IncAllocator(
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
myCircles ( theVertexIndices.Length(), theOldMesh->Allocator() )
{
perform(theVertexIndices);
}
@@ -154,8 +133,7 @@ BRepMesh_Delaun::BRepMesh_Delaun (const Handle (BRepMesh_DataStructureOfDelaun)&
const Standard_Integer theCellsCountU,
const Standard_Integer theCellsCountV)
: myMeshData (theOldMesh),
myCircles (theVertexIndices.Length (), new NCollection_IncAllocator(
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
myCircles (theVertexIndices.Length (), theOldMesh->Allocator ())
{
perform (theVertexIndices, theCellsCountU, theCellsCountV);
}
@@ -179,63 +157,6 @@ void BRepMesh_Delaun::Init(IMeshData::Array1OfVertexOfDelaun& theVertices)
perform( aVertexIndexes );
}
//=======================================================================
//function : InitCirclesTool
//purpose :
//=======================================================================
void BRepMesh_Delaun::InitCirclesTool (const Standard_Integer theCellsCountU,
const Standard_Integer theCellsCountV)
{
Bnd_Box2d aBox;
for (Standard_Integer aNodeIt = 1; aNodeIt <= myMeshData->NbNodes(); ++aNodeIt)
{
aBox.Add (gp_Pnt2d (GetVertex (aNodeIt).Coord ()));
}
aBox.Enlarge (Precision);
initCirclesTool (aBox, theCellsCountU, theCellsCountV);
IMeshData::IteratorOfMapOfInteger aTriangleIt (myMeshData->ElementsOfDomain());
for (; aTriangleIt.More(); aTriangleIt.Next())
{
Standard_Integer aNodesIndices[3];
const BRepMesh_Triangle& aTriangle = myMeshData->GetElement (aTriangleIt.Key());
myMeshData->ElementNodes (aTriangle, aNodesIndices);
myCircles.Bind (aTriangleIt.Key(),
GetVertex( aNodesIndices[0] ).Coord(),
GetVertex( aNodesIndices[1] ).Coord(),
GetVertex( aNodesIndices[2] ).Coord());
}
}
//=======================================================================
//function : initCirclesTool
//purpose :
//=======================================================================
void BRepMesh_Delaun::initCirclesTool (const Bnd_Box2d& theBox,
const Standard_Integer theCellsCountU,
const Standard_Integer theCellsCountV)
{
Standard_Real aMinX, aMinY, aMaxX, aMaxY;
theBox.Get ( aMinX, aMinY, aMaxX, aMaxY );
const Standard_Real aDeltaX = aMaxX - aMinX;
const Standard_Real aDeltaY = aMaxY - aMinY;
Standard_Integer aScaler = 2;
if ( myMeshData->NbNodes() > 100 )
{
aScaler = 5;
}
else if( myMeshData->NbNodes() > 1000 )
{
aScaler = 7;
}
myCircles.SetMinMaxSize( gp_XY( aMinX, aMinY ), gp_XY( aMaxX, aMaxY ) );
myCircles.SetCellSize ( aDeltaX / Max (theCellsCountU, aScaler),
aDeltaY / Max (theCellsCountV, aScaler));
}
//=======================================================================
//function : perform
//purpose : Create super mesh and run triangulation procedure
@@ -259,8 +180,18 @@ void BRepMesh_Delaun::perform(IMeshData::VectorOfInteger& theVertexIndices,
aBox.Enlarge (Precision);
initCirclesTool (aBox, theCellsCountU, theCellsCountV);
superMesh (aBox);
Standard_Integer aScaler = 2;
if ( myMeshData->NbNodes() > 100 )
{
aScaler = 5;
}
else if( myMeshData->NbNodes() > 1000 )
{
aScaler = 7;
}
superMesh (aBox, Max (theCellsCountU, aScaler),
Max (theCellsCountV, aScaler));
ComparatorOfIndexedVertexOfDelaun aCmp(myMeshData);
std::make_heap(theVertexIndices.begin(), theVertexIndices.end(), aCmp);
@@ -273,7 +204,9 @@ void BRepMesh_Delaun::perform(IMeshData::VectorOfInteger& theVertexIndices,
//function : superMesh
//purpose : Build the super mesh
//=======================================================================
void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox,
const Standard_Integer theCellsCountU,
const Standard_Integer theCellsCountV)
{
Standard_Real aMinX, aMinY, aMaxX, aMaxY;
theBox.Get ( aMinX, aMinY, aMaxX, aMaxY );
@@ -284,6 +217,9 @@ void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
Standard_Real aDeltaMax = Max( aDeltaX, aDeltaY );
Standard_Real aDelta = aDeltaX + aDeltaY;
myCircles.SetMinMaxSize( gp_XY( aMinX, aMinY ), gp_XY( aMaxX, aMaxY ) );
myCircles.SetCellSize( aDeltaX / theCellsCountU, aDeltaY / theCellsCountV);
mySupVert[0] = myMeshData->AddNode(
BRepMesh_Vertex( ( aMinX + aMaxX ) / 2, aMaxY + aDeltaMax, BRepMesh_Free ) );
@@ -318,10 +254,7 @@ void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
void BRepMesh_Delaun::deleteTriangle(const Standard_Integer theIndex,
IMeshData::MapOfIntegerInteger& theLoopEdges )
{
if (!myCircles.IsEmpty())
{
myCircles.Delete (theIndex);
}
myCircles.Delete( theIndex );
const BRepMesh_Triangle& aElement = GetTriangle(theIndex);
const Standard_Integer(&e)[3] = aElement.myEdges;
@@ -346,11 +279,8 @@ void BRepMesh_Delaun::deleteTriangle(const Standard_Integer theIndex,
//=======================================================================
void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes)
{
// Insertion of edges of super triangles in the list of free edges:
Handle(NCollection_IncAllocator) aAllocator = new NCollection_IncAllocator(
IMeshData::MEMORY_BLOCK_SIZE_HUGE);
IMeshData::MapOfIntegerInteger aLoopEdges(10, aAllocator);
// Insertion of edges of super triangles in the list of free edges:
IMeshData::MapOfIntegerInteger aLoopEdges(10, myMeshData->Allocator());
const Standard_Integer(&e)[3] = mySupTrian.myEdges;
aLoopEdges.Bind( e[0], Standard_True );
@@ -601,7 +531,10 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
}
}
ProcessConstraints();
insertInternalEdges();
// Adjustment of meshes to boundary edges
frontierAdjust();
}
//=======================================================================

View File

@@ -41,12 +41,6 @@ public:
DEFINE_STANDARD_ALLOC
//! Creates instance of triangulator, but do not run the algorithm automatically.
Standard_EXPORT BRepMesh_Delaun (const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
const Standard_Integer theCellsCountU,
const Standard_Integer theCellsCountV,
const Standard_Boolean isFillCircles);
//! Creates the triangulation with an empty Mesh data structure.
Standard_EXPORT BRepMesh_Delaun (IMeshData::Array1OfVertexOfDelaun& theVertices);
@@ -67,10 +61,6 @@ public:
//! Initializes the triangulation with an array of vertices.
Standard_EXPORT void Init (IMeshData::Array1OfVertexOfDelaun& theVertices);
//! Forces initialization of circles cell filter using working structure.
Standard_EXPORT void InitCirclesTool (const Standard_Integer theCellsCountU,
const Standard_Integer theCellsCountV);
//! Removes a vertex from the triangulation.
Standard_EXPORT void RemoveVertex (const BRepMesh_Vertex& theVertex);
@@ -87,15 +77,6 @@ public:
return myMeshData;
}
//! Forces insertion of constraint edges into the base triangulation.
inline void ProcessConstraints()
{
insertInternalEdges();
// Adjustment of meshes to boundary edges
frontierAdjust();
}
//! Gives the list of frontier edges.
inline Handle(IMeshData::MapOfInteger) Frontier() const
{
@@ -158,11 +139,6 @@ private:
typedef NCollection_DataMap<Standard_Integer, IMeshData::MapOfInteger> DataMapOfMap;
//! Performs initialization of circles cell filter tool.
void initCirclesTool (const Bnd_Box2d& theBox,
const Standard_Integer theCellsCountU,
const Standard_Integer theCellsCountV);
//! Add boundig box for edge defined by start & end point to
//! the given vector of bounding boxes for triangulation edges.
void fillBndBox (IMeshData::SequenceOfBndB2d& theBoxes,
@@ -180,7 +156,9 @@ private:
const Standard_Integer theCellsCountV = -1);
//! Build the super mesh.
void superMesh (const Bnd_Box2d& theBox);
void superMesh (const Bnd_Box2d& theBox,
const Standard_Integer theCellsCountU,
const Standard_Integer theCellsCountV);
//! Computes the triangulation and adds the vertices,
//! edges and triangles to the Mesh data structure.

View File

@@ -16,7 +16,7 @@
#ifndef _BRepMesh_DelaunayBaseMeshAlgo_HeaderFile
#define _BRepMesh_DelaunayBaseMeshAlgo_HeaderFile
#include <BRepMesh_ConstrainedBaseMeshAlgo.hxx>
#include <BRepMesh_BaseMeshAlgo.hxx>
#include <NCollection_Shared.hxx>
#include <IMeshTools_Parameters.hxx>
@@ -25,7 +25,7 @@ class BRepMesh_Delaun;
//! Class provides base fuctionality to build face triangulation using Dealunay approach.
//! Performs generation of mesh using raw data from model.
class BRepMesh_DelaunayBaseMeshAlgo : public BRepMesh_ConstrainedBaseMeshAlgo
class BRepMesh_DelaunayBaseMeshAlgo : public BRepMesh_BaseMeshAlgo
{
public:
@@ -35,12 +35,24 @@ public:
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_DelaunayBaseMeshAlgo();
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_DelaunayBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_DelaunayBaseMeshAlgo, BRepMesh_BaseMeshAlgo)
protected:
//! Returns size of cell to be used by acceleration circles grid structure.
virtual std::pair<Standard_Integer, Standard_Integer> getCellsCount (const Standard_Integer /*theVerticesNb*/)
{
return std::pair<Standard_Integer, Standard_Integer> (-1, -1);
}
//! Generates mesh for the contour stored in data structure.
Standard_EXPORT virtual void generateMesh() Standard_OVERRIDE;
//! Perfroms processing of generated mesh.
//! By default does nothing.
virtual void postProcessMesh(BRepMesh_Delaun& /*theMesher*/)
{
}
};
#endif

View File

@@ -22,12 +22,12 @@
//! Extends node insertion Delaunay meshing algo in order to control
//! deflection of generated trianges. Splits triangles failing the check.
template<class RangeSplitter, class BaseAlgo>
class BRepMesh_DelaunayDeflectionControlMeshAlgo : public BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BaseAlgo>
template<class RangeSplitter>
class BRepMesh_DelaunayDeflectionControlMeshAlgo : public BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter>
{
private:
// Typedef for OCCT RTTI
typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BaseAlgo> DelaunayInsertionBaseClass;
typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter> DelaunayInsertionBaseClass;
public:

View File

@@ -21,18 +21,17 @@
//! Extends base Delaunay meshing algo in order to enable possibility
//! of addition of free vertices and internal nodes into the mesh.
template<class RangeSplitter, class BaseAlgo>
class BRepMesh_DelaunayNodeInsertionMeshAlgo : public BRepMesh_NodeInsertionMeshAlgo<RangeSplitter, BaseAlgo>
template<class RangeSplitter>
class BRepMesh_DelaunayNodeInsertionMeshAlgo : public BRepMesh_NodeInsertionMeshAlgo<RangeSplitter, BRepMesh_DelaunayBaseMeshAlgo>
{
private:
// Typedef for OCCT RTTI
typedef BRepMesh_NodeInsertionMeshAlgo<RangeSplitter, BaseAlgo> InsertionBaseClass;
typedef BRepMesh_NodeInsertionMeshAlgo<RangeSplitter, BRepMesh_DelaunayBaseMeshAlgo> InsertionBaseClass;
public:
//! Constructor.
BRepMesh_DelaunayNodeInsertionMeshAlgo()
: myIsPreProcessSurfaceNodes (Standard_False)
{
}
@@ -41,41 +40,8 @@ public:
{
}
//! Returns PreProcessSurfaceNodes flag.
inline Standard_Boolean IsPreProcessSurfaceNodes () const
{
return myIsPreProcessSurfaceNodes;
}
//! Sets PreProcessSurfaceNodes flag.
//! If TRUE, registers surface nodes before generation of base mesh.
//! If FALSE, inserts surface nodes after generation of base mesh.
inline void SetPreProcessSurfaceNodes (const Standard_Boolean isPreProcessSurfaceNodes)
{
myIsPreProcessSurfaceNodes = isPreProcessSurfaceNodes;
}
protected:
//! Performs initialization of data structure using existing model data.
virtual Standard_Boolean initDataStructure() Standard_OVERRIDE
{
if (!InsertionBaseClass::initDataStructure())
{
return Standard_False;
}
if (myIsPreProcessSurfaceNodes)
{
const Handle(IMeshData::ListOfPnt2d) aSurfaceNodes =
this->getRangeSplitter().GenerateSurfaceNodes(this->getParameters());
registerSurfaceNodes (aSurfaceNodes);
}
return Standard_True;
}
//! Returns size of cell to be used by acceleration circles grid structure.
virtual std::pair<Standard_Integer, Standard_Integer> getCellsCount (const Standard_Integer theVerticesNb) Standard_OVERRIDE
{
@@ -89,13 +55,10 @@ protected:
{
InsertionBaseClass::postProcessMesh(theMesher);
if (!myIsPreProcessSurfaceNodes)
{
const Handle(IMeshData::ListOfPnt2d) aSurfaceNodes =
this->getRangeSplitter().GenerateSurfaceNodes(this->getParameters());
const Handle(IMeshData::ListOfPnt2d) aSurfaceNodes =
this->getRangeSplitter().GenerateSurfaceNodes(this->getParameters());
insertNodes(aSurfaceNodes, theMesher);
}
insertNodes(aSurfaceNodes, theMesher);
}
//! Inserts nodes into mesh.
@@ -123,37 +86,6 @@ protected:
theMesher.AddVertices(aVertexIndexes);
return !aVertexIndexes.IsEmpty();
}
private:
//! Registers surface nodes in data structure.
Standard_Boolean registerSurfaceNodes(
const Handle(IMeshData::ListOfPnt2d)& theNodes)
{
if (theNodes.IsNull() || theNodes->IsEmpty())
{
return Standard_False;
}
Standard_Boolean isAdded = Standard_False;
IMeshData::ListOfPnt2d::Iterator aNodesIt(*theNodes);
for (Standard_Integer aNodeIt = 1; aNodesIt.More(); aNodesIt.Next(), ++aNodeIt)
{
const gp_Pnt2d& aPnt2d = aNodesIt.Value();
if (this->getClassifier()->Perform(aPnt2d) == TopAbs_IN)
{
isAdded = Standard_True;
this->registerNode(this->getRangeSplitter().Point(aPnt2d),
aPnt2d, BRepMesh_Free, Standard_False);
}
}
return isAdded;
}
private:
Standard_Boolean myIsPreProcessSurfaceNodes;
};
#endif

View File

@@ -83,7 +83,7 @@ Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellation
// Function: Perform
// Purpose :
//=======================================================================
Standard_Boolean BRepMesh_EdgeDiscret::performInternal (
Standard_Boolean BRepMesh_EdgeDiscret::Perform (
const Handle (IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters)
{
@@ -108,78 +108,69 @@ Standard_Boolean BRepMesh_EdgeDiscret::performInternal (
void BRepMesh_EdgeDiscret::process (const Standard_Integer theEdgeIndex) const
{
const IMeshData::IEdgeHandle& aDEdge = myModel->GetEdge (theEdgeIndex);
try
{
OCC_CATCH_SIGNALS
BRepMesh_Deflection::ComputeDeflection (aDEdge, myModel->GetMaxSize (), myParameters);
BRepMesh_Deflection::ComputeDeflection (aDEdge, myModel->GetMaxSize (), myParameters);
Handle (IMeshTools_CurveTessellator) aEdgeTessellator;
if (!aDEdge->IsFree ())
Handle (IMeshTools_CurveTessellator) aEdgeTessellator;
if (!aDEdge->IsFree ())
{
// Iterate over pcurves and check deflection on corresponding face.
Standard_Real aMinDeflection = RealLast ();
Standard_Integer aMinPCurveIndex = -1;
for (Standard_Integer aPCurveIt = 0; aPCurveIt < aDEdge->PCurvesNb (); ++aPCurveIt)
{
// Iterate over pcurves and check deflection on corresponding face.
Standard_Real aMinDeflection = RealLast ();
Standard_Integer aMinPCurveIndex = -1;
for (Standard_Integer aPCurveIt = 0; aPCurveIt < aDEdge->PCurvesNb (); ++aPCurveIt)
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve (aPCurveIt);
const Standard_Real aTmpDeflection = checkExistingPolygonAndUpdateStatus(aDEdge, aPCurve);
if (aTmpDeflection < aMinDeflection)
{
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve (aPCurveIt);
const Standard_Real aTmpDeflection = checkExistingPolygonAndUpdateStatus(aDEdge, aPCurve);
if (aTmpDeflection < aMinDeflection)
{
// Identify pcurve with the smallest deflection in order to
// retrieve polygon that represents the most smooth discretization.
aMinDeflection = aTmpDeflection;
aMinPCurveIndex = aPCurveIt;
}
BRepMesh_ShapeTool::CheckAndUpdateFlags (aDEdge, aPCurve);
}
if (aMinPCurveIndex != -1)
{
aDEdge->SetDeflection (aMinDeflection);
const IMeshData::IFaceHandle aDFace = aDEdge->GetPCurve(aMinPCurveIndex)->GetFace();
aEdgeTessellator = CreateEdgeTessellationExtractor(aDEdge, aDFace);
}
else
{
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve(0);
const IMeshData::IFaceHandle aDFace = aPCurve->GetFace();
aEdgeTessellator = BRepMesh_EdgeDiscret::CreateEdgeTessellator(
aDEdge, aPCurve->GetOrientation(), aDFace, myParameters);
// Identify pcurve with the smallest deflection in order to
// retrieve polygon that represents the most smooth discretization.
aMinDeflection = aTmpDeflection;
aMinPCurveIndex = aPCurveIt;
}
BRepMesh_ShapeTool::CheckAndUpdateFlags (aDEdge, aPCurve);
}
if (aMinPCurveIndex != -1)
{
aDEdge->SetDeflection (aMinDeflection);
const IMeshData::IFaceHandle aDFace = aDEdge->GetPCurve(aMinPCurveIndex)->GetFace();
aEdgeTessellator = CreateEdgeTessellationExtractor(aDEdge, aDFace);
}
else
{
TopLoc_Location aLoc;
const Handle (Poly_Polygon3D)& aPoly3D = BRep_Tool::Polygon3D (aDEdge->GetEdge (), aLoc);
if (!aPoly3D.IsNull ())
{
if (aPoly3D->HasParameters () &&
aPoly3D->Deflection () < 1.1 * aDEdge->GetDeflection ())
{
// Edge already has suitable 3d polygon.
aDEdge->SetStatus(IMeshData_Reused);
return;
}
else
{
aDEdge->SetStatus(IMeshData_Outdated);
}
}
aEdgeTessellator = CreateEdgeTessellator(aDEdge, myParameters);
}
Tessellate3d (aDEdge, aEdgeTessellator, Standard_True);
if (!aDEdge->IsFree())
{
Tessellate2d(aDEdge, Standard_True);
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve(0);
const IMeshData::IFaceHandle aDFace = aPCurve->GetFace();
aEdgeTessellator = BRepMesh_EdgeDiscret::CreateEdgeTessellator(
aDEdge, aPCurve->GetOrientation(), aDFace, myParameters);
}
}
catch (Standard_Failure const&)
else
{
aDEdge->SetStatus (IMeshData_Failure);
TopLoc_Location aLoc;
const Handle (Poly_Polygon3D)& aPoly3D = BRep_Tool::Polygon3D (aDEdge->GetEdge (), aLoc);
if (!aPoly3D.IsNull ())
{
if (aPoly3D->HasParameters () &&
aPoly3D->Deflection () < 1.1 * aDEdge->GetDeflection ())
{
// Edge already has suitable 3d polygon.
aDEdge->SetStatus(IMeshData_Reused);
return;
}
else
{
aDEdge->SetStatus(IMeshData_Outdated);
}
}
aEdgeTessellator = CreateEdgeTessellator(aDEdge, myParameters);
}
Tessellate3d (aDEdge, aEdgeTessellator, Standard_True);
if (!aDEdge->IsFree())
{
Tessellate2d(aDEdge, Standard_True);
}
}

View File

@@ -52,6 +52,11 @@ public:
const IMeshData::IEdgeHandle& theDEdge,
const IMeshData::IFaceHandle& theDFace);
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean Perform (
const Handle (IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
//! Functor API to discretize the given edge.
inline void operator() (const Standard_Integer theEdgeIndex) const {
process (theEdgeIndex);
@@ -70,13 +75,6 @@ public:
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_EdgeDiscret, IMeshTools_ModelAlgo)
protected:
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
const Handle (IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
private:
//! Checks existing discretization of the edge and updates data model.

View File

@@ -94,6 +94,8 @@ namespace
Handle(BRepMesh_FaceChecker::ArrayOfBndBoxTree)& myWiresBndBoxTree;
};
//! Selector.
//! Used to identify segments with overlapped bounding boxes.
//! Selector.
//! Used to identify segments with overlapped bounding boxes.
class BndBox2dTreeSelector : public IMeshData::BndBox2dTree::Selector

View File

@@ -43,7 +43,7 @@ BRepMesh_FaceDiscret::~BRepMesh_FaceDiscret()
// Function: Perform
// Purpose :
//=======================================================================
Standard_Boolean BRepMesh_FaceDiscret::performInternal(
Standard_Boolean BRepMesh_FaceDiscret::Perform(
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters)
{
@@ -73,23 +73,14 @@ void BRepMesh_FaceDiscret::process(const Standard_Integer theFaceIndex) const
return;
}
try
{
OCC_CATCH_SIGNALS
Handle(IMeshTools_MeshAlgo) aMeshingAlgo =
myAlgoFactory->GetAlgo(aDFace->GetSurface()->GetType(), myParameters);
Handle(IMeshTools_MeshAlgo) aMeshingAlgo =
myAlgoFactory->GetAlgo(aDFace->GetSurface()->GetType(), myParameters);
if (aMeshingAlgo.IsNull())
{
aDFace->SetStatus(IMeshData_Failure);
return;
}
aMeshingAlgo->Perform(aDFace, myParameters);
}
catch (Standard_Failure const&)
if (aMeshingAlgo.IsNull())
{
aDFace->SetStatus (IMeshData_Failure);
aDFace->SetStatus(IMeshData_Failure);
return;
}
aMeshingAlgo->Perform(aDFace, myParameters);
}

View File

@@ -23,7 +23,7 @@
//! Class implements functionality starting triangulation of model's faces.
//! Each face is processed separately and can be executed in parallel mode.
//! Uses mesh algo factory passed as initializer to create instance of triangulation
//! Uses mesh algo factory passed as initializer to create instace of triangulation
//! algorithm according to type of surface of target face.
class BRepMesh_FaceDiscret : public IMeshTools_ModelAlgo
{
@@ -36,6 +36,11 @@ public:
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_FaceDiscret();
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean Perform(
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
//! Functor API to discretize the given edge.
inline void operator() (const Standard_Integer theFaceIndex) const {
process(theFaceIndex);
@@ -43,13 +48,6 @@ public:
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_FaceDiscret, IMeshTools_ModelAlgo)
protected:
//! Performs processing of faces of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
private:
//! Checks existing discretization of the face and updates data model.

View File

@@ -86,28 +86,19 @@ BRepMesh_IncrementalMesh::~BRepMesh_IncrementalMesh()
//purpose :
//=======================================================================
void BRepMesh_IncrementalMesh::Perform()
{
Handle(BRepMesh_Context) aContext = new BRepMesh_Context;
Perform (aContext);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theContext)
{
initParameters();
theContext->SetShape(Shape());
theContext->ChangeParameters() = myParameters;
theContext->ChangeParameters().CleanModel = Standard_False;
Handle(BRepMesh_Context) aContext = new BRepMesh_Context;
aContext->SetShape(Shape());
aContext->ChangeParameters() = myParameters;
aContext->ChangeParameters().CleanModel = Standard_False;
IMeshTools_MeshBuilder aIncMesh(theContext);
IMeshTools_MeshBuilder aIncMesh(aContext);
aIncMesh.Perform();
myStatus = IMeshData_NoError;
const Handle(IMeshData_Model)& aModel = theContext->GetModel();
const Handle(IMeshData_Model)& aModel = aContext->GetModel();
for (Standard_Integer aFaceIt = 0; aFaceIt < aModel->FacesNb(); ++aFaceIt)
{
const IMeshData::IFaceHandle& aDFace = aModel->GetFace(aFaceIt);

View File

@@ -16,7 +16,6 @@
#include <BRepMesh_DiscretRoot.hxx>
#include <IMeshTools_Parameters.hxx>
#include <IMeshTools_Context.hxx>
//! Builds the mesh of a shape with respect of their
//! correctly triangulated parts
@@ -52,11 +51,8 @@ public: //! @name mesher API
Standard_EXPORT BRepMesh_IncrementalMesh(const TopoDS_Shape& theShape,
const IMeshTools_Parameters& theParameters);
//! Performs meshing ot the shape.
//! Performs meshing ot the shape.
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
//! Performs meshing using custom context;
Standard_EXPORT void Perform(const Handle(IMeshTools_Context)& theContext);
public: //! @name accessing to parameters.

View File

@@ -35,13 +35,13 @@ namespace
template<class RangeSplitter>
struct NodeInsertionMeshAlgo
{
typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BRepMesh_DelaunayBaseMeshAlgo> Type;
typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter> Type;
};
template<class RangeSplitter>
struct DeflectionControlMeshAlgo
{
typedef BRepMesh_DelaunayDeflectionControlMeshAlgo<RangeSplitter, BRepMesh_DelaunayBaseMeshAlgo> Type;
typedef BRepMesh_DelaunayDeflectionControlMeshAlgo<RangeSplitter> Type;
};
}
@@ -82,9 +82,7 @@ Handle(IMeshTools_MeshAlgo) BRepMesh_MeshAlgoFactory::GetAlgo(
break;
case GeomAbs_Cylinder:
return theParameters.InternalVerticesMode ?
new NodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
new BaseMeshAlgo::Type;
return new NodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type;
break;
case GeomAbs_Cone:

View File

@@ -18,6 +18,7 @@
#include <BRepMesh_ShapeVisitor.hxx>
#include <BRepMesh_ShapeTool.hxx>
#include <IMeshTools_ShapeExplorer.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
@@ -42,42 +43,52 @@ BRepMesh_ModelBuilder::~BRepMesh_ModelBuilder ()
// Function: Perform
// Purpose :
//=======================================================================
Handle (IMeshData_Model) BRepMesh_ModelBuilder::performInternal (
Handle (IMeshData_Model) BRepMesh_ModelBuilder::Perform (
const TopoDS_Shape& theShape,
const IMeshTools_Parameters& theParameters)
{
ClearStatus ();
Handle (BRepMeshData_Model) aModel;
Bnd_Box aBox;
BRepBndLib::Add (theShape, aBox, Standard_False);
if (!aBox.IsVoid ())
try
{
// Build data model for further processing.
aModel = new BRepMeshData_Model (theShape);
OCC_CATCH_SIGNALS
if (theParameters.Relative)
Bnd_Box aBox;
BRepBndLib::Add (theShape, aBox, Standard_False);
if (!aBox.IsVoid ())
{
Standard_Real aMaxSize;
BRepMesh_ShapeTool::BoxMaxDimension (aBox, aMaxSize);
aModel->SetMaxSize(aMaxSize);
// Build data model for further processing.
aModel = new BRepMeshData_Model (theShape);
if (theParameters.Relative)
{
Standard_Real aMaxSize;
BRepMesh_ShapeTool::BoxMaxDimension (aBox, aMaxSize);
aModel->SetMaxSize(aMaxSize);
}
else
{
aModel->SetMaxSize(Max(theParameters.Deflection,
theParameters.DeflectionInterior));
}
Handle (IMeshTools_ShapeVisitor) aVisitor =
new BRepMesh_ShapeVisitor (aModel);
IMeshTools_ShapeExplorer aExplorer (theShape);
aExplorer.Accept (aVisitor);
SetStatus (Message_Done1);
}
else
{
aModel->SetMaxSize(Max(theParameters.Deflection,
theParameters.DeflectionInterior));
SetStatus(Message_Fail1);
}
Handle (IMeshTools_ShapeVisitor) aVisitor =
new BRepMesh_ShapeVisitor (aModel);
IMeshTools_ShapeExplorer aExplorer (theShape);
aExplorer.Accept (aVisitor);
SetStatus (Message_Done1);
}
else
catch (Standard_Failure&)
{
SetStatus (Message_Fail1);
SetStatus (Message_Fail2);
}
return aModel;

View File

@@ -36,15 +36,13 @@ public:
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_ModelBuilder ();
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelBuilder, IMeshTools_ModelBuilder)
protected:
//! Creates discrete model for the given shape.
//! Returns nullptr in case of failure.
Standard_EXPORT virtual Handle (IMeshData_Model) performInternal (
Standard_EXPORT virtual Handle (IMeshData_Model) Perform (
const TopoDS_Shape& theShape,
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelBuilder, IMeshTools_ModelBuilder)
};
#endif

View File

@@ -115,7 +115,7 @@ BRepMesh_ModelHealer::~BRepMesh_ModelHealer()
// Function: Perform
// Purpose :
//=======================================================================
Standard_Boolean BRepMesh_ModelHealer::performInternal(
Standard_Boolean BRepMesh_ModelHealer::Perform(
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters)
{
@@ -226,30 +226,21 @@ Standard_Boolean BRepMesh_ModelHealer::popEdgesToUpdate(
//=======================================================================
void BRepMesh_ModelHealer::process(const IMeshData::IFaceHandle& theDFace) const
{
try
{
OCC_CATCH_SIGNALS
Handle(IMeshData::MapOfIEdgePtr)& aIntersections = myFaceIntersectingEdges->ChangeFind(theDFace.get());
aIntersections.Nullify();
Handle(IMeshData::MapOfIEdgePtr)& aIntersections = myFaceIntersectingEdges->ChangeFind(theDFace.get());
aIntersections.Nullify();
fixFaceBoundaries(theDFace);
if (!theDFace->IsSet(IMeshData_Failure))
{
BRepMesh_FaceChecker aChecker(theDFace, myParameters);
if (!aChecker.Perform())
{
#ifdef DEBUG_HEALER
std::cout << "Failed : #" << aChecker.GetIntersectingEdges()->Size() << std::endl;
#endif
aIntersections = aChecker.GetIntersectingEdges();
}
}
}
catch (Standard_Failure const&)
fixFaceBoundaries(theDFace);
if (!theDFace->IsSet(IMeshData_Failure))
{
theDFace->SetStatus (IMeshData_Failure);
BRepMesh_FaceChecker aChecker(theDFace, myParameters);
if (!aChecker.Perform())
{
#ifdef DEBUG_HEALER
std::cout << "Failed : #" << aChecker.GetIntersectingEdges()->Size() << std::endl;
#endif
aIntersections = aChecker.GetIntersectingEdges();
}
}
}

View File

@@ -44,6 +44,11 @@ public:
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_ModelHealer();
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean Perform(
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
//! Functor API to discretize the given edge.
inline void operator() (const Standard_Integer theEdgeIndex) const {
process(theEdgeIndex);
@@ -56,13 +61,6 @@ public:
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelHealer, IMeshTools_ModelAlgo)
protected:
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
private:
//! Checks existing discretization of the face and updates data model.

View File

@@ -177,7 +177,7 @@ BRepMesh_ModelPostProcessor::~BRepMesh_ModelPostProcessor()
// Function: Perform
// Purpose :
//=======================================================================
Standard_Boolean BRepMesh_ModelPostProcessor::performInternal(
Standard_Boolean BRepMesh_ModelPostProcessor::Perform(
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& /*theParameters*/)
{

View File

@@ -32,14 +32,12 @@ public:
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_ModelPostProcessor();
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelPostProcessor, IMeshTools_ModelAlgo)
protected:
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
Standard_EXPORT virtual Standard_Boolean Perform(
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelPostProcessor, IMeshTools_ModelAlgo)
};
#endif

View File

@@ -242,7 +242,7 @@ BRepMesh_ModelPreProcessor::~BRepMesh_ModelPreProcessor()
// Function: Perform
// Purpose :
//=======================================================================
Standard_Boolean BRepMesh_ModelPreProcessor::performInternal(
Standard_Boolean BRepMesh_ModelPreProcessor::Perform(
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters)
{

View File

@@ -33,14 +33,12 @@ public:
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_ModelPreProcessor();
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelPreProcessor, IMeshTools_ModelAlgo)
protected:
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
Standard_EXPORT virtual Standard_Boolean Perform(
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelPreProcessor, IMeshTools_ModelAlgo)
};
#endif

View File

@@ -1,6 +1,5 @@
BRepMesh_BaseMeshAlgo.cxx
BRepMesh_BaseMeshAlgo.hxx
BRepMesh_ConstrainedBaseMeshAlgo.hxx
BRepMesh_BoundaryParamsRangeSplitter.hxx
BRepMesh_Circle.hxx
BRepMesh_CircleInspector.hxx
@@ -83,6 +82,4 @@ BRepMesh_UVParamRangeSplitter.hxx
BRepMesh_Vertex.hxx
BRepMesh_VertexInspector.hxx
BRepMesh_VertexTool.cxx
BRepMesh_VertexTool.hxx
BRepMesh_CustomBaseMeshAlgo.hxx
BRepMesh_CustomDelaunayBaseMeshAlgo.hxx
BRepMesh_VertexTool.hxx

View File

@@ -17,7 +17,6 @@
#include <gp_Pnt2d.hxx>
#include <BRepMesh_OrientedEdge.hxx>
#include <BRepMesh_Vertex.hxx>
#include <Standard_OutOfRange.hxx>
//=======================================================================
// Function: Constructor
@@ -75,9 +74,6 @@ void BRepMeshData_PCurve::AddPoint (
//=======================================================================
gp_Pnt2d& BRepMeshData_PCurve::GetPoint (const Standard_Integer theIndex)
{
Standard_OutOfRange_Raise_if (
theIndex < 0 || theIndex >= static_cast<Standard_Integer>(myPoints2d.size()),
"BRepMeshData_PCurve::GetPoint");
return myPoints2d[theIndex];
}
@@ -87,9 +83,6 @@ gp_Pnt2d& BRepMeshData_PCurve::GetPoint (const Standard_Integer theIndex)
//=======================================================================
Standard_Integer& BRepMeshData_PCurve::GetIndex(const Standard_Integer theIndex)
{
Standard_OutOfRange_Raise_if (
theIndex < 0 || theIndex >= static_cast<Standard_Integer>(myIndices.size()),
"BRepMeshData_PCurve::GetIndex");
return myIndices[theIndex];
}
@@ -99,9 +92,6 @@ Standard_Integer& BRepMeshData_PCurve::GetIndex(const Standard_Integer theIndex)
//=======================================================================
Standard_Real& BRepMeshData_PCurve::GetParameter (const Standard_Integer theIndex)
{
Standard_OutOfRange_Raise_if (
theIndex < 0 || theIndex >= ParametersNb(),
"BRepMeshData_PCurve::GetParameter");
return myParameters[theIndex];
}

View File

@@ -1486,9 +1486,7 @@ void BRepTest::BasicCommands(Draw_Interpretor& theCommands)
"\n\t\t: -noTriangulation Force use of exact geometry for calculation"
"\n\t\t: even if triangulation is present."
"\n\t\t: -optimal Force calculation of optimal (more tight) AABB."
"\n\t\t: In case of OBB:"
"\n\t\t: - for PCA approach applies to initial AABB used in OBB calculation"
"\n\t\t: - for DiTo approach modifies the DiTo algorithm to check more axes."
"\n\t\t: In case of OBB, applies to initial AABB used in OBB calculation."
"\n\t\t: -extToler Include tolerance of the shape in the resulting box."
"\n\t\t:"
"\n\t\t: Output options:"

View File

@@ -18,7 +18,9 @@
#include <BVH_Constants.hxx>
#include <BVH_Types.hxx>
#include <Message_Alerts.hxx>
#include <Standard_ShortReal.hxx>
#include <TCollection.hxx>
#include <limits>
@@ -108,6 +110,17 @@ public:
//! Returns center of bounding box along the given axis.
T Center (const Standard_Integer theAxis) const;
//! Dumps the content of me on the stream <OS>.
void Dump (Standard_OStream& OS) const
{
DUMP_VALUES (OS, "BVH_Box", 2);
DUMP_VALUES (OS, "IsValid", IsValid());
OS << "Bnd_Box" << TCollection::DumpSeparator();
BVH::ToBndBox (CornerMin(), CornerMax()).Dump (OS);
OS << TCollection::DumpSeparator();
}
public:
//! Checks if the Box is out of the other box.

View File

@@ -18,6 +18,11 @@
#include <BVH_Box.hxx>
#include <Message_Alerts.hxx>
#include <Standard_Macro.hxx>
#include <Standard_OStream.hxx>
template<class T, int N> class BVH_Builder;
//! A non-template class for using as base for BVH_TreeBase
@@ -27,6 +32,13 @@ class BVH_TreeBaseTransient : public Standard_Transient
DEFINE_STANDARD_RTTIEXT(BVH_TreeBaseTransient, Standard_Transient)
protected:
BVH_TreeBaseTransient() {}
//! Dumps the content of me on the stream <OS>.
virtual void Dump (Standard_OStream& OS) const { (void)OS; }
//! Dumps the content of the given node on the stream <OS>.
virtual void DumpNode (const int theNodeIndex, Standard_OStream& OS) const
{ (void)theNodeIndex; (void)OS; }
};
//! Stores parameters of bounding volume hierarchy (BVH).
@@ -178,6 +190,37 @@ public: //! @name methods for accessing serialized tree data
return myMaxPointBuffer;
}
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE
{
DUMP_VALUES (OS, "BVH_Tree", 2);
DUMP_VALUES (OS, "Depth", Depth());
DUMP_VALUES (OS, "Length", Length());
for (Standard_Integer aNodeIdx = 0; aNodeIdx < Length(); ++aNodeIdx)
{
DumpNode (aNodeIdx, OS);
}
}
//! Dumps the content of the given node on the stream <OS>.
Standard_EXPORT virtual void DumpNode (const int theNodeIndex, Standard_OStream& OS) const Standard_OVERRIDE
{
DUMP_VALUES (OS, "BVH_TreeNode", 2);
DUMP_VALUES (OS, "NodeIndex", theNodeIndex);
OS << "Bnd_Box" << TCollection::DumpSeparator();
BVH::ToBndBox (MinPoint (theNodeIndex), MaxPoint (theNodeIndex)).Dump (OS);
OS << TCollection::DumpSeparator();
DUMP_VALUES (OS, "BegPrimitive", BegPrimitive (theNodeIndex));
DUMP_VALUES (OS, "EndPrimitive", EndPrimitive (theNodeIndex));
DUMP_VALUES (OS, "Level", Level (theNodeIndex));
DUMP_VALUES (OS, "IsOuter", IsOuter (theNodeIndex));
}
public: //! @name protected fields
//! Array of node data records.

View File

@@ -21,10 +21,12 @@
#include <vector>
#include <Bnd_Box.hxx>
#include <NCollection_Mat4.hxx>
#include <NCollection_Vec2.hxx>
#include <NCollection_Vec3.hxx>
#include <NCollection_Vector.hxx>
#include <Standard_OStream.hxx>
#include <Standard_Type.hxx>
// GCC supports shrink function only in C++11 mode
@@ -57,6 +59,32 @@ namespace BVH
typedef NCollection_Vec3<T> Type;
};
template<class T> Bnd_Box ToBndBox (const T& theType1, const T& theType2)
{
return Bnd_Box (theType1, 0., 0., theType2, 0., 0.);
}
template<class T> Bnd_Box ToBndBox (const NCollection_Vec2<T>& theType1,
const NCollection_Vec2<T>& theType2)
{
return Bnd_Box (theType1.x(), theType1.y(), 0.,
theType2.x(), theType2.y(), 0.);
}
template<class T> Bnd_Box ToBndBox (const NCollection_Vec3<T>& theType1,
const NCollection_Vec3<T>& theType2)
{
return Bnd_Box (theType1.x(), theType1.y(), theType1.z(),
theType2.x(), theType2.y(), theType2.z());
}
template<class T> Bnd_Box ToBndBox (const NCollection_Vec4<T>& theType1,
const NCollection_Vec4<T>& theType2)
{
return Bnd_Box (theType1.x(), theType1.y(), theType1.z(),
theType2.x(), theType2.y(), theType2.z());
}
template<class T> struct VectorType<T, 4>
{
typedef NCollection_Vec4<T> Type;

View File

@@ -42,6 +42,9 @@ class BinMXCAFDoc_DimTolToolDriver;
class BinMXCAFDoc_MaterialToolDriver;
class BinMXCAFDoc_ViewDriver;
class BinMXCAFDoc_ViewToolDriver;
class BinMXCAFDoc_AnimationDriver;
class BinMXCAFDoc_AnimationToolDriver;
@@ -89,6 +92,9 @@ friend class BinMXCAFDoc_DimTolToolDriver;
friend class BinMXCAFDoc_MaterialToolDriver;
friend class BinMXCAFDoc_ViewDriver;
friend class BinMXCAFDoc_ViewToolDriver;
friend class BinMXCAFDoc_AnimationDriver;
friend class BinMXCAFDoc_AnimationToolDriver;
};

View File

@@ -0,0 +1,112 @@
// Created on: 2017-10-02
// Created by: Elena MOZOKHINA
// Copyright (c) 2016 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 <BinMXCAFDoc_AnimationDriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TDF_Attribute.hxx>
#include <XCAFDoc_Animation.hxx>
# include <TColStd_HArray1OfByte.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_AnimationDriver,BinMDF_ADriver)
static Standard_Boolean getByteArray(const BinObjMgt_Persistent& theSource, Handle(TColStd_HArray1OfByte)& theArray)
{
Standard_Integer aFirstInd, aLastInd;
if (!(theSource >> aFirstInd >> aLastInd))
return Standard_False;
if (aLastInd < aFirstInd)
return Standard_False;
theArray.reset(new TColStd_HArray1OfByte(aFirstInd, aLastInd - aFirstInd + 1));
theSource.GetByteArray(&theArray->ChangeFirst(), aLastInd - aFirstInd + 1);
return Standard_True;
}
static void putByteArray(BinObjMgt_Persistent& theTarget, const Handle(TColStd_HArray1OfByte)& theArray)
{
if (theArray.IsNull())
return;
const Standard_Integer aFirstInd = theArray->Lower();
const Standard_Integer aLastInd = theArray->Upper();
if (aLastInd < aFirstInd)
return;
theTarget << aFirstInd << aLastInd;
theTarget.PutByteArray(&theArray->ChangeFirst(), aLastInd - aFirstInd + 1);
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BinMXCAFDoc_AnimationDriver::BinMXCAFDoc_AnimationDriver
(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_Animation)->Name())
{
}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMXCAFDoc_AnimationDriver::NewEmpty() const
{
return new XCAFDoc_Animation();
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
Standard_Boolean BinMXCAFDoc_AnimationDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
{
Handle(XCAFDoc_Animation) anAtt = Handle(XCAFDoc_Animation)::DownCast(theTarget);
Standard_Real aDensity;
TCollection_AsciiString aName;
if (!(theSource >> aName))
return Standard_False;
Handle(TColStd_HArray1OfByte) anImage, anAnimation;
if (!getByteArray(theSource, anImage) || anImage.IsNull())
return Standard_False;
if (!getByteArray(theSource, anAnimation) || anAnimation.IsNull())
return Standard_False;
anAtt->Set(new TCollection_HAsciiString(aName), anImage, anAnimation);
return Standard_True;
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
void BinMXCAFDoc_AnimationDriver::Paste(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& /*theRelocTable*/) const
{
Handle(XCAFDoc_Animation) anAtt = Handle(XCAFDoc_Animation)::DownCast(theSource);
Handle(TCollection_HAsciiString) aName = anAtt->GetName();
if (!aName.IsNull())
theTarget << aName->String();
putByteArray(theTarget, anAtt->GetImage());
putByteArray(theTarget, anAtt->GetAnimation());
}

View File

@@ -0,0 +1,72 @@
// Created on: 2017-10-02
// Created by: Elena MOZOKHINA
// Copyright (c) 2016 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 _BinMXCAFDoc_AnimationDriver_HeaderFile
#define _BinMXCAFDoc_AnimationDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <BinMDF_ADriver.hxx>
#include <Standard_Boolean.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
class Message_Messenger;
class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMXCAFDoc_AnimationDriver;
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_AnimationDriver, BinMDF_ADriver)
class BinMXCAFDoc_AnimationDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMXCAFDoc_AnimationDriver(const Handle(Message_Messenger)& theMsgDriver);
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean Paste (const BinObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& theSource, BinObjMgt_Persistent& theTarget, BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_AnimationDriver,BinMDF_ADriver)
protected:
private:
};
#endif // _BinMXCAFDoc_AnimationDriver_HeaderFile

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