forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkProp3DButtonRepresentation.h
145 lines (122 loc) · 4.55 KB
/
vtkProp3DButtonRepresentation.h
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
/*=========================================================================
Program: Visualization Toolkit
Module: vtkProp3DButtonRepresentation.h
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.
=========================================================================*/
/**
* @class vtkProp3DButtonRepresentation
* @brief defines a representation for a vtkButtonWidget
*
* This class implements one type of vtkButtonRepresentation. Each button
* state can be represented with a separate instance of vtkProp3D. Thus
* buttons can be represented with vtkActor, vtkImageActor, volumes (e.g.,
* vtkVolume) and/or any other vtkProp3D. Also, the class invokes events when
* highlighting occurs (i.e., hovering, selecting) so that appropriate action
* can be taken to highlight the button (if desired).
*
* To use this representation, always begin by specifying the number of
* button states. Then provide, for each state, an instance of vtkProp3D.
*
* This widget representation uses the conventional placement method. The
* button is placed inside the bounding box defined by PlaceWidget by translating
* and scaling the vtkProp3D to fit (each vtkProp3D is transformed). Therefore,
* you must define the number of button states and each state (i.e., vtkProp3D)
* prior to calling vtkPlaceWidget.
*
* @sa
* vtkButtonWidget vtkButtonRepresentation vtkButtonSource vtkEllipticalButtonSource
* vtkRectangularButtonSource
*/
#ifndef vtkProp3DButtonRepresentation_h
#define vtkProp3DButtonRepresentation_h
#include "vtkInteractionWidgetsModule.h" // For export macro
#include "vtkButtonRepresentation.h"
class vtkPropPicker;
class vtkProp3D;
class vtkProp3DFollower;
class vtkPropArray; //PIMPLd
class VTKINTERACTIONWIDGETS_EXPORT vtkProp3DButtonRepresentation : public vtkButtonRepresentation
{
public:
/**
* Instantiate the class.
*/
static vtkProp3DButtonRepresentation *New();
//@{
/**
* Standard methods for instances of the class.
*/
vtkTypeMacro(vtkProp3DButtonRepresentation,vtkButtonRepresentation);
void PrintSelf(ostream& os, vtkIndent indent);
//@}
//@{
/**
* Add the ith texture corresponding to the ith button state.
* The parameter i should be (0 <= i < NumberOfStates).
*/
void SetButtonProp(int i, vtkProp3D *prop);
vtkProp3D *GetButtonProp(int i);
//@}
//@{
/**
* Specify whether the button should always face the camera. If enabled,
* the button reorients itself towards the camera as the camera moves.
*/
vtkSetMacro(FollowCamera,int);
vtkGetMacro(FollowCamera,int);
vtkBooleanMacro(FollowCamera,int);
//@}
/**
* Extend the vtkButtonRepresentation::SetState() method.
*/
virtual void SetState(int state);
//@{
/**
* Provide the necessary methods to satisfy the vtkWidgetRepresentation API.
*/
virtual int ComputeInteractionState(int X, int Y, int modify=0);
virtual void BuildRepresentation();
//@}
/**
* This method positions (translates and scales the props) into the
* bounding box specified. Note all the button props are scaled.
*/
virtual void PlaceWidget(double bounds[6]);
//@{
/**
* Provide the necessary methods to satisfy the rendering API.
*/
virtual void ShallowCopy(vtkProp *prop);
virtual double *GetBounds();
virtual void GetActors(vtkPropCollection *pc);
virtual void ReleaseGraphicsResources(vtkWindow*);
virtual int RenderOpaqueGeometry(vtkViewport*);
virtual int RenderVolumetricGeometry(vtkViewport*);
virtual int RenderTranslucentPolygonalGeometry(vtkViewport*);
virtual int HasTranslucentPolygonalGeometry();
//@}
protected:
vtkProp3DButtonRepresentation();
~vtkProp3DButtonRepresentation();
// The current vtkProp3D used to represent the button
vtkProp3D *CurrentProp;
// Follow the camera if requested
vtkProp3DFollower *Follower;
int FollowCamera;
// Keep track of the props associated with the N
// states of the button. This is a PIMPLd stl map.
vtkPropArray *PropArray;
// For picking the button
vtkPropPicker *Picker;
// Register internal Pickers within PickingManager
virtual void RegisterPickers();
private:
vtkProp3DButtonRepresentation(const vtkProp3DButtonRepresentation&) VTK_DELETE_FUNCTION;
void operator=(const vtkProp3DButtonRepresentation&) VTK_DELETE_FUNCTION;
};
#endif