VTK  9.5.20250905
vtkLabeledDataMapper.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
111#ifndef vtkLabeledDataMapper_h
112#define vtkLabeledDataMapper_h
113
114#include "vtkLabeledDatatypeDefinitions.h" // For Data type Definitions
115#include "vtkMapper2D.h"
116#include "vtkRenderingLabelModule.h" // For export macro
117#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
118
119#include <cassert> // For assert macro
120
121VTK_ABI_NAMESPACE_BEGIN
122class vtkDataObject;
123class vtkDataSet;
124class vtkTextMapper;
125class vtkTextProperty;
126class vtkTransform;
127
128class VTKRENDERINGLABEL_EXPORT VTK_MARSHALAUTO vtkLabeledDataMapper : public vtkMapper2D
129{
130public:
136
138 void PrintSelf(ostream& os, vtkIndent indent) override;
139
141
152 void SetLabelFormat(const char* format);
153 vtkGetStringMacro(LabelFormat);
155
157
164 vtkSetMacro(LabeledComponent, int);
165 vtkGetMacro(LabeledComponent, int);
167
169
172 vtkSetMacro(ComponentSeparator, char);
173 vtkGetMacro(ComponentSeparator, char);
175
177
182 vtkSetClampMacro(FieldDataArray, int, 0, VTK_INT_MAX);
183 vtkGetMacro(FieldDataArray, int);
185
187
192 vtkSetStringMacro(FieldDataName)
193 vtkGetStringMacro(FieldDataName);
195
199 virtual void SetInputData(vtkDataObject*);
200
205 vtkDataSet* GetInput();
206
208
214 vtkSetMacro(LabelMode, int);
215 vtkGetMacro(LabelMode, int);
216 void SetLabelModeToLabelIds() { this->SetLabelMode(VTK_LABEL_IDS); }
217 void SetLabelModeToLabelScalars() { this->SetLabelMode(VTK_LABEL_SCALARS); }
218 void SetLabelModeToLabelVectors() { this->SetLabelMode(VTK_LABEL_VECTORS); }
219 void SetLabelModeToLabelNormals() { this->SetLabelMode(VTK_LABEL_NORMALS); }
220 void SetLabelModeToLabelTCoords() { this->SetLabelMode(VTK_LABEL_TCOORDS); }
221 void SetLabelModeToLabelTensors() { this->SetLabelMode(VTK_LABEL_TENSORS); }
224
226
234 virtual void SetLabelTextProperty(vtkTextProperty* p, int type);
237
239
242 void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor) override;
243 void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
245
250
252
255 vtkGetObjectMacro(Transform, vtkTransform);
258
261 {
262 WORLD = 0,
263 DISPLAY = 1
265 };
266
268
272 vtkGetMacro(CoordinateSystem, int);
273 vtkSetClampMacro(CoordinateSystem, int, WORLD, DISPLAY);
274 void CoordinateSystemWorld() { this->SetCoordinateSystem(vtkLabeledDataMapper::WORLD); }
275 void CoordinateSystemDisplay() { this->SetCoordinateSystem(vtkLabeledDataMapper::DISPLAY); }
277
282
284
287 vtkGetMacro(NumberOfLabels, int);
289
291
294 void GetLabelPosition(int label, double pos[3])
295 {
296 assert("label index range" && label >= 0 && label < this->NumberOfLabels);
297 pos[0] = this->LabelPositions[3 * label];
298 pos[1] = this->LabelPositions[3 * label + 1];
299 pos[2] = this->LabelPositions[3 * label + 2];
300 }
302
306 const char* GetLabelText(int label);
307
308protected:
311
313
320
322
324
330
332
333 void AllocateLabels(int numLabels);
336
337 class Internals;
338 Internals* Implementation;
339
340private:
342 void operator=(const vtkLabeledDataMapper&) = delete;
343};
344
345VTK_ABI_NAMESPACE_END
346#endif
a actor that draws 2D data
Definition vtkActor2D.h:145
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:165
a simple class to control print indentation
Definition vtkIndent.h:108
Store vtkAlgorithm input/output information.
draw text labels at dataset points
virtual void SetLabelTextProperty(vtkTextProperty *p, int type)
Set/Get the text property.
void RenderOpaqueGeometry(vtkViewport *viewport, vtkActor2D *actor) override
Draw the text to the screen at each input point.
void CoordinateSystemWorld()
Set/get the coordinate system used for output labels.
void SetLabelModeToLabelVectors()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
void SetLabelFormat(const char *format)
Set/Get the std::format style format with which to print the labels.
void SetLabelModeToLabelNormals()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
void SetLabelModeToLabelTensors()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
virtual vtkTextProperty * GetLabelTextProperty()
Set/Get the text property.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
void AllocateLabels(int numLabels)
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property.
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
void SetLabelModeToLabelTCoords()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
static vtkLabeledDataMapper * New()
Instantiate object with {:<#6.3g} label format.
void SetLabelModeToLabelScalars()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
const char * GetLabelText(int label)
Return the text for the requested label.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetLabelModeToLabelFieldData()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
vtkMTimeType GetMTime() override
Return the modified time for this object.
void RenderOverlay(vtkViewport *viewport, vtkActor2D *actor) override
Draw the text to the screen at each input point.
~vtkLabeledDataMapper() override
void SetTransform(vtkTransform *t)
The transform to apply to the labels before mapping to 2D.
virtual vtkTextProperty * GetLabelTextProperty(int type)
Set/Get the text property.
void BuildLabelsInternal(vtkDataSet *)
void GetLabelPosition(int label, double pos[3])
Return the position of the requested label.
void CoordinateSystemDisplay()
Set/get the coordinate system used for output labels.
Coordinates
Coordinate systems that output dataset may use.
@ DISPLAY
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant).
@ WORLD
Output 3-D world-space coordinates for each label anchor.
abstract class specifies interface for objects which render 2D actors
Definition vtkMapper2D.h:26
2D text annotation
represent text properties.
record modification and/or execution time
describes linear transformations via a 4x4 matrix
abstract specification for Viewports
Definition vtkViewport.h:66
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:287
#define VTK_INT_MAX
Definition vtkType.h:161
#define VTK_MARSHALAUTO