forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkCheckerboardWidget.h
120 lines (100 loc) · 4.09 KB
/
vtkCheckerboardWidget.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
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCheckerboardWidget.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 vtkCheckerboardWidget
* @brief interactively set the number of divisions in 2D image checkerboard
*
* The vtkCheckerboardWidget is used to interactively control an instance of
* vtkImageCheckerboard (and an associated vtkImageActor used to display the
* checkerboard). 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.
*
* To use this widget, specify an instance of vtkImageCheckerboard and an
* instance of vtkImageActor. By default, the widget responds to the
* following events:
* <pre>
* If the slider bead is selected:
* LeftButtonPressEvent - select slider (if on slider)
* LeftButtonReleaseEvent - release slider
* MouseMoveEvent - move slider
* If the end caps or slider tube of a slider are selected:
* LeftButtonPressEvent - jump (or animate) to cap or point on tube;
* </pre>
* It is possible to change these event bindings. Please refer to the
* documentation for vtkSliderWidget for more information. Advanced users may
* directly access and manipulate the sliders by obtaining the instances of
* vtkSliderWidget composing the vtkCheckerboard widget.
*
* @sa
* vtkImageCheckerboard vtkImageActor vtkSliderWidget vtkRectilinearWipeWidget
*/
#ifndef vtkCheckerboardWidget_h
#define vtkCheckerboardWidget_h
#include "vtkInteractionWidgetsModule.h" // For export macro
#include "vtkAbstractWidget.h"
class vtkCheckerboardRepresentation;
class vtkSliderWidget;
class VTKINTERACTIONWIDGETS_EXPORT vtkCheckerboardWidget : public vtkAbstractWidget
{
public:
/**
* Instantiate this class.
*/
static vtkCheckerboardWidget *New();
//@{
/**
* Standard methods for a VTK class.
*/
vtkTypeMacro(vtkCheckerboardWidget,vtkAbstractWidget);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
//@}
/**
* The method for activating and deactivating this widget. This method
* must be overridden because it is a composite widget and does more than
* its superclasses' vtkAbstractWidget::SetEnabled() method.
*/
void SetEnabled(int) VTK_OVERRIDE;
/**
* Specify an instance of vtkWidgetRepresentation used to represent this
* widget in the scene. Note that the representation is a subclass of vtkProp
* so it can be added to the renderer independent of the widget.
*/
void SetRepresentation(vtkCheckerboardRepresentation *r)
{this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));}
/**
* Return the representation as a vtkCheckerboardRepresentation.
*/
vtkCheckerboardRepresentation *GetCheckerboardRepresentation()
{return reinterpret_cast<vtkCheckerboardRepresentation*>(this->WidgetRep);}
/**
* Create the default widget representation if one is not set.
*/
void CreateDefaultRepresentation() VTK_OVERRIDE;
protected:
vtkCheckerboardWidget();
~vtkCheckerboardWidget() VTK_OVERRIDE;
// The four slider widgets
vtkSliderWidget *TopSlider;
vtkSliderWidget *RightSlider;
vtkSliderWidget *BottomSlider;
vtkSliderWidget *LeftSlider;
// Callback interface
void StartCheckerboardInteraction();
void CheckerboardInteraction(int sliderNum);
void EndCheckerboardInteraction();
friend class vtkCWCallback;
private:
vtkCheckerboardWidget(const vtkCheckerboardWidget&) VTK_DELETE_FUNCTION;
void operator=(const vtkCheckerboardWidget&) VTK_DELETE_FUNCTION;
};
#endif