ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cvPointPickingHelper Class Reference

cvPointPickingHelper is a helper class for supporting keyboard shortcut-based point picking in measurement tools. More...

#include <cvPointPickingHelper.h>

Inheritance diagram for cvPointPickingHelper:
Collaboration diagram for cvPointPickingHelper:

Public Types

enum  PickOption { Coordinates , Normal , CoordinatesAndNormal }
 

Signals

void pick (double x, double y, double z)
 Emitted when a point is picked. More...
 
void pickNormal (double px, double py, double pz, double nx, double ny, double nz)
 Emitted when a point and normal are picked. More...
 

Public Member Functions

 cvPointPickingHelper (const QKeySequence &keySequence, bool pickOnPoint, QWidget *parent=nullptr, PickOption pickOpt=Coordinates)
 Constructor. More...
 
 ~cvPointPickingHelper () override
 
bool pickOnPoint () const
 Returns whether picking snaps to mesh points. More...
 
PickOption getPickOption () const
 Returns the pick option. More...
 
void setInteractor (vtkRenderWindowInteractor *interactor)
 Set the VTK interactor for picking. More...
 
void setRenderer (vtkRenderer *renderer)
 Set the VTK renderer for picking. More...
 
void setContextWidget (QWidget *widget)
 Set the context widget for the shortcut. More...
 
void setEnabled (bool enabled, bool setFocus=false)
 Enable or disable the shortcut. More...
 
bool isEnabled () const
 Check if shortcut is enabled. More...
 
void clearSelectionCache ()
 Clear the selection cache (ParaView-style optimization) Call this when the scene changes to invalidate cached picks. More...
 

Detailed Description

cvPointPickingHelper is a helper class for supporting keyboard shortcut-based point picking in measurement tools.

This class is inspired by ParaView's pqPointPickingHelper and provides keyboard shortcuts for picking points on mesh surfaces.

Usage:

  • '1' / 'Ctrl+1': Pick Point 1 (surface / snap to mesh point)
  • '2' / 'Ctrl+2': Pick Point 2 (surface / snap to mesh point)
  • 'C' / 'Ctrl+C': Pick Center point (for angle tools, surface / snap)
  • 'P' / 'Ctrl+P': Pick alternating points (surface / snap to mesh point)
  • 'N': Pick point and set normal direction

Definition at line 43 of file cvPointPickingHelper.h.

Member Enumeration Documentation

◆ PickOption

Enumerator
Coordinates 

Pick point coordinates only.

Normal 

Pick normal only.

CoordinatesAndNormal 

Pick both coordinates and normal.

Definition at line 47 of file cvPointPickingHelper.h.

Constructor & Destructor Documentation

◆ cvPointPickingHelper()

cvPointPickingHelper::cvPointPickingHelper ( const QKeySequence &  keySequence,
bool  pickOnPoint,
QWidget *  parent = nullptr,
PickOption  pickOpt = Coordinates 
)

Constructor.

Parameters
keySequenceThe keyboard shortcut to trigger picking
pickOnPointIf true, snap to the closest mesh point; otherwise pick on surface
parentParent widget that receives the shortcut
pickOptWhat to pick (coordinates, normal, or both)

Definition at line 47 of file cvPointPickingHelper.cpp.

References ecvModalShortcut::activated(), ecvKeySequences::addModalShortcut(), ecvKeySequences::instance(), CVLog::PrintDebug(), and CVLog::Warning().

◆ ~cvPointPickingHelper()

cvPointPickingHelper::~cvPointPickingHelper ( )
override

Definition at line 91 of file cvPointPickingHelper.cpp.

Member Function Documentation

◆ clearSelectionCache()

void cvPointPickingHelper::clearSelectionCache ( )

Clear the selection cache (ParaView-style optimization) Call this when the scene changes to invalidate cached picks.

Definition at line 559 of file cvPointPickingHelper.cpp.

◆ getPickOption()

PickOption cvPointPickingHelper::getPickOption ( ) const
inline

Returns the pick option.

Definition at line 75 of file cvPointPickingHelper.h.

◆ isEnabled()

bool cvPointPickingHelper::isEnabled ( ) const

Check if shortcut is enabled.

Definition at line 139 of file cvPointPickingHelper.cpp.

◆ pick

void cvPointPickingHelper::pick ( double  x,
double  y,
double  z 
)
signal

Emitted when a point is picked.

Parameters
xX coordinate
yY coordinate
zZ coordinate

Referenced by cvDistanceTool::setupPointPickingShortcuts(), and cvProtractorTool::setupPointPickingShortcuts().

◆ pickNormal

void cvPointPickingHelper::pickNormal ( double  px,
double  py,
double  pz,
double  nx,
double  ny,
double  nz 
)
signal

Emitted when a point and normal are picked.

Parameters
pxPoint X coordinate
pyPoint Y coordinate
pzPoint Z coordinate
nxNormal X component
nyNormal Y component
nzNormal Z component

Referenced by cvDistanceTool::setupPointPickingShortcuts().

◆ pickOnPoint()

bool cvPointPickingHelper::pickOnPoint ( ) const
inline

Returns whether picking snaps to mesh points.

Definition at line 70 of file cvPointPickingHelper.h.

◆ setContextWidget()

void cvPointPickingHelper::setContextWidget ( QWidget *  widget)

Set the context widget for the shortcut.

Definition at line 109 of file cvPointPickingHelper.cpp.

Referenced by cvDistanceTool::setupPointPickingShortcuts(), and cvProtractorTool::setupPointPickingShortcuts().

◆ setEnabled()

void cvPointPickingHelper::setEnabled ( bool  enabled,
bool  setFocus = false 
)

Enable or disable the shortcut.

Parameters
enabledWhether to enable the shortcut
setFocusIf true and enabling, set focus to the shortcut's parent widget

Definition at line 129 of file cvPointPickingHelper.cpp.

◆ setInteractor()

void cvPointPickingHelper::setInteractor ( vtkRenderWindowInteractor *  interactor)

Set the VTK interactor for picking.

Definition at line 98 of file cvPointPickingHelper.cpp.

Referenced by cvDistanceTool::setupPointPickingShortcuts(), and cvProtractorTool::setupPointPickingShortcuts().

◆ setRenderer()

void cvPointPickingHelper::setRenderer ( vtkRenderer *  renderer)

Set the VTK renderer for picking.

Definition at line 104 of file cvPointPickingHelper.cpp.

Referenced by cvDistanceTool::setupPointPickingShortcuts(), and cvProtractorTool::setupPointPickingShortcuts().


The documentation for this class was generated from the following files: