forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkAbstractPropPicker.cxx
156 lines (137 loc) · 3.08 KB
/
vtkAbstractPropPicker.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*=========================================================================
Program: Visualization Toolkit
Module: vtkAbstractPropPicker.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkAbstractPropPicker.h"
#include "vtkActor.h"
#include "vtkActor2D.h"
#include "vtkAssembly.h"
#include "vtkAssemblyNode.h"
#include "vtkAssemblyPath.h"
#include "vtkObjectFactory.h"
#include "vtkPropAssembly.h"
#include "vtkVolume.h"
vtkCxxSetObjectMacro(vtkAbstractPropPicker,Path,vtkAssemblyPath);
vtkAbstractPropPicker::vtkAbstractPropPicker()
{
this->Path = NULL;
}
vtkAbstractPropPicker::~vtkAbstractPropPicker()
{
if ( this->Path )
{
this->Path->Delete();
}
}
// set up for a pick
void vtkAbstractPropPicker::Initialize()
{
this->vtkAbstractPicker::Initialize();
if ( this->Path )
{
this->Path->Delete();
this->Path = NULL;
}
}
//----------------------------------------------------------------------------
vtkProp* vtkAbstractPropPicker::GetViewProp()
{
if ( this->Path != NULL )
{
return this->Path->GetFirstNode()->GetViewProp();
}
else
{
return NULL;
}
}
vtkProp3D *vtkAbstractPropPicker::GetProp3D()
{
if ( this->Path != NULL )
{
vtkProp *prop = this->Path->GetFirstNode()->GetViewProp();
return vtkProp3D::SafeDownCast(prop);
}
else
{
return NULL;
}
}
vtkActor *vtkAbstractPropPicker::GetActor()
{
if ( this->Path != NULL )
{
vtkProp *prop = this->Path->GetFirstNode()->GetViewProp();
return vtkActor::SafeDownCast(prop);
}
else
{
return NULL;
}
}
vtkActor2D *vtkAbstractPropPicker::GetActor2D()
{
if ( this->Path != NULL )
{
vtkProp *prop = this->Path->GetFirstNode()->GetViewProp();
return vtkActor2D::SafeDownCast(prop);
}
else
{
return NULL;
}
}
vtkVolume *vtkAbstractPropPicker::GetVolume()
{
if ( this->Path != NULL )
{
vtkProp *prop = this->Path->GetFirstNode()->GetViewProp();
return vtkVolume::SafeDownCast(prop);
}
else
{
return NULL;
}
}
vtkAssembly *vtkAbstractPropPicker::GetAssembly()
{
if ( this->Path != NULL )
{
vtkProp *prop = this->Path->GetFirstNode()->GetViewProp();
return vtkAssembly::SafeDownCast(prop);
}
else
{
return NULL;
}
}
vtkPropAssembly *vtkAbstractPropPicker::GetPropAssembly()
{
if ( this->Path != NULL )
{
vtkProp *prop = this->Path->GetFirstNode()->GetViewProp();
return vtkPropAssembly::SafeDownCast(prop);
}
else
{
return NULL;
}
}
void vtkAbstractPropPicker::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
if ( this->Path )
{
os << indent << "Path: " << this->Path << endl;
}
else
{
os << indent << "Path: (none)" << endl;
}
}