forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkCheckerboardRepresentation.h
152 lines (128 loc) · 4.72 KB
/
vtkCheckerboardRepresentation.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
146
147
148
149
150
151
152
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCheckerboardRepresentation.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 vtkCheckerboardRepresentation
* @brief represent the vtkCheckerboardWidget
*
* The vtkCheckerboardRepresentation is used to implement the representation of
* the vtkCheckerboardWidget. The user can adjust the number of divisions in
* each of the i-j directions in a 2D image. A frame appears around the
* vtkImageActor with sliders along each side of the frame. The user can
* interactively adjust the sliders to the desired number of checkerboard
* subdivisions. The representation uses four instances of
* vtkSliderRepresentation3D to implement itself.
*
* @sa
* vtkCheckerboardWidget vtkImageCheckerboard vtkImageActor vtkSliderWidget
* vtkRectilinearWipeWidget
*/
#ifndef vtkCheckerboardRepresentation_h
#define vtkCheckerboardRepresentation_h
#include "vtkInteractionWidgetsModule.h" // For export macro
#include "vtkWidgetRepresentation.h"
class vtkImageCheckerboard;
class vtkImageActor;
class vtkSliderRepresentation3D;
class VTKINTERACTIONWIDGETS_EXPORT vtkCheckerboardRepresentation : public vtkWidgetRepresentation
{
public:
/**
* Instantiate class.
*/
static vtkCheckerboardRepresentation *New();
//@{
/**
* Standard VTK methods.
*/
vtkTypeMacro(vtkCheckerboardRepresentation,vtkWidgetRepresentation);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
//@}
//@{
/**
* Specify an instance of vtkImageCheckerboard to manipulate.
*/
void SetCheckerboard(vtkImageCheckerboard *chkrbrd);
vtkGetObjectMacro(Checkerboard,vtkImageCheckerboard);
//@}
//@{
/**
* Specify an instance of vtkImageActor to decorate.
*/
void SetImageActor(vtkImageActor *imageActor);
vtkGetObjectMacro(ImageActor,vtkImageActor);
//@}
//@{
/**
* Specify the offset of the ends of the sliders (on the boundary edges of
* the image) from the corner of the image. The offset is expressed as a
* normalized fraction of the border edges.
*/
vtkSetClampMacro(CornerOffset,double,0.0,0.4);
vtkGetMacro(CornerOffset,double);
//@}
enum {
TopSlider=0,
RightSlider,
BottomSlider,
LeftSlider
};
/**
* This method is invoked by the vtkCheckerboardWidget() when a value of some
* slider has changed.
*/
void SliderValueChanged(int sliderNum);
//@{
/**
* Set and get the instances of vtkSliderRepresention used to implement this
* representation. Normally default representations are created, but you can
* specify the ones you want to use.
*/
void SetTopRepresentation(vtkSliderRepresentation3D*);
void SetRightRepresentation(vtkSliderRepresentation3D*);
void SetBottomRepresentation(vtkSliderRepresentation3D*);
void SetLeftRepresentation(vtkSliderRepresentation3D*);
vtkGetObjectMacro(TopRepresentation,vtkSliderRepresentation3D);
vtkGetObjectMacro(RightRepresentation,vtkSliderRepresentation3D);
vtkGetObjectMacro(BottomRepresentation,vtkSliderRepresentation3D);
vtkGetObjectMacro(LeftRepresentation,vtkSliderRepresentation3D);
//@}
//@{
/**
* Methods required by superclass.
*/
void BuildRepresentation() VTK_OVERRIDE;
void GetActors(vtkPropCollection*) VTK_OVERRIDE;
void ReleaseGraphicsResources(vtkWindow *w) VTK_OVERRIDE;
int RenderOverlay(vtkViewport *viewport) VTK_OVERRIDE;
int RenderOpaqueGeometry(vtkViewport *viewport) VTK_OVERRIDE;
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) VTK_OVERRIDE;
int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
//@}
protected:
vtkCheckerboardRepresentation();
~vtkCheckerboardRepresentation() VTK_OVERRIDE;
// Instances that this class manipulates
vtkImageCheckerboard *Checkerboard;
vtkImageActor *ImageActor;
// The internal widgets for each side
vtkSliderRepresentation3D *TopRepresentation;
vtkSliderRepresentation3D *RightRepresentation;
vtkSliderRepresentation3D *BottomRepresentation;
vtkSliderRepresentation3D *LeftRepresentation;
// The corner offset
double CornerOffset;
// Direction index of image actor's plane normal
int OrthoAxis;
private:
vtkCheckerboardRepresentation(const vtkCheckerboardRepresentation&) VTK_DELETE_FUNCTION;
void operator=(const vtkCheckerboardRepresentation&) VTK_DELETE_FUNCTION;
};
#endif