VTK  9.4.20250104
vtkFastLabeledDataMapper.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
21#ifndef vtkFastLabeledDataMapper_h
22#define vtkFastLabeledDataMapper_h
23
24#include "vtkLabeledDatatypeDefinitions.h" // For Data type Definitions
26#include "vtkRenderingOpenGL2Module.h" // For export macro
27#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
28
29#include <memory> // For unique_ptr
30
31VTK_ABI_NAMESPACE_BEGIN
32class vtkDataObject;
33class vtkDataSet;
34class vtkFloatArray;
35class vtkIntArray;
36class vtkTextProperty;
37class vtkTransform;
38VTK_ABI_NAMESPACE_END
39
40VTK_ABI_NAMESPACE_BEGIN
41class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkFastLabeledDataMapper
43{
44public:
47 void PrintSelf(ostream& os, vtkIndent indent) override;
48
50
62 vtkSetStringMacro(LabelFormat);
63 vtkGetStringMacro(LabelFormat);
65
67
74 vtkSetMacro(LabeledComponent, int);
75 vtkGetMacro(LabeledComponent, int);
77
79
82 vtkSetMacro(ComponentSeparator, char);
83 vtkGetMacro(ComponentSeparator, char);
85
87
92 vtkSetClampMacro(FieldDataArray, int, 0, VTK_INT_MAX);
93 vtkGetMacro(FieldDataArray, int);
95
97
102 vtkSetStringMacro(FieldDataName)
103 vtkGetStringMacro(FieldDataName);
105
107
113 vtkSetMacro(LabelMode, int);
114 vtkGetMacro(LabelMode, int);
115 void SetLabelModeToLabelIds() { this->SetLabelMode(VTK_LABEL_IDS); };
116 void SetLabelModeToLabelScalars() { this->SetLabelMode(VTK_LABEL_SCALARS); };
117 void SetLabelModeToLabelVectors() { this->SetLabelMode(VTK_LABEL_VECTORS); };
118 void SetLabelModeToLabelNormals() { this->SetLabelMode(VTK_LABEL_NORMALS); };
119 void SetLabelModeToLabelTCoords() { this->SetLabelMode(VTK_LABEL_TCOORDS); };
120 void SetLabelModeToLabelTensors() { this->SetLabelMode(VTK_LABEL_TENSORS); };
121 void SetLabelModeToLabelFieldData() { this->SetLabelMode(VTK_LABEL_FIELD_DATA); };
123
125
133 virtual void SetLabelTextProperty(vtkTextProperty* p, int type);
136
141 vtkSetStringMacro(FrameColorsName);
142 vtkGetStringMacro(FrameColorsName);
143
145
149 {
150 LowerLeft = 0,
158 Center
159 };
161
163
167 vtkSetMacro(TextAnchor, int);
168 vtkGetMacro(TextAnchor, int);
170
172
175 void RenderPiece(vtkRenderer* ren, vtkActor* act) override;
177
179
182 void RenderPieceStart(vtkRenderer* ren, vtkActor* act) override;
184
186
189 void RenderPieceFinish(vtkRenderer* ren, vtkActor* act) override;
191
193
196 virtual void SetInputData(vtkDataSet*);
198
200
205
207
212
214
219
220protected:
223
225
230
232
237
238 void AllocateLabels(int numLabels);
242 int numCurLabels, const std::vector<std::string>&, vtkIntArray*, vtkFloatArray*);
244
245 vtkDataSet* Input = nullptr;
246 char* LabelFormat = nullptr;
247 int LabelMode = VTK_LABEL_IDS;
248 int LabeledComponent = -1;
249 int FieldDataArray = 0;
250 char* FieldDataName = nullptr;
251 char ComponentSeparator = ' ';
253
255 int NumberOfLabelsAllocated = 0;
256
257 class vtkInternals;
258 std::unique_ptr<vtkInternals> Implementation;
259
260 char* FrameColorsName = nullptr;
261
262private:
264 void operator=(const vtkFastLabeledDataMapper&) = delete;
265
266protected:
268 std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer* ren, vtkActor* act) override;
269};
270VTK_ABI_NAMESPACE_END
271
272#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:165
draw text labels at dataset points
static vtkFastLabeledDataMapper * New()
void ReleaseGraphicsResources(vtkWindow *) override
Overridden to release internal textureobject.
~vtkFastLabeledDataMapper() override
vtkMTimeType GetMTime() override
Overridden to take into account LabelTextProperty's mtime.
TextAnchor
Anchor option for labels.
@ LowerRight
Uses the lower right corner.
@ UpperEdge
Uses the upper edge center.
@ LowerEdge
Uses the lower edge center.
@ RightEdge
Uses the right edge center.
@ LeftEdge
Uses the left edge center.
@ UpperRight
Uses the upper right corner.
@ UpperLeft
Uses the upper left corner.
void SetMapperShaderParameters(vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act) override
Overridden to set up uniforms for the shaders.
std::unique_ptr< vtkInternals > Implementation
void MakeupShaders(vtkOpenGLShaderProperty *sp)
int FillInputPortInformation(int, vtkInformation *) override
Overridden to declare support for any vtkDataSet, not just vtkPolyData.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetInputData(vtkDataSet *)
Set the input dataset to the mapper.
void BuildShaders(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act) override
Build the shader source code, called by UpdateShader.
void RenderPieceStart(vtkRenderer *ren, vtkActor *act) override
Overridden to setup textureobject.
virtual vtkTextProperty * GetLabelTextProperty()
void BuildLabelsInternal(vtkDataSet *)
void AllocateLabels(int numLabels)
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property.
void RenderPieceFinish(vtkRenderer *ren, vtkActor *act) override
Overridden to teardown textureobject.
vtkDataSet * GetInput()
Uses GetInputDataObject() to get the input data set.
void RenderPiece(vtkRenderer *ren, vtkActor *act) override
Overridden to rebuild labels if necessary.
virtual vtkTextProperty * GetLabelTextProperty(int type)
void MakeShaderArrays(int numCurLabels, const std::vector< std::string > &, vtkIntArray *, vtkFloatArray *)
virtual void SetLabelTextProperty(vtkTextProperty *p, int type)
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition vtkIndent.h:108
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
PolyDataMapper using OpenGL to render.
represent GPU shader properties
abstract specification for renderers
represent text properties.
describes linear transformations via a 4x4 matrix
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
#define VTK_LABEL_TENSORS
#define VTK_LABEL_TCOORDS
#define VTK_LABEL_VECTORS
#define VTK_LABEL_SCALARS
#define VTK_LABEL_FIELD_DATA
#define VTK_LABEL_IDS
#define VTK_LABEL_NORMALS
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_INT_MAX
Definition vtkType.h:144
#define VTK_MARSHALAUTO