当前位置: 首页 > news >正文

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

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; //!< 动
参考

相关文章:

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

opencascade AIS_ViewController 前言 用于在GUI和渲染线程之间处理视图器事件的辅助结构。 该类实现了以下功能&#xff1a; 缓存存储用户输入状态&#xff08;鼠标、触摸和键盘&#xff09;。 将鼠标/多点触控输入映射到视图相机操作&#xff08;平移、旋转、缩放&#xff0…...

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

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

docker-compose笔记

docker 目前docker官网已经无法登录&#xff0c;但是还可以从清华镜像站&#xff08;https://mirrors.tuna.tsinghua.edu.cn/docker-ce/&#xff09;下载。 使用方法可以参考早期文章《docker笔记》 docker-compose 可以从Github下载不同版本的二进制文件&#xff0c;例如do…...

C# 自定义控件无法加载

问题 在做winform开发时自己定义了一个控件&#xff0c;控件在工具箱中显示了&#xff0c;但是拖动到窗体设计器时会提示未能加载工具箱项xxx&#xff0c;将从工具箱中将其删除&#xff0c;如下图所示: 点击确定后&#xff0c;控件会从工具箱中移除。 解决方法 将 生成>…...

avl树自实现(带图),探讨平衡因子与旋转

引子&#xff1a; 在此之前&#xff0c;我们学过了搜索二叉树&#xff0c;这种树&#xff0c;在如果数据有序或接近有序的情况下&#xff0c;二叉搜索树将退化为单支树&#xff0c;查找元素相当于在顺序表中搜索元素&#xff0c;效率低下&#xff0c;而且普通搜索二叉树无法有…...

Elasticsearch 的DSL查询,聚合查询与多维度数据统计

文章目录 搜索聚合高阶概念 搜索 即从一个索引下按照特定的字段或关键词搜索出符合用户预期的一个或者一堆cocument&#xff0c;然后根据文档的相关度得分&#xff0c;在返回的结果集里并根据得分对这些文档进行一定的排序。 聚合 根据业务需求&#xff0c;对文档中的某个或…...

【如何高效处理前端常见问题:策略与实践】

在快速发展的Web开发领域&#xff0c;前端作为用户与应用程序直接交互的界面&#xff0c;其重要性不言而喻。然而&#xff0c;随着技术的不断演进和项目的复杂化&#xff0c;前端开发者在日常工作中难免会遇到各种挑战和问题。本文旨在深入探讨前端开发中常见的问题类型&#x…...

聊聊前端 JavaScript 的扩展运算符 “...“ 的使用场景

前言 在 JavaScript 中&#xff0c;... 被称为 “扩展运算符” 或 “剩余参数运算符”。 扩展运算符是在 ES6&#xff08;ECMAScript 2015&#xff09;中被引入的&#xff0c;目的是为了提高语言的表达能力和代码的可读性。 根据上下文不同&#xff0c;它主要用在数组、对象…...

华为续签了,但我准备离职了

离职华为 今天在牛客网看到一篇帖子&#xff0c;名为《华为续签了&#xff0c;但我准备离职了》。 讲得挺真诚&#xff0c;可能也是一类毕业进华为的同学的心声。 贴主提到&#xff0c;当年自己还是应届毕业的时候&#xff0c;手握多个 offer&#xff0c;最终选的华为&#xff…...

RocketMQ 的认证与授权机制

Apache RocketMQ 是一个高性能、高吞吐量、分布式的消息中间件&#xff0c;广泛应用于异步通信、应用解耦、流量削峰等场景。在企业级应用中&#xff0c;消息安全尤为重要&#xff0c;本文将深入探讨 RocketMQ 的认证与授权机制&#xff0c;帮助开发者和系统管理员更好地理解和…...

【设计模式】六大原则-上

首先什么是设计模式&#xff1f; 相信刚上大学的你和我一样&#xff0c;在学习这门课的时候根本不了解这些设计原则和模式有什么用处&#xff0c;反而不如隔壁的C更有意思&#xff0c;至少还能弹出一个小黑框&#xff0c;给我个hello world。 如何你和我一样也是这么想&#xf…...

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…...

Mysql80主从复制搭建;遇到问题 Slave_IO_Running: Connecting和Slave_SQL_Running以及解决过程

总结主要步骤 1.配置一个提供复制的账号&#xff1b; 创建用户 CREATE USER replication% IDENTIFIED BY your_password; GRANT REPLICATION SLAVE ON *.* TO replication%; FLUSH PRIVILEGES;2.修改配置 选择模式 主库配置&#xff1b; windows的得话是my.ini文件 默认这个目…...

Yarn网络代理配置指南:在受限网络环境中优化依赖管理

Yarn是一个现代的包管理器&#xff0c;用于JavaScript项目&#xff0c;它提供了快速、可靠和安全的依赖管理方式。然而&#xff0c;在某些受限的网络环境中&#xff0c;例如公司内网或某些国家地区&#xff0c;直接连接到公共npm仓库可能不可行或效率低下。这时&#xff0c;配置…...

AOE网及其求解关键路径

全称 Activity on Edge Network 边活动网 特点 仅存在 有向无环图 作用 用于记录完成整个工程至少花费的时间 > 哪条路径最耗时&#xff1f;也就是“ 关键路径 ” AOE网元素介绍 关键活动 关键路径上的活动称为关键活动 &#xff0c; 关键活动是不允许拖延的&#x…...

【FPGA】modelsim编译verilog代码产生错误集合

