opencascade AIS_ViewController源码学习 视图控制、包含鼠标事件等

news2024/9/20 16:47:28

opencascade AIS_ViewController

前言

在这里插入图片描述

用于在GUI和渲染线程之间处理视图器事件的辅助结构。
该类实现了以下功能:
缓存存储用户输入状态(鼠标、触摸和键盘)。
将鼠标/多点触控输入映射到视图相机操作(平移、旋转、缩放)。
输入事件不会立即应用,而是排队等待两个工作线程单独处理:
UI线程接收用户输入,渲染线程用于OCCT 3D视图绘制。

方法

1

空构造函数。
AIS_ViewController();

2

返回输入缓冲区。
const AIS_ViewInputBuffer& InputBuffer(AIS_ViewInputBufferType theType) const { return theType == AIS_ViewInputBufferType_UI ? myUI : myGL; }

3

返回输入缓冲区。
AIS_ViewInputBuffer& ChangeInputBuffer(AIS_ViewInputBufferType theType) { return theType == AIS_ViewInputBufferType_UI ? myUI : myGL; }

4

//! 返回视图动画;默认情况下为空(但不是NULL)动画。
const Handle(AIS_AnimationCamera)& ViewAnimation() const { return myViewAnimation; }

5

//! 设置视图动画以在handleViewRedraw()中处理。
void SetViewAnimation(const Handle(AIS_AnimationCamera)& theAnimation) { myViewAnimation = theAnimation; }

6

//! 中断活动的视图动画。
Standard_EXPORT void AbortViewAnimation();

7

//! 返回对象动画;默认情况下为空(但不是NULL)动画。
const Handle(AIS_Animation)& ObjectsAnimation() const { return myObjAnimation; }

8

//! 设置对象动画以在handleViewRedraw()中处理。
void SetObjectsAnimation(const Handle(AIS_Animation)& theAnimation) { myObjAnimation = theAnimation; }

9

//! 返回TRUE如果对象动画应该在鼠标点击时暂停;默认情况下为FALSE。
bool ToPauseObjectsAnimation() const { return myToPauseObjAnimation; }

10

//! 设置是否在鼠标点击时暂停对象动画。
void SetPauseObjectsAnimation(bool theToPause) { myToPauseObjAnimation = theToPause; }

11

//! 返回TRUE如果启用连续重绘;默认情况下为FALSE。
//! 此选项会要求在当前帧完成后立即完全重绘下一个视图帧。
bool IsContinuousRedraw() const { return myIsContinuousRedraw; }

12

//! 启用或禁用连续更新。
void SetContinuousRedraw(bool theToEnable) { myIsContinuousRedraw = theToEnable; }

全局参数

13

//! 返回相机旋转模式,默认为AIS_RotationMode_BndBoxActive。
AIS_RotationMode RotationMode() const { return myRotationMode; }

14

//! 设置相机旋转模式。
void SetRotationMode(AIS_RotationMode theMode) { myRotationMode = theMode; }

15

//! 返回相机导航模式;默认情况下为AIS_NavigationMode_Orbit。
AIS_NavigationMode NavigationMode() const { return myNavigationMode; }

16

//! 设置相机导航模式。
Standard_EXPORT void SetNavigationMode(AIS_NavigationMode theMode);

17

//! 返回第一人称模式下鼠标输入加速比率;默认为1.0。
float MouseAcceleration() const { return myMouseAccel; }

18

//! 设置鼠标输入加速比率。
void SetMouseAcceleration(float theRatio) { myMouseAccel = theRatio; }

19

//! 返回轨道旋转加速比率;默认为1.0。
float OrbitAcceleration() const { return myOrbitAccel; }

20

//! 设置轨道旋转加速比率。
void SetOrbitAcceleration(float theRatio) { myOrbitAccel = theRatio; }

21

//! 返回TRUE如果在透视投影中应显示平移锚点;默认为TRUE。
bool ToShowPanAnchorPoint() const { return myToShowPanAnchorPoint; }

22

//! 设置是否在透视投影中显示平移锚点。
void SetShowPanAnchorPoint(bool theToShow) { myToShowPanAnchorPoint = theToShow; }

23

//! 返回TRUE如果应在3D查看器中显示旋转中心点;默认为TRUE。
bool ToShowRotateCenter() const { return myToShowRotateCenter; }

24

//! 设置是否在3D查看器中显示旋转中心点。
void SetShowRotateCenter(bool theToShow) { myToShowRotateCenter = theToShow; }

25

//! 返回TRUE如果在AIS_NavigationMode_Orbit旋转模式下相机上方向应强制为Z向上;默认为FALSE。
bool ToLockOrbitZUp() const { return myToLockOrbitZUp; }

26

//! 设置在AIS_NavigationMode_Orbit旋转模式下相机上方向是否应强制为Z向上。
void SetLockOrbitZUp(bool theToForceUp) { myToLockOrbitZUp = theToForceUp; }

27

//! 返回TRUE如果启用通过双触控手势进行Z轴旋转;默认为FALSE。
bool ToAllowTouchZRotation() const { return myToAllowTouchZRotation; }

28

