forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkButtonSource.h
129 lines (109 loc) · 4.22 KB
/
vtkButtonSource.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
/*=========================================================================
Program: Visualization Toolkit
Module: vtkButtonSource.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 vtkButtonSource
* @brief abstract class for creating various button types
*
* vtkButtonSource is an abstract class that defines an API for creating
* "button-like" objects in VTK. A button is a geometry with a rectangular
* region that can be textured. The button is divided into two regions: the
* texture region and the shoulder region. The points in both regions are
* assigned texture coordinates. The texture region has texture coordinates
* consistent with the image to be placed on it. All points in the shoulder
* regions are assigned a texture coordinate specified by the user. In this
* way the shoulder region can be colored by the texture.
*
* Creating a vtkButtonSource requires specifying its center point.
* (Subclasses have other attributes that must be set to control
* the shape of the button.) You must also specify how to control
* the shape of the texture region; i.e., whether to size the
* texture region proportional to the texture dimensions or whether
* to size the texture region proportional to the button. Also, buttons
* can be created single sided are mirrored to create two-sided buttons.
*
* @sa
* vtkEllipticalButtonSource vtkRectangularButtonSource
*
* @warning
* The button is defined in the x-y plane. Use vtkTransformPolyDataFilter
* or vtkGlyph3D to orient the button in a different direction.
*/
#ifndef vtkButtonSource_h
#define vtkButtonSource_h
#include "vtkFiltersSourcesModule.h" // For export macro
#include "vtkPolyDataAlgorithm.h"
#define VTK_TEXTURE_STYLE_FIT_IMAGE 0
#define VTK_TEXTURE_STYLE_PROPORTIONAL 1
class VTKFILTERSSOURCES_EXPORT vtkButtonSource : public vtkPolyDataAlgorithm
{
public:
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
vtkTypeMacro(vtkButtonSource,vtkPolyDataAlgorithm);
//@{
/**
* Specify a point defining the origin (center) of the button.
*/
vtkSetVector3Macro(Center,double);
vtkGetVectorMacro(Center,double,3);
//@}
//@{
/**
* Set/Get the style of the texture region: whether to size it
* according to the x-y dimensions of the texture, or whether to make
* the texture region proportional to the width/height of the button.
*/
vtkSetClampMacro(TextureStyle,int,VTK_TEXTURE_STYLE_FIT_IMAGE,
VTK_TEXTURE_STYLE_PROPORTIONAL);
vtkGetMacro(TextureStyle,int);
void SetTextureStyleToFitImage()
{this->SetTextureStyle(VTK_TEXTURE_STYLE_FIT_IMAGE);}
void SetTextureStyleToProportional()
{this->SetTextureStyle(VTK_TEXTURE_STYLE_PROPORTIONAL);}
//@}
//@{
/**
* Set/get the texture dimension. This needs to be set if the texture
* style is set to fit the image.
*/
vtkSetVector2Macro(TextureDimensions,int);
vtkGetVector2Macro(TextureDimensions,int);
//@}
//@{
/**
* Set/Get the default texture coordinate to set the shoulder region to.
*/
vtkSetVector2Macro(ShoulderTextureCoordinate,double);
vtkGetVector2Macro(ShoulderTextureCoordinate,double);
//@}
//@{
/**
* Indicate whether the button is single or double sided. A double sided
* button can be viewed from two sides...it looks sort of like a "pill."
* A single-sided button is meant to viewed from a single side; it looks
* like a "clam-shell."
*/
vtkSetMacro(TwoSided,int);
vtkGetMacro(TwoSided,int);
vtkBooleanMacro(TwoSided,int);
//@}
protected:
vtkButtonSource();
~vtkButtonSource() VTK_OVERRIDE {}
double Center[3];
double ShoulderTextureCoordinate[2];
int TextureStyle;
int TextureDimensions[2];
int TwoSided;
private:
vtkButtonSource(const vtkButtonSource&) VTK_DELETE_FUNCTION;
void operator=(const vtkButtonSource&) VTK_DELETE_FUNCTION;
};
#endif