forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkPointHandleRepresentation2D.h
158 lines (134 loc) · 4.75 KB
/
vtkPointHandleRepresentation2D.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
153
154
155
156
157
158
/*=========================================================================
Program: Visualization Toolkit
Module: vtkPointHandleRepresentation2D.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 vtkPointHandleRepresentation2D
* @brief represent the position of a point in display coordinates
*
* This class is used to represent a vtkHandleWidget. It represents a
* position in 2D world coordinates using a x-y cursor (the cursor defined by
* an instance of vtkPolyData and generated by a vtkPolyDataAlgorithm).
*
* @sa
* vtkHandleRepresentation vtkHandleWidget
*/
#ifndef vtkPointHandleRepresentation2D_h
#define vtkPointHandleRepresentation2D_h
#include "vtkInteractionWidgetsModule.h" // For export macro
#include "vtkHandleRepresentation.h"
class vtkProperty2D;
class vtkActor2D;
class vtkCoordinate;
class vtkPolyDataMapper2D;
class vtkPolyData;
class vtkGlyph2D;
class vtkPoints;
class vtkPolyDataAlgorithm;
class vtkPointPlacer;
class VTKINTERACTIONWIDGETS_EXPORT vtkPointHandleRepresentation2D : public vtkHandleRepresentation
{
public:
/**
* Instantiate this class.
*/
static vtkPointHandleRepresentation2D *New();
//@{
/**
* Standard methods for instances of this class.
*/
vtkTypeMacro(vtkPointHandleRepresentation2D,vtkHandleRepresentation);
void PrintSelf(ostream& os, vtkIndent indent) override;
//@}
//@{
/**
* Specify the cursor shape with an instance of vtkPolyData. Note that
* shape is assumed to be defined in the display coordinate system. By
* default a vtkCursor2D shape is used.
*/
void SetCursorShape(vtkPolyData *cursorShape);
vtkPolyData *GetCursorShape();
//@}
/**
* Set/Get the position of the point in display coordinates. This overloads
* the superclasses SetDisplayPosition in order to set the focal point
* of the cursor.
*/
void SetDisplayPosition(double xyz[3]) override;
//@{
/**
* Set/Get the handle properties when unselected and selected.
*/
void SetProperty(vtkProperty2D*);
void SetSelectedProperty(vtkProperty2D*);
vtkGetObjectMacro(Property,vtkProperty2D);
vtkGetObjectMacro(SelectedProperty,vtkProperty2D);
//@}
//@{
/**
* Subclasses of vtkPointHandleRepresentation2D must implement these
* methods. These are the methods that the widget and its representation
* use to communicate with each other.
*/
double *GetBounds() VTK_SIZEHINT(6) override;
void BuildRepresentation() override;
void StartWidgetInteraction(double eventPos[2]) override;
void WidgetInteraction(double eventPos[2]) override;
int ComputeInteractionState(int X, int Y, int modify=0) override;
//@}
//@{
/**
* Methods to make this class behave as a vtkProp.
*/
void ShallowCopy(vtkProp *prop) override;
void DeepCopy(vtkProp *prop) override;
void GetActors2D(vtkPropCollection *) override;
void ReleaseGraphicsResources(vtkWindow *) override;
int RenderOverlay(vtkViewport *viewport) override;
//@}
void Highlight(int highlight) override;
/**
* Override the superclass implementation. This class does not use a
* point placer. Point placers dictate the placement of points in 3D
* space. Since this class constrains points to lie in an overlay
* plane anyway, we don't care. Just returns.
*/
void SetPointPlacer ( vtkPointPlacer * ) override;
protected:
vtkPointHandleRepresentation2D();
~vtkPointHandleRepresentation2D() override;
// Render the cursor
vtkActor2D *Actor;
vtkCoordinate *MapperCoordinate;
vtkPolyDataMapper2D *Mapper;
vtkGlyph2D *Glypher;
vtkPolyData *CursorShape;
vtkPolyData *FocalData;
vtkPoints *FocalPoint;
// Support picking
double LastPickPosition[3];
double LastEventPosition[2];
// Methods to manipulate the cursor
int ConstraintAxis;
void Translate(double eventPos[2]);
void Scale(double eventPos[2]);
// Properties used to control the appearance of selected objects and
// the manipulator in general.
vtkProperty2D *Property;
vtkProperty2D *SelectedProperty;
void CreateDefaultProperties();
// The size of the hot spot.
int DetermineConstraintAxis(int constraint, double eventPos[2]);
int WaitingForMotion;
int WaitCount;
private:
vtkPointHandleRepresentation2D(const vtkPointHandleRepresentation2D&) = delete;
void operator=(const vtkPointHandleRepresentation2D&) = delete;
};
#endif