//! 设置是否启用通过双触控手势进行Z轴旋转。
void SetAllowTouchZRotation(bool theToEnable) { myToAllowTouchZRotation = theToEnable; }

29

//! 返回TRUE如果允许相机旋转;默认为TRUE。
bool ToAllowRotation() const { return myToAllowRotation; }

30

//! 设置是否允许相机旋转。
void SetAllowRotation(bool theToEnable) { myToAllowRotation = theToEnable; }

31

//! 返回TRUE如果允许平移;默认为TRUE。
bool ToAllowPanning() const { return myToAllowPanning; }

32

//! 设置是否允许平移。
void SetAllowPanning(bool theToEnable) { myToAllowPanning = theToEnable; }

33

//! 返回TRUE如果允许缩放;默认为TRUE。
bool ToAllowZooming() const { return myToAllowZooming; }

34

//! 设置是否允许缩放。
void SetAllowZooming(bool theToEnable) { myToAllowZooming = theToEnable; }

35

//! 返回TRUE如果允许ZFocus更改;默认为TRUE。
bool ToAllowZFocus() const { return myToAllowZFocus; }

36

//! 设置是否允许ZFocus更改。
void SetAllowZFocus(bool theToEnable) { myToAllowZFocus = theToEnable; }

37

//! 返回TRUE如果允许鼠标移动时动态高亮显示;默认为TRUE。
bool ToAllowHighlight() const { return myToAllowHighlight; }

38

//! 设置是否允许鼠标移动时动态高亮显示。
void SetAllowHighlight(bool theToEnable) { myToAllowHighlight = theToEnable; }

39

//! 返回TRUE如果允许拖拽对象;默认为TRUE。
bool ToAllowDragging() const { return myToAllowDragging; }

40

//! 设置是否允许拖拽对象。
void SetAllowDragging(bool theToEnable) { myToAllowDragging = theToEnable; }

41

//! 返回TRUE如果在缩放到点时应将选取点投影到拾取射线上;默认为TRUE。
bool ToStickToRayOnZoom() const { return myToStickToRayOnZoom; }

42

//! 设置在缩放到点时是否应将选取点投影到拾取射线上。
void SetStickToRayOnZoom(bool theToEnable) { myToStickToRayOnZoom = theToEnable; }

43

//! 返回TRUE如果在围绕点旋转时应将选取点投影到拾取射线上;默认为TRUE。
bool ToStickToRayOnRotation() const { return myToStickToRayOnRotation; }

44

//! 设置在围绕点旋转时是否应将选取点投影到拾取射线上。
void SetStickToRayOnRotation(bool theToEnable) { myToStickToRayOnRotation = theToEnable; }

45

//! 返回TRUE如果在处理Aspect_VKey_NavLookUp/Aspect_VKey_NavLookDown时应反转俯仰方向;默认为FALSE。
bool ToInvertPitch() const { return myToInvertPitch; }

46

//! 设置是否反转俯仰方向。
void SetInvertPitch(bool theToInvert) { myToInvertPitch = theToInvert; }

47

//! 返回正常步行速度,单位为米/秒;默认为1.5。
float WalkSpeedAbsolute() const { return myWalkSpeedAbsolute; }

48

//! 设置正常步行速度,单位为米/秒;默认为1.5。
void SetWalkSpeedAbsolute(float theSpeed) { myWalkSpeedAbsolute = theSpeed; }

49

//! 返回相对于场景包围盒的步行速度比率;默认为0.1。
float WalkSpeedRelative() const { return myWalkSpeedRelative; }

50

//! 设置相对于场景包围盒的步行速度比率。
void SetWalkSpeedRelative(float theFactor) { myWalkSpeedRelative = theFactor; }

51

//! 返回活动推力值;默认为0.0。
float ThrustSpeed() const { return myThrustSpeed; }

52

//! 设置活动推力值。
void SetThrustSpeed(float theSpeed);
//! 返回TRUE如果先前已定义MoveTo的前一个位置。
bool HasPreviousMoveTo() const { return myPrevMoveTo != Graphic3d_Vec2i(-1); }

53

//! 返回3D查看器中MoveTo事件的前一个位置。
const Graphic3d_Vec2i& PreviousMoveTo() const { return myPrevMoveTo; }

54

//! 重置MoveTo的前一个位置。
void ResetPreviousMoveTo() { myPrevMoveTo = Graphic3d_Vec2i(-1); }

55

//! 返回TRUE以显示辅助跟踪的XR设备(如跟踪站)。
bool ToDisplayXRAuxDevices() const { return myToDisplayXRAuxDevices; }

56

//! 设置是否应显示辅助跟踪的XR设备。
void SetDisplayXRAuxDevices(bool theToDisplay) { myToDisplayXRAuxDevices = theToDisplay; }

57

//! 返回TRUE以显示XR手柄。
bool ToDisplayXRHands() const { return myToDisplayXRHands; }

58

//! 设置是否应显示XR手柄。
void SetDisplayXRHands(bool theToDisplay) { myToDisplayXRHands = theToDisplay; }

键盘输入
59

using Aspect_WindowInputListener::Keys;
using Aspect_WindowInputListener::ChangeKeys;

60

