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

PolyLine Widget with XYZ constraints (100% consistent with ParaView) More...

#include <cvConstrainedPolyLineWidget.h>

Inheritance diagram for cvConstrainedPolyLineWidget:
[legend]
Collaboration diagram for cvConstrainedPolyLineWidget:
[legend]

Public Member Functions

 vtkTypeMacro (cvConstrainedPolyLineWidget, vtkPolyLineWidget)
 
void SetInteractor (vtkRenderWindowInteractor *iren) override
 Override SetInteractor to register keyboard event observers. More...
 
void SetEnabled (int enabling) override
 Override SetEnabled to register our custom keyboard handler. More...
 

Static Public Member Functions

static cvConstrainedPolyLineWidget * New ()
 

Protected Member Functions

 cvConstrainedPolyLineWidget ()
 
 ~cvConstrainedPolyLineWidget () override
 

Static Protected Member Functions

static void ProcessKeyEvents (vtkObject *object, unsigned long event, void *clientdata, void *calldata)
 Keyboard event handling - directly copied from ParaView vtkPolyLineWidget::ProcessKeyEvents. More...
 

Protected Attributes

vtkCallbackCommand * KeyEventCallbackCommand
 

Detailed Description

PolyLine Widget with XYZ constraints (100% consistent with ParaView)

Ported from ParaView vtkPolyLineWidget, supports keyboard constraints:

  • X: Constrain to X-axis
  • Y: Constrain to Y-axis
  • Z: Constrain to Z-axis

Note: This widget is used for angle measurement (3 handles: point1, center, point2)

Releasing the key automatically removes the constraint.

Note
100% replication of ParaView vtkPolyLineWidget ProcessKeyEvents

Constructor & Destructor Documentation

◆ cvConstrainedPolyLineWidget()

cvConstrainedPolyLineWidget::cvConstrainedPolyLineWidget ( )
protected

◆ ~cvConstrainedPolyLineWidget()

cvConstrainedPolyLineWidget::~cvConstrainedPolyLineWidget ( )
overrideprotected

Member Function Documentation

◆ New()

static cvConstrainedPolyLineWidget* cvConstrainedPolyLineWidget::New ( )
static

◆ ProcessKeyEvents()

void cvConstrainedPolyLineWidget::ProcessKeyEvents ( vtkObject *  object,
unsigned long  event,
void *  clientdata,
void *  calldata 
)
staticprotected

Keyboard event handling - directly copied from ParaView vtkPolyLineWidget::ProcessKeyEvents.

This is the core method of the control layer:

  1. Receives keyboard events
  2. Gets the representation
  3. Sets the constraint status on the entire representation

ParaView's implementation (vtkPolyLineWidget.cxx:272-301):

  • X key: Constrain all handles to X-axis
  • Y key: Constrain all handles to Y-axis
  • Z key: Constrain all handles to Z-axis
  • Key release: Remove constraints

References event.

Referenced by SetEnabled().

◆ SetEnabled()

void cvConstrainedPolyLineWidget::SetEnabled ( int  enabling)
override

Override SetEnabled to register our custom keyboard handler.

This is where we replace the parent's KeyEventCallbackCommand with our own

References KeyEventCallbackCommand, and ProcessKeyEvents().

◆ SetInteractor()

void cvConstrainedPolyLineWidget::SetInteractor ( vtkRenderWindowInteractor *  iren)
override

Override SetInteractor to register keyboard event observers.

Following ParaView's pattern from vtkPolyLineWidget::SetEnabled

◆ vtkTypeMacro()

cvConstrainedPolyLineWidget::vtkTypeMacro ( cvConstrainedPolyLineWidget  ,
vtkPolyLineWidget   
)

Member Data Documentation

◆ KeyEventCallbackCommand

vtkCallbackCommand* cvConstrainedPolyLineWidget::KeyEventCallbackCommand
protected

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