File: vtkButtonSource.h

package info (click to toggle)
vtk6 6.3.0%2Bdfsg2-8.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 118,972 kB
  • sloc: cpp: 1,442,790; ansic: 113,395; python: 72,383; tcl: 46,998; xml: 8,119; yacc: 4,525; java: 4,239; perl: 3,108; lex: 1,694; sh: 1,093; asm: 154; makefile: 68; objc: 17
file content (112 lines) | stat: -rw-r--r-- 4,278 bytes parent folder | download | duplicates (5)
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
/*=========================================================================

  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.

=========================================================================*/
// .NAME vtkButtonSource - abstract class for creating various button types
// .SECTION Description
// 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.

// .SECTION See Also
// vtkEllipticalButtonSource vtkRectangularButtonSource

// .SECTION Caveats
// 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);
  vtkTypeMacro(vtkButtonSource,vtkPolyDataAlgorithm);

  // Description:
  // Specify a point defining the origin (center) of the button.
  vtkSetVector3Macro(Center,double);
  vtkGetVectorMacro(Center,double,3);

  // Description:
  // 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);}

  // Description:
  // 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);

  // Description:
  // Set/Get the default texture coordinate to set the shoulder region to.
  vtkSetVector2Macro(ShoulderTextureCoordinate,double);
  vtkGetVector2Macro(ShoulderTextureCoordinate,double);

  // Description:
  // 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() {}

  double Center[3];
  double ShoulderTextureCoordinate[2];
  int    TextureStyle;
  int    TextureDimensions[2];
  int    TwoSided;

private:
  vtkButtonSource(const vtkButtonSource&);  // Not implemented.
  void operator=(const vtkButtonSource&);  // Not implemented.

};

#endif