//! 按下按键。
//! 默认实现更新内部缓存。
//! @param theKey 按下的按键
//! @param theTime 事件时间戳
Standard_EXPORT virtual void KeyDown (Aspect_VKey theKey,
double theTime,
double thePressure = 1.0) Standard_OVERRIDE;

61

//! 松开按键。
//! 默认实现更新内部缓存。
//! @param theKey 按下的按键
//! @param theTime 事件时间戳
Standard_EXPORT virtual void KeyUp (Aspect_VKey theKey,
double theTime) Standard_OVERRIDE;

62

//! 根据轴值模拟按键的按下/松开事件。
//! 默认实现更新内部缓存。
Standard_EXPORT virtual void KeyFromAxis (Aspect_VKey theNegative,
Aspect_VKey thePositive,
double theTime,
double thePressure) Standard_OVERRIDE;

63

//! 获取活动的导航动作。
Standard_EXPORT AIS_WalkDelta FetchNavigationKeys (Standard_Real theCrouchRatio,
Standard_Real theRunRatio);

鼠标输入
64

//! 返回定义鼠标手势的映射。
const AIS_MouseGestureMap& MouseGestureMap() const { return myMouseGestureMap; }

65

//! 返回定义鼠标手势的映射。
AIS_MouseGestureMap& ChangeMouseGestureMap() { return myMouseGestureMap; }

66

//! 返回定义鼠标选择方案的映射。
const AIS_MouseSelectionSchemeMap& MouseSelectionSchemes() const { return myMouseSelectionSchemes; }

67

//! 返回定义鼠标选择方案的映射。
AIS_MouseSelectionSchemeMap& ChangeMouseSelectionSchemes() { return myMouseSelectionSchemes; }

68

//! 返回双击间隔时间(秒),默认为0.4秒。
double MouseDoubleClickInterval() const { return myMouseDoubleClickInt; }

69

//! 设置双击间隔时间(秒)。
void SetMouseDoubleClickInterval(double theSeconds) { myMouseDoubleClickInt = theSeconds; }

70

//! 在3D视图中执行选择操作。
//! 预期该方法从UI线程调用。
//! @param thePnt 拾取点
//! @param theScheme 选择方案
Standard_EXPORT virtual void SelectInViewer(const Graphic3d_Vec2i& thePnt,
const AIS_SelectionScheme theScheme = AIS_SelectionScheme_Replace);

71

//! 在3D视图中执行选择操作。
//! 预期该方法从UI线程调用。
//! @param thePnts 拾取点序列
//! @param theScheme 选择方案
Standard_EXPORT virtual void SelectInViewer(const NCollection_Sequence<Graphic3d_Vec2i>& thePnts,
const AIS_SelectionScheme theScheme = AIS_SelectionScheme_Replace);

72

//! 更新矩形选择工具。
//! 预期该方法从UI线程调用。
//! @param thePntFrom 矩形的第一个角点
//! @param thePntTo 矩形的另一个角点
Standard_EXPORT virtual void UpdateRubberBand(const Graphic3d_Vec2i& thePntFrom,
const Graphic3d_Vec2i& thePntTo);

73

//! 更新多边形选择工具。
//! 预期该方法从UI线程调用。
//! @param thePnt 新添加到多边形中的点
//! @param theToAppend 是否添加新点或更新最后一个点
Standard_EXPORT virtual void UpdatePolySelection(const Graphic3d_Vec2i& thePnt,
bool theToAppend);

//! 更新缩放事件(例如来自鼠标滚轮)。
//! 预期该方法从UI线程调用。
//! @param theDelta 鼠标光标位置和缩放增量
//! @return 如果创建了新的缩放事件则返回TRUE,如果更新了现有事件则返回FALSE
Standard_EXPORT virtual bool UpdateZoom(const Aspect_ScrollDelta& theDelta);

74

//! 更新Z轴旋转事件。
//! @param theAngle 旋转角度,以弧度为单位。
//! @return 如果创建了新的旋转事件则返回TRUE,如果更新了现有事件则返回FALSE
Standard_EXPORT virtual bool UpdateZRotation(double theAngle);

75

//! 更新鼠标滚轮事件;默认重定向到UpdateZoom。
//! 预期该方法从UI线程调用。
//! @param theDelta 鼠标光标位置和增量
//! @return 如果创建了新事件则返回TRUE,如果更新了现有事件则返回FALSE
Standard_EXPORT virtual bool UpdateMouseScroll(const Aspect_ScrollDelta& theDelta) Standard_OVERRIDE;

76

//! 处理鼠标按钮按下/释放事件。
//! 预期该方法从UI线程调用。
//! @param thePoint 鼠标光标位置
//! @param theButtons 按下的按钮
//! @param theModifiers 按键修饰符
//! @param theIsEmulated 如果为TRUE,则鼠标事件不是来自真实鼠标,而是来自触摸等非精确输入的仿真
//! @return 如果应重绘视图则返回TRUE
Standard_EXPORT virtual bool UpdateMouseButtons(const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButtons,
Aspect_VKeyFlags theModifiers,
bool theIsEmulated) Standard_OVERRIDE;

77

