forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkInteractorStyleRubberBand2D.h
135 lines (112 loc) · 3.85 KB
/
vtkInteractorStyleRubberBand2D.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
/*=========================================================================
Program: Visualization Toolkit
Module: vtkInteractorStyleRubberBand2D.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.
=========================================================================*/
/*-------------------------------------------------------------------------
Copyright 2008 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
/**
* @class vtkInteractorStyleRubberBand2D
* @brief A rubber band interactor for a 2D view
*
*
* vtkInteractorStyleRubberBand2D manages interaction in a 2D view.
* Camera rotation is not allowed with this interactor style.
* Zooming affects the camera's parallel scale only, and assumes
* that the camera is in parallel projection mode.
* The style also allows draws a rubber band using the left button.
* All camera changes invoke StartInteractionEvent when the button
* is pressed, InteractionEvent when the mouse (or wheel) is moved,
* and EndInteractionEvent when the button is released. The bindings
* are as follows:
* Left mouse - Select (invokes a SelectionChangedEvent).
* Right mouse - Zoom.
* Middle mouse - Pan.
* Scroll wheel - Zoom.
*/
#ifndef vtkInteractorStyleRubberBand2D_h
#define vtkInteractorStyleRubberBand2D_h
#include "vtkInteractionStyleModule.h" // For export macro
#include "vtkInteractorStyle.h"
class vtkUnsignedCharArray;
class VTKINTERACTIONSTYLE_EXPORT vtkInteractorStyleRubberBand2D : public vtkInteractorStyle
{
public:
static vtkInteractorStyleRubberBand2D *New();
vtkTypeMacro(vtkInteractorStyleRubberBand2D, vtkInteractorStyle);
void PrintSelf(ostream& os, vtkIndent indent) override;
void OnLeftButtonDown() override;
void OnLeftButtonUp() override;
void OnMiddleButtonDown() override;
void OnMiddleButtonUp() override;
void OnRightButtonDown() override;
void OnRightButtonUp() override;
void OnMouseMove() override;
void OnMouseWheelForward() override;
void OnMouseWheelBackward() override;
//@{
/**
* Whether to invoke a render when the mouse moves.
*/
vtkSetMacro(RenderOnMouseMove, bool);
vtkGetMacro(RenderOnMouseMove, bool);
vtkBooleanMacro(RenderOnMouseMove, bool);
//@}
/**
* Selection types
*/
enum
{
SELECT_NORMAL = 0,
SELECT_UNION = 1
};
//@{
/**
* Current interaction state
*/
vtkGetMacro(Interaction, int);
//@}
enum
{
NONE,
PANNING,
ZOOMING,
SELECTING
};
//@{
/**
* Access to the start and end positions (display coordinates) of the rubber
* band pick area. This is a convenience method for the wrapped languages
* since the event callData is lost when using those wrappings.
*/
vtkGetVector2Macro(StartPosition,int);
vtkGetVector2Macro(EndPosition,int);
//@}
protected:
vtkInteractorStyleRubberBand2D();
~vtkInteractorStyleRubberBand2D() override;
// The interaction mode
int Interaction;
// Draws the selection rubber band
void RedrawRubberBand();
// The start position of the selection
int StartPosition[2];
// The end position of the selection
int EndPosition[2];
// The pixel array for the rubber band
vtkUnsignedCharArray* PixelArray;
// Whether to render when the mouse moves
bool RenderOnMouseMove;
private:
vtkInteractorStyleRubberBand2D(const vtkInteractorStyleRubberBand2D&) = delete;
void operator=(const vtkInteractorStyleRubberBand2D&) = delete;
};
#endif