错误1&#xff1a; LHS in procedural continuous assignment may not be a net 可能是一些变量不能放在一些begin和end中&#xff0c;改下assign的位置 新手求助 LHS in procedural continuous assignment may not be a net - 数字IC设计讨论(IC前端|FPGA|ASIC) - EETOP 创…...

Rabbitmq的持久化机制

我们通过手动应答处理了在消费者出故障消息丢失的情况&#xff0c;但是如何保障当 RabbitMQ 服务停掉以后消息生产者发送过来的消息不丢失。默认情况下 RabbitMQ 退出或由于某种原因崩溃时&#xff0c;它会清空队列和消息&#xff0c;除非告知它不要这样做。确保消息不会丢失可…...

Unity UnityWebRequest封装类

简化api调用流程&#xff0c;非常奈斯。 RestWebClient.cs using System; using System.Collections; using UnityEngine; using UnityEngine.Networking;namespace MYTOOL.RestClient {/// <summary>/// UnityWebRequest封装类/// </summary>public class RestW…...

JVM内存划分

Java虚拟机&#xff08;JVM&#xff09;的内存划分是指JVM在运行时所使用的内存区域的组织和管理方式。JVM内存主要分为以下几个区域&#xff1a; 堆区&#xff08;Heap&#xff09;&#xff1a; 用途&#xff1a;用于存储所有对象实例和数组&#xff0c;是JVM中最大的一块内存…...

c++ 全排列

在C中&#xff0c;全排列&#xff08;permutation&#xff09;可以使用递归算法或标准库函数来实现。以下是使用递归和STL库std::next_permutation来生成一个集合的全排列的两种方法。 方法一&#xff1a;递归算法 递归方法通过交换元素来生成所有可能的排列组合。 #include…...

未授权访问漏洞系列详解⑤!

Kubernetes Api Server未授权访问漏洞 Kubernetes 的服务在正常启动后会开启两个端口:Localhost Port(默认8080)Secure Port(默认6443)。这两个端口都是提供 Api Server 服务的&#xff0c;一个可以直接通过Web 访问&#xff0c;另一个可以通过 kubectl 客户端进行调用。如果运…...

【CONDA】库冲突解决办法

如今&#xff0c;使用PYTHON作为开发语言时&#xff0c;或多或少都会使用到conda。安装Annaconda时一般都会选择在启动终端时进入conda的base环境。该操作&#xff0c;实际上是在~/.bashrc中添加如下脚本&#xff1a; # >>> conda initialize >>> # !! Cont…...

【网络世界】数据链路层

目录 &#x1f308;前言&#x1f308; &#x1f4c1; 初识数据链路层 &#x1f4c2; 概念 &#x1f4c2; 协议格式 &#x1f4c1; MAC地址 &#x1f4c2; 概念 &#x1f4c2; 与IP地址的区别 &#x1f4c1; MTU &#x1f4c2; 对IP协议的影响 &#x1f4c2; 对UDP协议的影响…...

AllReduce通信库;Reduce+LayerNorm+Broadcast 算子;LayerNorm(层归一化)和Broadcast(广播)操作;

目录 AllReduce通信库 一、定义与作用 二、常见AllReduce通信库 三、AllReduce通信算法 四、总结 Reduce+LayerNorm+Broadcast 算子 1. Reduce 算子 2. LayerNorm 算子 3. Broadcast 算子 组合作用 LayerNorm(层归一化)和Broadcast(广播)操作 提出的创新方案解析 优点与潜在…...

2024.8.5 作业

使用有名管道实现&#xff0c;一个进程用于给另一个进程发消息&#xff0c;另一个进程收到消息后&#xff0c;展示到终端上&#xff0c;并且将消息保存到文件上一份 代码&#xff1a; /*******************************************/ 文件名&#xff1a;create.c /********…...

MySQL数据库——数据库的基本操作

目录 三、数据库的基本操作 1.数据库中库的操作 ①创建数据库 ②字符集和校验规则 ③操纵数据库 ④备份与恢复 2.数据库中表的操作 ①创建表 ②查看表 1> 查看表位于的数据库 2>查看所有表 3>查看表中的数据 4>查看创建表的时候的详细信息 ③修改表 …...

SQL数据库语句练习

1、mysql常用的数据类型是_整数&#xff08;int&#xff09;__、_小数&#xff08;decimal&#xff09;__、_字符串&#xff08;varchar&#xff09;__、_日期时间&#xff08;datetime&#xff09;___。 2、mysql的约束有__主键&#xff08;primary key&#xff09;_、_非空&…...

【Python】常用的pdf提取库介绍对比

提取PDF内容的Python库有多种选择&#xff0c;每个库都有其独特的优缺点。以下是一些常用的库以及它们的优缺点和示例代码&#xff1a; pdfplumberPyMuPDF (fitz)PyPDF2PDFMinerCamelot 1. pdfplumber 优点&#xff1a; 易于使用&#xff0c;提供简单直观的API。能提取文本…...

sbatch提交并行作业 运行python程序 指定输入参数从1到100

#!/bin/bash #SBATCH --job-namemy_python_job #SBATCH --outputmy_python_job_%j.out #SBATCH --errormy_python_job_%j.err #SBATCH --ntasks100# 载入所需模块 # module load python/3.8.5# 执行Python脚本并传递任务ID作为参数 for i in {1..100}; dosrun python my_script…...

OD C卷 - 中庸行者

中庸行者 &#xff08;200&#xff09; 给一个m*n的整数矩阵作为地图&#xff0c;矩阵数值为地形的高度&#xff0c;选择图中任意一点作为起点&#xff0c;向左右上下四个方向移动&#xff1a; 只能上坡、下坡&#xff0c;不能走相同高度的点&#xff1b;不允许连续上坡 或者连…...