//! 处理鼠标移动事件。
//! 预期该方法从UI线程调用。
//! @param thePoint 鼠标光标位置
//! @param theButtons 按下的按钮
//! @param theModifiers 按键修饰符
//! @param theIsEmulated 如果为TRUE,则鼠标事件不是来自真实鼠标,而是来自触摸等非精确输入的仿真
//! @return 如果应重绘视图则返回TRUE
Standard_EXPORT virtual bool UpdateMousePosition(const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButtons,
Aspect_VKeyFlags theModifiers,
bool theIsEmulated) Standard_OVERRIDE;

78

//! 处理鼠标点击事件(由UpdateMouseButtons()仿真单击释放按钮)。
//! 注意,由于该方法由UpdateMouseButtons()调用,因此应在UI线程中执行。
//! 默认实现重定向到SelectInViewer()。
//! 预期该方法从UI线程调用。
//! @param thePoint 鼠标光标位置
//! @param theButton 点击的按钮
//! @param theModifiers 按键修饰符
//! @param theIsDoubleClick 标志指示是否双击鼠标
//! @return 如果应重绘视图则返回TRUE
Standard_EXPORT virtual bool UpdateMouseClick(const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButton,
Aspect_VKeyFlags theModifiers,
bool theIsDoubleClick);

using Aspect_WindowInputListener::PressMouseButton;
using Aspect_WindowInputListener::ReleaseMouseButton;

using Aspect_WindowInputListener::PressedMouseButtons;
using Aspect_WindowInputListener::LastMouseFlags;
using Aspect_WindowInputListener::LastMousePosition;

多点触控输入
79

//! 返回调整多点触控手势起始容差的比例因子;默认为1.0。
//! 该比例因子预期从触摸屏分辨率计算得出。
float TouchToleranceScale() const { return myTouchToleranceScale; }

//! 设置调整多点触控手势起始容差的比例因子。
void SetTouchToleranceScale(float theTolerance) { myTouchToleranceScale = theTolerance; }

80

//! 添加具有给定ID的触摸点。
//! 预期该方法从UI线程调用。
//! @param theId 触摸唯一标识符
//! @param thePnt 触摸坐标
//! @param theClearBefore 如果为TRUE,则会清除之前注册的触摸点
Standard_EXPORT virtual void AddTouchPoint(Standard_Size theId,
const Graphic3d_Vec2d& thePnt,
Standard_Boolean theClearBefore = false) Standard_OVERRIDE;

81

//! 移除具有给定ID的触摸点。
//! 预期该方法从UI线程调用。
//! @param theId 触摸唯一标识符
//! @param theClearSelectPnts 如果为TRUE,则将启动清除选择点
//! @return 如果点已被移除则返回TRUE
Standard_EXPORT virtual bool RemoveTouchPoint(Standard_Size theId,
Standard_Boolean theClearSelectPnts = false) Standard_OVERRIDE;

82

//! 更新具有给定ID的触摸点。
//! 如果之前未注册具有指定ID的点,则会将其添加。
//! 预期该方法从UI线程调用。
//! @param theId 触摸唯一标识符
//! @param thePnt 触摸坐标
Standard_EXPORT virtual void UpdateTouchPoint(Standard_Size theId,
const Graphic3d_Vec2d& thePnt) Standard_OVERRIDE;

using Aspect_WindowInputListener::HasTouchPoints;

3D鼠标输入
83

//! 处理3D鼠标输入事件(重定向到平移、旋转和键)。
Standard_EXPORT virtual bool Update3dMouse(const WNT_HIDSpaceMouse& theEvent) Standard_OVERRIDE;

调整大小事件
84

//! 处理暴露事件(窗口内容已失效并应重绘)。
//! 默认实现不执行任何操作。
virtual void ProcessExpose() Standard_OVERRIDE {}

85

//! 处理窗口调整大小事件。
//! 默认实现不执行任何操作。
virtual void ProcessConfigure(bool theIsResized) Standard_OVERRIDE
{
(void)theIsResized;
}

86

//! 处理窗口输入事件立即。
//! 默认实现不执行任何操作 - 输入事件累积在内部缓冲区中,直到显式调用FlushViewEvents()为止。
virtual void ProcessInput() Standard_OVERRIDE {}

87

//! 处理焦点事件。
//! 默认实现重置缓存的输入状态(按下的按键)。
virtual void ProcessFocus(bool theIsActivated) Standard_OVERRIDE
{
if (!theIsActivated)
{
ResetViewInput();
}
}

88

//! 处理窗口关闭事件。
//! 默认实现不执行任何操作。
virtual void ProcessClose() Standard_OVERRIDE {}
public:

using Aspect_WindowInputListener::EventTime;

89

//! 重置输入状态(按下的按键、鼠标按钮等),例如在窗口失去焦点时调用。
//! 预期该方法从UI线程调用。
Standard_EXPORT virtual void ResetViewInput();

90

//! 重置视图方向。
//! 预期该方法从UI线程调用。
Standard_EXPORT virtual void UpdateViewOrientation(V3d_TypeOfOrientation theOrientation,
bool theToFitAll);

91

