forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkFixedSizeHandleRepresentation3D.h
118 lines (98 loc) · 3.83 KB
/
vtkFixedSizeHandleRepresentation3D.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
/*=========================================================================
Program: Visualization Toolkit
Module: vtkFixedSizeHandleRepresentation.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 vtkFixedSizeHandleRepresentation
* @brief A marker that has the same size in pixels.
*
*
* This class is a concrete implementation of vtkHandleRepresentation. It is
* meant to be used as a representation for vtkHandleWidget. Unlike the other
* representations, this can maintain a constant size in pixels, regardless of
* the camera zoom parameters. The size in pixels may be set via
* SetHandleSizeInPixels. This representation renders the markers as spherical
* blobs in 3D space with the width as specified above, defaults to 10 pixels.
* The handles will have the same size in pixels, give or take a certain
* tolerance, as specified by SetHandleSizeToleranceInPixels. The tolerance
* defaults to half a pixel. PointPlacers may be used to specify constraints on
* the placement of markers. For instance a vtkPolygonalSurfacePointPlacer
* will constrain placement of these spherical handles to a surface mesh.
*
* @sa
* vtkHandleRepresentation vtkHandleWidget
*/
#ifndef vtkFixedSizeHandleRepresentation3D_h
#define vtkFixedSizeHandleRepresentation3D_h
#include "vtkInteractionWidgetsModule.h" // For export macro
#include "vtkPolygonalHandleRepresentation3D.h"
class vtkSphereSource;
class VTKINTERACTIONWIDGETS_EXPORT vtkFixedSizeHandleRepresentation3D : public vtkPolygonalHandleRepresentation3D
{
public:
/**
* Instantiate this class.
*/
static vtkFixedSizeHandleRepresentation3D *New();
//@{
/**
* Standard vtk methods
*/
vtkTypeMacro(vtkFixedSizeHandleRepresentation3D,
vtkPolygonalHandleRepresentation3D);
void PrintSelf(ostream& os, vtkIndent indent) override;
//@}
//@{
/**
* Get the object used to render the spherical handle marker
*/
vtkGetObjectMacro( SphereSource, vtkSphereSource );
//@}
//@{
/**
* Set/Get the required handle size in pixels. Defaults to a width of
* 10 pixels.
*/
vtkSetMacro( HandleSizeInPixels, double );
vtkGetMacro( HandleSizeInPixels, double );
//@}
//@{
/**
* Specify the acceptable handle size tolerance. During each render, the
* handle 3D source will be updated to automatically match a display size
* as specified by HandleSizeInPixels. This update will be done if the
* handle size is larger than a tolerance. Default value of this
* tolerance is half a pixel.
*/
vtkSetMacro( HandleSizeToleranceInPixels, double );
vtkGetMacro( HandleSizeToleranceInPixels, double );
//@}
protected:
vtkFixedSizeHandleRepresentation3D();
~vtkFixedSizeHandleRepresentation3D() override;
/**
* Recomputes the handle world size based on the set display size.
*/
void BuildRepresentation() override;
/**
* Convenience method to convert from world to display
*/
void WorldToDisplay( double w[4], double d[4] );
/**
* Convenience method to convert from display to world
*/
void DisplayToWorld( double d[4], double w[4] );
vtkSphereSource * SphereSource;
double HandleSizeInPixels;
double HandleSizeToleranceInPixels;
private:
vtkFixedSizeHandleRepresentation3D(const vtkFixedSizeHandleRepresentation3D&) = delete;
void operator=(const vtkFixedSizeHandleRepresentation3D&) = delete;
};
#endif