ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
vtkBoxWidgetAnnotationCallback.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
10 #include <vtkBoxWidget.h>
11 #include <vtkTransform.h>
12 
14  return new vtkBoxWidgetCallback0;
15 }
16 
17 void vtkBoxWidgetCallback0::Execute(vtkObject *caller, unsigned long, void *) {
18  // Here we use the vtkBoxWidget to transform the underlying coneActor
19  // (by manipulating its transformation matrix).
21  vtkBoxWidget *widget = reinterpret_cast<vtkBoxWidget *>(caller);
22 
23  widget->GetTransform(t);
24  if (anno) {
25  // widget->GetProp3D()->SetUserTransform(t);
26  anno->applyTransform(t);
27  }
28 }
29 
30 void vtkBoxWidgetCallback0::setAnno(Annotation *value) { anno = value; }
31 
33  return new vtkBoxWidgetCallback1;
34 }
35 
36 void vtkBoxWidgetCallback1::Execute(vtkObject *caller, unsigned long, void *) {
37  if (anno) {
38  anno->adjustToAnchor();
39  }
40 }
41 
42 void vtkBoxWidgetCallback1::setAnno(Annotation *value) { anno = value; }
void applyTransform(vtkSmartPointer< vtkTransform > t)
apply transform to annotation
Definition: Annotaion.cpp:231
void adjustToAnchor()
keep current orientation, re-compute the center and scale to make annotation fit to selected point we...
Definition: Annotaion.cpp:283
void setAnno(Annotation *value)
setAnno set the current annotation in which theb actor is picked
virtual void Execute(vtkObject *caller, unsigned long, void *)
static vtkBoxWidgetCallback0 * New()
static vtkBoxWidgetCallback1 * New()
void setAnno(Annotation *value)
setAnno set the current annotation in which the actor is picked
virtual void Execute(vtkObject *caller, unsigned long, void *)