//! 更新用于渲染线程的缓冲区。
//! 预期在GUI线程和渲染线程之间的同步屏障中调用(例如,应先锁定GUI线程以避免数据竞争)。
//! @param theCtx 交互上下文
//! @param theView 激活的视图
//! @param theToHandle 如果为TRUE,则调用HandleViewEvents()
Standard_EXPORT virtual void FlushViewEvents(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
Standard_Boolean theToHandle = Standard_False);

92

//! 在渲染线程内处理事件。
Standard_EXPORT virtual void HandleViewEvents(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

93

//! 3D视图中选择发生变化时handleMoveTo()回调。
//! 预期从渲染线程调用。
Standard_EXPORT virtual void OnSelectionChanged(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

94

//! 在3D视图中拖动对象时handleMoveTo()回调。
//! 预期从渲染线程调用。
Standard_EXPORT virtual void OnObjectDragged(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
AIS_DragAction theAction);

95

//! 在HandleViewEvents()中选择另一个(子)视图时回调。
//! 预期从渲染线程调用。
Standard_EXPORT virtual void OnSubviewChanged(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theOldView,
const Handle(V3d_View)& theNewView);

96

//! 在鼠标光标下选择最近的点。
//! 预期从渲染线程调用。
//! @param thePnt [out] 结果点
//! @param theCtx [in] 交互上下文
//! @param theView [in] 激活视图
//! @param theCursor [in] 鼠标光标
//! @param theToStickToPickRay [in] 当为TRUE时,结果点将位于拾取射线上
//! @return 如果找到结果则返回TRUE
Standard_EXPORT virtual bool PickPoint(gp_Pnt& thePnt,
const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const Graphic3d_Vec2i& theCursor,
bool theToStickToPickRay);

97

//! 根据轴选择最近的点。
//! 预期从渲染线程调用。
//! @param theTopPnt [out] 结果点
//! @param theCtx [in] 交互上下文
//! @param theView [in] 激活视图
//! @param theAxis [in] 选择轴
//! @return 如果找到结果则返回TRUE
Standard_EXPORT virtual bool PickAxis(gp_Pnt& theTopPnt,
const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const gp_Ax1& theAxis);

98

//! 根据旋转模式计算旋转重心点。
//! 预期从渲染线程调用。
Standard_EXPORT virtual gp_Pnt GravityPoint(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

99

//! 修改视图相机以适合所有对象。
//! 默认实现交替适合所有可见和所有选定的对象(每次调用都会交换)。
Standard_EXPORT virtual void FitAllAuto(const Handle(AIS_InteractiveContext)& theCtx,
//! 处理定义新相机方向的热键(例如 Aspect_VKey_ViewTop 和类似键)。
//! 默认实现在按下特定动作键时从当前相机方向开始到目标相机方向的动画事务。
//! 预期从渲染线程调用。
Standard_EXPORT virtual void handleViewOrientationKeys(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

100

//! 执行导航操作(例如 Aspect_VKey_NavForward 和类似键)。
//! 预期从渲染线程调用。
Standard_EXPORT virtual AIS_WalkDelta handleNavigationKeys(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

101

//! 在手势进度中执行即时相机操作(旋转/缩放/平移)。
//! 预期从渲染线程调用。
Standard_EXPORT virtual void handleCameraActions(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const AIS_WalkDelta& theWalk);

102

//! 执行moveTo/选择/拖动。
//! 预期从渲染线程调用。
Standard_EXPORT virtual void handleMoveTo(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

103

//! 如果希望在此帧后绘制另一帧,则返回TRUE。
bool toAskNextFrame() const { return myToAskNextFrame; }

104

//! 设置是否在此帧后绘制另一帧。
void setAskNextFrame(bool theToDraw = true) { myToAskNextFrame = theToDraw; }

105

//! 如果定义了平移锚点,则返回TRUE。
bool hasPanningAnchorPoint() const { return !Precision::IsInfinite(myPanPnt3d.X()); }

107

//! 返回活动的平移锚点。
const gp_Pnt& panningAnchorPoint() const { return myPanPnt3d; }

108

//! 设置活动的平移锚点。
void setPanningAnchorPoint(const gp_Pnt& thePnt) { myPanPnt3d = thePnt; }

109

//! 处理平移事件 myGL.Panning。
Standard_EXPORT virtual void handlePanning(const Handle(V3d_View)& theView);

110

//! 处理Z轴旋转事件 myGL.ZRotate。
Standard_EXPORT virtual void handleZRotate(const Handle(V3d_View)& theView);

111

//! 返回用于缩放操作的最小相机距离。
double MinZoomDistance() const { return myMinCamDistance; }

112

//! 设置用于缩放操作的最小相机距离。
void SetMinZoomDistance(double theDist) { myMinCamDistance = theDist; }

113

//! 处理缩放事件 myGL.ZoomActions。
//! 预期从渲染线程调用。
Standard_EXPORT virtual void handleZoom(const Handle(V3d_View)& theView,
const Aspect_ScrollDelta& theParams,
const gp_Pnt* thePnt);

114

//! 处理Z轴滚动事件 myGL.ZoomActions。
//! 预期从渲染线程调用。
Standard_EXPORT virtual void handleZFocusScroll(const Handle(V3d_View)& theView,
const Aspect_ScrollDelta& theParams);

115

//! 处理轨道旋转事件 myGL.OrbitRotation。
//! @param theView 要修改的视图
//! @param thePnt 围绕旋转的3D点
//! @param theToLockZUp 修改相机以排除滚动角度(将相机上向量放置在包含全局Z和视图方向的平面上)
Standard_EXPORT virtual void handleOrbitRotation(const Handle(V3d_View)& theView,
const gp_Pnt& thePnt,
bool theToLockZUp);

116

//! 处理视图方向旋转事件 myGL.ViewRotation。
//! 预期从渲染线程调用。
//! @param theView 要修改的相机
//! @param theYawExtra 额外的偏航增量
//! @param thePitchExtra 额外的俯仰增量
//! @param theRoll 滚动值
//! @param theToRestartOnIncrement 表示飞行模式的标志
Standard_EXPORT virtual void handleViewRotation(const Handle(V3d_View)& theView,
double theYawExtra,
double thePitchExtra,
double theRoll,
bool theToRestartOnIncrement);

117

//! 处理视图重绘。
//! 预期从渲染线程调用。
Standard_EXPORT virtual void handleViewRedraw(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

118

//! 执行XR输入。
//! 预期从渲染线程调用。
Standard_EXPORT virtual void handleXRInput(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const AIS_WalkDelta& theWalk);

119

//! 处理触控板视图旋转操作。
Standard_EXPORT virtual void handleXRTurnPad(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

120

//! 处理触控板传送动作。
Standard_EXPORT virtual void handleXRTeleport(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

121

//! 处理扳机点击选取。
Standard_EXPORT virtual void handleXRPicking(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

122

//! 为活动手指执行动态高亮显示。
Standard_EXPORT virtual void handleXRHighlight(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

123

//! 显示辅助XR演示。
Standard_EXPORT virtual void handleXRPresentations(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

124

//! 使用/不使用XR姿态执行选取和动态高亮显示。
Standard_EXPORT virtual Standard_Integer handleXRMoveTo(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const gp_Trsf& thePose,
const Standard_Boolean theToHighlight);

protected

//! 刷新缓冲区。
Standard_EXPORT virtual void flushBuffers(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

//! 刷新触摸手势。
Standard_EXPORT virtual void flushGestures(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

//! 返回当前和先前获取的事件时间。
//! 此回调用于计算连续处理事件之间的时间差。
//! @param thePrevTime [out] 先前由该方法获取的事件时间
//! @param theCurrTime [out] 当前事件时间
void updateEventsTime(double& thePrevTime,
double& theCurrTime)
{
thePrevTime = myLastEventsTime;
myLastEventsTime = EventTime();
theCurrTime = myLastEventsTime;
}

//! 执行鼠标点击选择。
//! 预期从渲染线程调用。
Standard_EXPORT virtual void handleSelectionPick(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

//! 在鼠标移动时执行动态高亮显示。
//! 预期从渲染线程调用。
Standard_EXPORT virtual void handleDynamicHighlight(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

//! 执行橡皮筋选择。
//! 预期从渲染线程调用。
Standard_EXPORT virtual void handleSelectionPoly(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);

//! 延迟AIS_InteractiveContext::MoveTo(),检查myPrevMoveTo。
Standard_EXPORT virtual void contextLazyMoveTo(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const Graphic3d_Vec2i& thePnt);

protected:

AIS_ViewInputBuffer myUI; //!< UI线程缓冲区
AIS_ViewInputBuffer myGL; //!< 渲染线程缓冲区

Standard_Real myLastEventsTime; //!< 计算增量和进度的最后获取的事件计时器值
Standard_Boolean myToAskNextFrame; //!< 表示在此帧后应绘制另一帧的标志
Standard_Boolean myIsContinuousRedraw; //!< 连续重绘(没有立即渲染优化)

Standard_Real myMinCamDistance; //!< 缩放操作的最小相机距离
AIS_RotationMode myRotationMode; //!< 旋转模式
AIS_NavigationMode myNavigationMode; //!< 导航模式(轨道旋转 / 第一人称)
Standard_ShortReal myMouseAccel; //!< 第一人称模式下的鼠标输入加速比率
Standard_ShortReal myOrbitAccel; //!< 轨道旋转加速比率
Standard_Boolean myToShowPanAnchorPoint; //!< 显示平移锚点选项
Standard_Boolean myToShowRotateCenter; //!< 显示旋转中心点选项
Standard_Boolean myToLockOrbitZUp; //!< 在AIS_NavigationMode_Orbit旋转模式中强制相机朝上方向
Standard_Boolean myToInvertPitch; //!< 处理Aspect_VKey_NavLookUp/Aspect_VKey_NavLookDown时反转俯仰方向的标志
Standard_Boolean myToAllowTouchZRotation; //!< 启用双触摸手势的Z轴旋转;默认为FALSE
Standard_Boolean myToAllowRotation; //!< 启用旋转;默认为TRUE
Standard_Boolean myToAllowPanning; //!< 启用平移;默认为TRUE
Standard_Boolean myToAllowZooming; //!< 启用缩放;默认为TRUE
Standard_Boolean myToAllowZFocus; //!< 启用ZFocus更改;默认为TRUE
Standard_Boolean myToAllowHighlight; //!< 在鼠标移动时启用动态高亮显示;默认为TRUE
Standard_Boolean myToAllowDragging; //!< 启用拖动对象;默认为TRUE
Standard_Boolean myToStickToRayOnZoom; //!< 在缩放时将选择的点投射到射线上;默认为TRUE
Standard_Boolean myToStickToRayOnRotation; //!< 在围绕点旋转时将选择的点投射到射线上;默认为TRUE

Standard_ShortReal myWalkSpeedAbsolute; //!< 正常步行速度,单位为m/s;默认为1.5
Standard_ShortReal myWalkSpeedRelative; //!< 相对于场景包围盒的步行速度;默认为0.1
Standard_ShortReal myThrustSpeed; //!< 活动推力值
Standard_Boolean myHasThrust; //!< 指示活动推力的标志

Handle(AIS_AnimationCamera) myViewAnimation; //!< 视图动画
Handle(AIS_Animation) myObjAnimation; //!< 对象动画
Standard_Boolean myToPauseObjAnimation; //!< 暂停鼠标单击时的对象动画的标志;默认为FALSE
Handle(AIS_RubberBand) myRubberBand; //!< 橡皮筋呈现
Handle(SelectMgr_EntityOwner) myDragOwner; //!< 当前拖动对象的检测到的所有者
Handle(AIS_InteractiveObject) myDragObject; //!< 当前拖动对象
Graphic3d_Vec2i myPrevMoveTo; //!< 3D查看器中MoveTo事件的上一个位置
Standard_Boolean myHasHlrOnBeforeRotation; //!< 旋转后恢复计算模式的标志

protected: //! @name XR输入变量

NCollection_Array1<Handle(AIS_XRTrackedDevice)> myXRPrsDevices; //!< XR跟踪设备呈现数组
Quantity_Color myXRLaserTeleColor; //!< 传送激光的颜色
Quantity_Color myXRLaserPickColor; //!< 选择激光的颜色
Aspect_XRTrackedDeviceRole myXRLastTeleportHand;//!< 传送的活动手
Aspect_XRTrackedDeviceRole myXRLastPickingHand; //!< 选择对象的活动手
Aspect_XRHapticActionData myXRTeleportHaptic; //!< 选取传送目标时的震动
Aspect_XRHapticActionData myXRPickingHaptic; //!< 动
参考

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1983199.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Mybatis(Day 18)

数据持久化是将内存中的数据模型转换为存储模型&#xff0c;以及将存储模型转换为内存中数据模型的统称。MyBatis 支持定制化 SQL、存储过程以及高级映射&#xff0c;可以在实体类和 SQL 语句之间建立映射关系&#xff0c;是一种半自动化的 ORM 实现。ORM&#xff08;Object Re…

系统运维——PXE自动安装系统

摘要 PXE&#xff08;Preboot Execution Environment&#xff0c;预启动执行环境&#xff09;是一种允许计算机通过网络启动操作系统而无需本地存储设备的技术。本文详细介绍了 PXE 的定义、架构、原理、应用场景及常见命令体系。以 RedHat7 为例&#xff0c;展示如何配置和使…

Tooltip 文字提示

在偶然维护前端开发时&#xff0c;遇到页面列表中某个字段内容太长&#xff0c;且该字段使用了组件显示&#xff0c;导致不能使用纯文本得那个省略号代替显示得css样式效果&#xff0c;如下 所以只能另辟溪路了&#xff0c; 1、最开始想到是使用横向滚动得效果来实现&#xff…

【Vue3】Pinia存储及读取数据

【Vue3】Pinia存储及读取数据 背景简介开发环境开发步骤及源码 背景 随着年龄的增长&#xff0c;很多曾经烂熟于心的技术原理已被岁月摩擦得愈发模糊起来&#xff0c;技术出身的人总是很难放下一些执念&#xff0c;遂将这些知识整理成文&#xff0c;以纪念曾经努力学习奋斗的日…

如何用OceanBase与DataWorks,打造一站式的数据集成、开发和数据服务

导语&#xff1a;在OceanBase 2024年开发者大会的技术生态论坛上&#xff0c;阿里云DataWorks团队的高级技术专家罗海伟&#xff0c;详细阐述了一站式大数据开发治理平台DataWorks的能力&#xff0c;并对于如何基于OceanBase和Dataworks构建一站式数据集成、开发以及数据服务进…

解锁模数学习新境界:电路仿真软件,你的数字与模拟世界桥梁大师!

在这个科技日新月异的时代&#xff0c;模数转换&#xff08;A/D与D/A&#xff09;不仅是电子工程师的必修课&#xff0c;也是众多科技爱好者探索数字与模拟世界奥秘的钥匙。而今&#xff0c;一款强大的电路仿真软件&#xff0c;正悄然成为连接这两大领域的魔法棒&#xff0c;让…

Animate软件基础:各种类型文件使用说明

FlashASer&#xff1a;AdobeAnimate2021软件零基础入门教程https://zhuanlan.zhihu.com/p/633230084 FlashASer&#xff1a;实用的各种Adobe Animate软件教程https://zhuanlan.zhihu.com/p/675680471 FlashASer&#xff1a;Animate教程及作品源文件https://zhuanlan.zhihu.co…

ps绘制动图

ps绘制动图教程&#xff08;简易版&#xff09;-直播gif动态效果图 第一步 打开ps绘制几个简单的长方形 第二步 将图层转化为智能图层 第三部 在窗口找到时间轴创建时间轴 第五步 通过变换来鼠标控制图像的变化并打下结束点 第六部 通过图像中的图像大小控制gif的大小 第七部 …

低代码: 系统开发准备之确定一般开发流程,需求分析,复杂度分析,标准开发流程

概述 低代码系统开发之前&#xff0c;我们首先要进行一些准备我们首先知道我们软件开发的一般流程同时&#xff0c;我们还要知道&#xff0c;我们整个系统平台的需求如何之后&#xff0c;我们要基于需求进行设计&#xff0c;包含UI设计与系统架构设计 一般开发流程 系统开发…

2024年【北京市安全员-B证】考试题库及北京市安全员-B证考试技巧

题库来源&#xff1a;安全生产模拟考试一点通公众号小程序 北京市安全员-B证考试题库根据新北京市安全员-B证考试大纲要求&#xff0c;安全生产模拟考试一点通将北京市安全员-B证模拟考试试题进行汇编&#xff0c;组成一套北京市安全员-B证全真模拟考试试题&#xff0c;学员可…

拉削基础知识——拉床的类型及特点

拉床是所有机械加工工具中最简单的一种&#xff0c;由拉削工具、夹具、驱动装置和支撑架组成。拉削加工可获得较高的尺寸精度和较小的表面粗糙度&#xff0c;生产率较高&#xff0c;适用于大批量生产。拉床按其结构主要分为卧式和立式。应用领域和功能可分为液压拉床、自动拉床…

【香菇带你学Mysql】Mysql数据库主备搭建【建议收藏】

文章目录 1. 概述1.1 为什么要搭建主备架构数据库&#xff1f;1.2 常见的Mysql数据库主备架构 2. Mysql 数据库主备搭建原理3. Mysql数据库主备搭建实操3.1 环境准备3.2 主库操作3.3 从库操作3.4 主从同步验证 4. 总结5. 参考文档 大家可能听过一个段子&#xff0c;当电脑遇到问…

java 关键字

Java的关键字是语言中保留的标识符&#xff0c;它们具有特定的含义和用途&#xff0c;并且不能用作变量名、方法名或类名等。Java 17&#xff08;最新的LTS版本之一&#xff09;中有53个关键字。 下面是每个关键字的含义及其实例 1. 控制结构关键字 这些关键字用于控制程序流…

第十六节、实装攻击判定

一、实现原理 人物三段式攻击的剑气增加一帧伤害即可 二、步骤 创建玩家下面的子物体 1、多边形碰撞体 给第一段攻击添加多边形碰撞体 2、帧触发 在这一帧添加动画&#xff0c;是触发器由失活状态转为使用状态 在这一帧勾选物体状态 3、计算攻击伤害 每一个挂载代码&…

大型语言模型微调的规模效应研究

人工智能咨询培训老师叶梓 转载标明出处 为了解锁大模型在特定下游应用中的全部潜力&#xff0c;通常需要通过微调&#xff08;finetuning&#xff09;来适配任务。尽管微调已成为一种常规做法&#xff0c;但关于不同微调方法的归纳偏差&#xff0c;尤其是规模特性的理解仍然有…

CRC16循环冗余校验

代码&#xff1a; #include<stdio.h> #include <stdint.h>#define uchar unsigned char #define uint unsigned int static const uint8_t auchCRCHi[] { 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x0…

33.x86游戏实战-喊话CALL

免责声明&#xff1a;内容仅供学习参考&#xff0c;请合法利用知识&#xff0c;禁止进行违法犯罪活动&#xff01; 本次游戏没法给 内容参考于&#xff1a;微尘网络安全 工具下载&#xff1a; 链接&#xff1a;https://pan.baidu.com/s/1rEEJnt85npn7N38Ai0_F2Q?pwd6tw3 提…

CTFHUB—XSS—DOM反射

开启题目 输入以下语句测试一下&#xff0c;发现页面没有弹出窗口显示“flag” <script>alert("flag")</script> 查看页面源代码&#xff0c; 尝试闭合标签 使用下面代码闭合&#xff0c;然后发现闭合成功了 </script><script>alert("…

【Python机器学习】利用AdaBoost元算法提高分类性能——基于AdaBoost的分类

一旦拥有了多个弱分类以及其对应的alpha值&#xff0c;进行测试就变得非常容易了。现在&#xff0c;要将弱分类器的训练过程从程序中抽出来&#xff0c;然后应用在某个具体的实例上。每个弱分类器的结果以其对应的alpha值作为权重。所有这些弱分类器的结果加权求和就得到了最后…

ElementUI元件库在Axure中使用

一、ElementUI元件库介绍 ElementUI 是一套为开发者、UI/UX设计师和产品经理准备的基于Vue 2.0的桌面端组件库。它以其优雅的设计和丰富的组件&#xff0c;极大地提升了Web应用的开发效率与用户体验。ElementUI的组件设计精致且符合现代UI规范&#xff0c;包括按钮、表单、弹窗…