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:
Collaboration diagram for cvConstrainedPolyLineWidget:

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 cvConstrainedPolyLineWidgetNew ()
 

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

Definition at line 30 of file cvConstrainedPolyLineWidget.h.

Constructor & Destructor Documentation

◆ cvConstrainedPolyLineWidget()

cvConstrainedPolyLineWidget::cvConstrainedPolyLineWidget ( )
protected

Definition at line 21 of file cvConstrainedPolyLineWidget.cpp.

◆ ~cvConstrainedPolyLineWidget()

cvConstrainedPolyLineWidget::~cvConstrainedPolyLineWidget ( )
overrideprotected

Definition at line 28 of file cvConstrainedPolyLineWidget.cpp.

References KeyEventCallbackCommand.

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

Definition at line 111 of file cvConstrainedPolyLineWidget.cpp.

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

Definition at line 49 of file cvConstrainedPolyLineWidget.cpp.

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

Definition at line 43 of file cvConstrainedPolyLineWidget.cpp.

◆ vtkTypeMacro()

cvConstrainedPolyLineWidget::vtkTypeMacro ( cvConstrainedPolyLineWidget  ,
vtkPolyLineWidget   
)

Member Data Documentation

◆ KeyEventCallbackCommand

vtkCallbackCommand* cvConstrainedPolyLineWidget::KeyEventCallbackCommand
protected

Definition at line 74 of file cvConstrainedPolyLineWidget.h.

Referenced by SetEnabled(), and ~cvConstrainedPolyLineWidget().


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