VTK  9.0.20210301
vtkIconGlyphFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkIconGlyphFilter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
39 #ifndef vtkIconGlyphFilter_h
40 #define vtkIconGlyphFilter_h
41 
42 #include "vtkFiltersGeneralModule.h" // For export macro
43 #include "vtkPolyDataAlgorithm.h"
44 
45 #define VTK_ICON_GRAVITY_TOP_RIGHT 1
46 #define VTK_ICON_GRAVITY_TOP_CENTER 2
47 #define VTK_ICON_GRAVITY_TOP_LEFT 3
48 #define VTK_ICON_GRAVITY_CENTER_RIGHT 4
49 #define VTK_ICON_GRAVITY_CENTER_CENTER 5
50 #define VTK_ICON_GRAVITY_CENTER_LEFT 6
51 #define VTK_ICON_GRAVITY_BOTTOM_RIGHT 7
52 #define VTK_ICON_GRAVITY_BOTTOM_CENTER 8
53 #define VTK_ICON_GRAVITY_BOTTOM_LEFT 9
54 
55 #define VTK_ICON_SCALING_OFF 0
56 #define VTK_ICON_SCALING_USE_SCALING_ARRAY 1
57 
58 class VTKFILTERSGENERAL_EXPORT vtkIconGlyphFilter : public vtkPolyDataAlgorithm
59 {
60 public:
62 
67  void PrintSelf(ostream& os, vtkIndent indent) override;
69 
71 
74  vtkSetVector2Macro(IconSize, int);
75  vtkGetVectorMacro(IconSize, int, 2);
77 
79 
82  vtkSetVector2Macro(IconSheetSize, int);
83  vtkGetVectorMacro(IconSheetSize, int, 2);
85 
87 
94  vtkSetVector2Macro(DisplaySize, int);
95  vtkGetVectorMacro(DisplaySize, int, 2);
97 
99 
103  vtkSetMacro(UseIconSize, bool);
104  vtkGetMacro(UseIconSize, bool);
105  vtkBooleanMacro(UseIconSize, bool);
107 
109 
114  vtkSetMacro(IconScaling, int);
115  vtkGetMacro(IconScaling, int);
116  void SetIconScalingToScalingOff() { this->SetIconScaling(VTK_ICON_SCALING_OFF); }
119 
121 
127  vtkSetMacro(PassScalars, bool);
128  vtkGetMacro(PassScalars, bool);
129  vtkBooleanMacro(PassScalars, bool);
131 
133 
138  vtkSetMacro(Gravity, int);
139  vtkGetMacro(Gravity, int);
140  void SetGravityToTopRight() { this->SetGravity(VTK_ICON_GRAVITY_TOP_RIGHT); }
142  void SetGravityToTopLeft() { this->SetGravity(VTK_ICON_GRAVITY_TOP_LEFT); }
150 
152 
156  vtkSetVector2Macro(Offset, int);
157  vtkGetVectorMacro(Offset, int, 2);
159 
160 protected:
163 
165 
166  int IconSize[2]; // Size in pixels of an icon in an icon sheet
167  int IconSheetSize[2]; // Size in pixels of the icon sheet
168  int DisplaySize[2]; // Size in pixels of the icon when displayed
169 
170  int Gravity;
174  int Offset[2];
175 
176 private:
177  vtkIconGlyphFilter(const vtkIconGlyphFilter&) = delete;
178  void operator=(const vtkIconGlyphFilter&) = delete;
179 
180  void IconConvertIndex(int id, int& j, int& k);
181 };
182 
183 inline void vtkIconGlyphFilter::IconConvertIndex(int id, int& j, int& k)
184 {
185  int dimX = this->IconSheetSize[0] / this->IconSize[0];
186  int dimY = this->IconSheetSize[1] / this->IconSize[1];
187 
188  j = id - dimX * static_cast<int>(id / dimX);
189  k = dimY - static_cast<int>(id / dimX) - 1;
190 }
191 
192 #endif
vtkIconGlyphFilter::SetGravityToTopLeft
void SetGravityToTopLeft()
Definition: vtkIconGlyphFilter.h:142
VTK_ICON_GRAVITY_TOP_CENTER
#define VTK_ICON_GRAVITY_TOP_CENTER
Definition: vtkIconGlyphFilter.h:46
vtkIconGlyphFilter::SetGravityToBottomCenter
void SetGravityToBottomCenter()
Definition: vtkIconGlyphFilter.h:147
VTK_ICON_GRAVITY_TOP_LEFT
#define VTK_ICON_GRAVITY_TOP_LEFT
Definition: vtkIconGlyphFilter.h:47
vtkIconGlyphFilter::New
static vtkIconGlyphFilter * New()
Standard VTK methods.
vtkIconGlyphFilter::IconSize
int IconSize[2]
Definition: vtkIconGlyphFilter.h:166
VTK_ICON_GRAVITY_BOTTOM_RIGHT
#define VTK_ICON_GRAVITY_BOTTOM_RIGHT
Definition: vtkIconGlyphFilter.h:51
vtkIconGlyphFilter::SetIconScalingToScalingOff
void SetIconScalingToScalingOff()
Definition: vtkIconGlyphFilter.h:116
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:36
VTK_ICON_GRAVITY_BOTTOM_LEFT
#define VTK_ICON_GRAVITY_BOTTOM_LEFT
Definition: vtkIconGlyphFilter.h:53
vtkIconGlyphFilter::SetGravityToCenterCenter
void SetGravityToCenterCenter()
Definition: vtkIconGlyphFilter.h:144
vtkIconGlyphFilter::IconSheetSize
int IconSheetSize[2]
Definition: vtkIconGlyphFilter.h:167
vtkIconGlyphFilter::SetGravityToTopCenter
void SetGravityToTopCenter()
Definition: vtkIconGlyphFilter.h:141
vtkIconGlyphFilter::vtkIconGlyphFilter
vtkIconGlyphFilter()
vtkIconGlyphFilter::IconScaling
int IconScaling
Definition: vtkIconGlyphFilter.h:172
vtkIconGlyphFilter
Filter that generates a polydata consisting of quads with texture coordinates referring to a set of i...
Definition: vtkIconGlyphFilter.h:59
vtkIconGlyphFilter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIconGlyphFilter::SetIconScalingToScalingArray
void SetIconScalingToScalingArray()
Definition: vtkIconGlyphFilter.h:117
vtkIconGlyphFilter::SetGravityToBottomRight
void SetGravityToBottomRight()
Definition: vtkIconGlyphFilter.h:146
vtkIconGlyphFilter::SetGravityToCenterRight
void SetGravityToCenterRight()
Definition: vtkIconGlyphFilter.h:143
vtkPolyDataAlgorithm.h
vtkIconGlyphFilter::UseIconSize
bool UseIconSize
Definition: vtkIconGlyphFilter.h:171
vtkIconGlyphFilter::SetGravityToTopRight
void SetGravityToTopRight()
Definition: vtkIconGlyphFilter.h:140
vtkIconGlyphFilter::PassScalars
bool PassScalars
Definition: vtkIconGlyphFilter.h:173
VTK_ICON_GRAVITY_CENTER_CENTER
#define VTK_ICON_GRAVITY_CENTER_CENTER
Definition: vtkIconGlyphFilter.h:49
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkIconGlyphFilter::Gravity
int Gravity
Definition: vtkIconGlyphFilter.h:170
VTK_ICON_GRAVITY_TOP_RIGHT
#define VTK_ICON_GRAVITY_TOP_RIGHT
Definition: vtkIconGlyphFilter.h:45
VTK_ICON_GRAVITY_BOTTOM_CENTER
#define VTK_ICON_GRAVITY_BOTTOM_CENTER
Definition: vtkIconGlyphFilter.h:52
VTK_ICON_SCALING_OFF
#define VTK_ICON_SCALING_OFF
Definition: vtkIconGlyphFilter.h:55
VTK_ICON_SCALING_USE_SCALING_ARRAY
#define VTK_ICON_SCALING_USE_SCALING_ARRAY
Definition: vtkIconGlyphFilter.h:56
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:74
vtkIconGlyphFilter::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkIconGlyphFilter::~vtkIconGlyphFilter
~vtkIconGlyphFilter() override
vtkIconGlyphFilter::SetGravityToBottomLeft
void SetGravityToBottomLeft()
Definition: vtkIconGlyphFilter.h:148
vtkIconGlyphFilter::SetGravityToCenterLeft
void SetGravityToCenterLeft()
Definition: vtkIconGlyphFilter.h:145
VTK_ICON_GRAVITY_CENTER_LEFT
#define VTK_ICON_GRAVITY_CENTER_LEFT
Definition: vtkIconGlyphFilter.h:50
VTK_ICON_GRAVITY_CENTER_RIGHT
#define VTK_ICON_GRAVITY_CENTER_RIGHT
Definition: vtkIconGlyphFilter.h:48
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:42