ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
vtkBoxWidgetCustomCallback.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
8
#include "
vtkBoxWidgetCustomCallback.h
"
9
10
#include <vtkActor.h>
11
#include <vtkBoxRepresentation.h>
12
#include <vtkBoxWidget.h>
13
#include <vtkTransform.h>
14
15
vtkBoxWidgetCustomCallback
*
vtkBoxWidgetCustomCallback::New
() {
16
return
new
vtkBoxWidgetCustomCallback
;
17
}
18
19
void
vtkBoxWidgetCustomCallback::SetActor
(
vtkSmartPointer<vtkActor>
actor) {
20
m_actor = actor;
21
}
22
23
void
vtkBoxWidgetCustomCallback::Execute
(vtkObject *caller,
24
unsigned
long
,
25
void
*) {
26
if
(m_preview) {
27
// 将调用该回调函数的调用者caller指针,转换为vtkBoxWidget2类型对象指针
28
vtkSmartPointer<vtkBoxWidget>
boxWidget =
29
vtkBoxWidget::SafeDownCast(caller);
30
// vtkSmartPointer<vtkBoxWidget2>
31
// boxWidget=reinterpret_cast<vtkBoxWidget2>(caller);这样转换不可以,vtkBoxWidget可以
32
vtkSmartPointer<vtkTransform>
t =
vtkSmartPointer<vtkTransform>::New
();
33
// 将boxWidget中的变换矩阵保存在t中
34
// vtkBoxRepresentation::SafeDownCast(boxWidget->GetRepresentation())->GetTransform(t);
35
boxWidget->GetTransform(t);
36
// this->m_actor->SetUserTransform(t);
37
}
38
}
vtkBoxWidgetCustomCallback
Definition:
vtkBoxWidgetCustomCallback.h:18
vtkBoxWidgetCustomCallback::Execute
virtual void Execute(vtkObject *caller, unsigned long, void *)
Definition:
vtkBoxWidgetCustomCallback.cpp:23
vtkBoxWidgetCustomCallback::SetActor
void SetActor(vtkSmartPointer< vtkActor > actor)
SetActor set the current vtkActor in which the actor is picked.
Definition:
vtkBoxWidgetCustomCallback.cpp:19
vtkBoxWidgetCustomCallback::New
static vtkBoxWidgetCustomCallback * New()
Definition:
vtkBoxWidgetCustomCallback.cpp:15
vtkSmartPointer< vtkActor >
vtkBoxWidgetCustomCallback.h
libs
PCLEngine
VTKExtensions
CallbackTools
vtkBoxWidgetCustomCallback.cpp
Generated on Tue Feb 3 2026 07:12:29 for ACloudViewer by
1.9.1