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和渲染线程之间处理视图器事件的辅助结构。 该类实现了以下功能: 缓存存储用户输入状态(鼠标、触摸和键盘)。 将鼠标/多点触控输入映射到视图相机操作(平移、旋转、缩放࿰…...

拉削基础知识——拉床的类型及特点
拉床是所有机械加工工具中最简单的一种,由拉削工具、夹具、驱动装置和支撑架组成。拉削加工可获得较高的尺寸精度和较小的表面粗糙度,生产率较高,适用于大批量生产。拉床按其结构主要分为卧式和立式。应用领域和功能可分为液压拉床、自动拉床…...
docker-compose笔记
docker 目前docker官网已经无法登录,但是还可以从清华镜像站(https://mirrors.tuna.tsinghua.edu.cn/docker-ce/)下载。 使用方法可以参考早期文章《docker笔记》 docker-compose 可以从Github下载不同版本的二进制文件,例如do…...

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

avl树自实现(带图),探讨平衡因子与旋转
引子: 在此之前,我们学过了搜索二叉树,这种树,在如果数据有序或接近有序的情况下,二叉搜索树将退化为单支树,查找元素相当于在顺序表中搜索元素,效率低下,而且普通搜索二叉树无法有…...

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

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

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

华为续签了,但我准备离职了
离职华为 今天在牛客网看到一篇帖子,名为《华为续签了,但我准备离职了》。 讲得挺真诚,可能也是一类毕业进华为的同学的心声。 贴主提到,当年自己还是应届毕业的时候,手握多个 offer,最终选的华为ÿ…...
RocketMQ 的认证与授权机制
Apache RocketMQ 是一个高性能、高吞吐量、分布式的消息中间件,广泛应用于异步通信、应用解耦、流量削峰等场景。在企业级应用中,消息安全尤为重要,本文将深入探讨 RocketMQ 的认证与授权机制,帮助开发者和系统管理员更好地理解和…...

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

CRC16循环冗余校验
代码: #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.配置一个提供复制的账号; 创建用户 CREATE USER replication% IDENTIFIED BY your_password; GRANT REPLICATION SLAVE ON *.* TO replication%; FLUSH PRIVILEGES;2.修改配置 选择模式 主库配置; windows的得话是my.ini文件 默认这个目…...
Yarn网络代理配置指南:在受限网络环境中优化依赖管理
Yarn是一个现代的包管理器,用于JavaScript项目,它提供了快速、可靠和安全的依赖管理方式。然而,在某些受限的网络环境中,例如公司内网或某些国家地区,直接连接到公共npm仓库可能不可行或效率低下。这时,配置…...

AOE网及其求解关键路径
全称 Activity on Edge Network 边活动网 特点 仅存在 有向无环图 作用 用于记录完成整个工程至少花费的时间 > 哪条路径最耗时?也就是“ 关键路径 ” AOE网元素介绍 关键活动 关键路径上的活动称为关键活动 , 关键活动是不允许拖延的&#x…...
【FPGA】modelsim编译verilog代码产生错误集合
错误1: LHS in procedural continuous assignment may not be a net 可能是一些变量不能放在一些begin和end中,改下assign的位置 新手求助 LHS in procedural continuous assignment may not be a net - 数字IC设计讨论(IC前端|FPGA|ASIC) - EETOP 创…...

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

Unity UnityWebRequest封装类
简化api调用流程,非常奈斯。 RestWebClient.cs using System; using System.Collections; using UnityEngine; using UnityEngine.Networking;namespace MYTOOL.RestClient {/// <summary>/// UnityWebRequest封装类/// </summary>public class RestW…...
JVM内存划分
Java虚拟机(JVM)的内存划分是指JVM在运行时所使用的内存区域的组织和管理方式。JVM内存主要分为以下几个区域: 堆区(Heap): 用途:用于存储所有对象实例和数组,是JVM中最大的一块内存…...
c++ 全排列
在C中,全排列(permutation)可以使用递归算法或标准库函数来实现。以下是使用递归和STL库std::next_permutation来生成一个集合的全排列的两种方法。 方法一:递归算法 递归方法通过交换元素来生成所有可能的排列组合。 #include…...

国防科技大学计算机基础课程笔记02信息编码
1.机内码和国标码 国标码就是我们非常熟悉的这个GB2312,但是因为都是16进制,因此这个了16进制的数据既可以翻译成为这个机器码,也可以翻译成为这个国标码,所以这个时候很容易会出现这个歧义的情况; 因此,我们的这个国…...

大数据学习栈记——Neo4j的安装与使用
本文介绍图数据库Neofj的安装与使用,操作系统:Ubuntu24.04,Neofj版本:2025.04.0。 Apt安装 Neofj可以进行官网安装:Neo4j Deployment Center - Graph Database & Analytics 我这里安装是添加软件源的方法 最新版…...
Ubuntu系统下交叉编译openssl
一、参考资料 OpenSSL&&libcurl库的交叉编译 - hesetone - 博客园 二、准备工作 1. 编译环境 宿主机:Ubuntu 20.04.6 LTSHost:ARM32位交叉编译器:arm-linux-gnueabihf-gcc-11.1.0 2. 设置交叉编译工具链 在交叉编译之前&#x…...

Zustand 状态管理库:极简而强大的解决方案
Zustand 是一个轻量级、快速和可扩展的状态管理库,特别适合 React 应用。它以简洁的 API 和高效的性能解决了 Redux 等状态管理方案中的繁琐问题。 核心优势对比 基本使用指南 1. 创建 Store // store.js import create from zustandconst useStore create((set)…...

家政维修平台实战20:权限设计
目录 1 获取工人信息2 搭建工人入口3 权限判断总结 目前我们已经搭建好了基础的用户体系,主要是分成几个表,用户表我们是记录用户的基础信息,包括手机、昵称、头像。而工人和员工各有各的表。那么就有一个问题,不同的角色…...
工业自动化时代的精准装配革新:迁移科技3D视觉系统如何重塑机器人定位装配
AI3D视觉的工业赋能者 迁移科技成立于2017年,作为行业领先的3D工业相机及视觉系统供应商,累计完成数亿元融资。其核心技术覆盖硬件设计、算法优化及软件集成,通过稳定、易用、高回报的AI3D视觉系统,为汽车、新能源、金属制造等行…...

基于Springboot+Vue的办公管理系统
角色: 管理员、员工 技术: 后端: SpringBoot, Vue2, MySQL, Mybatis-Plus 前端: Vue2, Element-UI, Axios, Echarts, Vue-Router 核心功能: 该办公管理系统是一个综合性的企业内部管理平台,旨在提升企业运营效率和员工管理水…...
【Android】Android 开发 ADB 常用指令
查看当前连接的设备 adb devices 连接设备 adb connect 设备IP 断开已连接的设备 adb disconnect 设备IP 安装应用 adb install 安装包的路径 卸载应用 adb uninstall 应用包名 查看已安装的应用包名 adb shell pm list packages 查看已安装的第三方应用包名 adb shell pm list…...

[ACTF2020 新生赛]Include 1(php://filter伪协议)
题目 做法 启动靶机,点进去 点进去 查看URL,有 ?fileflag.php说明存在文件包含,原理是php://filter 协议 当它与包含函数结合时,php://filter流会被当作php文件执行。 用php://filter加编码,能让PHP把文件内容…...

【 java 虚拟机知识 第一篇 】
目录 1.内存模型 1.1.JVM内存模型的介绍 1.2.堆和栈的区别 1.3.栈的存储细节 1.4.堆的部分 1.5.程序计数器的作用 1.6.方法区的内容 1.7.字符串池 1.8.引用类型 1.9.内存泄漏与内存溢出 1.10.会出现内存溢出的结构 1.内存模型 1.1.JVM内存模型的介绍 内存模型主要分…...