VTK  9.6.20260612
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
110
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 "vtkSmartPointer.h" // For vtkSmartPointer
118#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
119
120#include <cassert> // For assert macro
121#include <memory> // For std::unique_ptr
122#include <vector> // For std::vector
123
124VTK_ABI_NAMESPACE_BEGIN
125class vtkDataArray;
126class vtkDataObject;
127class vtkDataSet;
129class vtkIntArray;
130class vtkStringArray;
132class vtkTextMapper;
133class vtkTextProperty;
134class vtkTransform;
135
136class VTKRENDERINGLABEL_EXPORT VTK_MARSHALAUTO vtkLabeledDataMapper : public vtkMapper2D
137{
138public:
144
146 void PrintSelf(ostream& os, vtkIndent indent) override;
147
149
160 vtkSetStringMacro(LabelFormat);
161 vtkGetStringMacro(LabelFormat);
163
165
172 vtkSetMacro(LabeledComponent, int);
173 vtkGetMacro(LabeledComponent, int);
175
177
180 vtkSetMacro(ComponentSeparator, char);
181 vtkGetMacro(ComponentSeparator, char);
183
185
190 vtkSetClampMacro(FieldDataArray, int, 0, VTK_INT_MAX);
191 vtkGetMacro(FieldDataArray, int);
193
195
200 vtkSetStringMacro(FieldDataName)
201 vtkGetStringMacro(FieldDataName);
203
208
214
216
222 vtkSetMacro(LabelMode, int);
223 vtkGetMacro(LabelMode, int);
232
234
242 virtual void SetLabelTextProperty(vtkTextProperty* p, int type);
245
247
250 void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor) override;
251 void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
253
258
260
263 vtkGetObjectMacro(Transform, vtkTransform);
266
269 {
270 WORLD = 0,
273 };
274
276
280 vtkGetMacro(CoordinateSystem, int);
281 vtkSetClampMacro(CoordinateSystem, int, WORLD, DISPLAY);
285
290
292
295 vtkGetMacro(NumberOfLabels, int);
297
299
302 void GetLabelPosition(int label, double pos[3])
303 {
304 assert("label index range" && label >= 0 && label < this->NumberOfLabels);
305 pos[0] = this->LabelPositions[3 * label];
306 pos[1] = this->LabelPositions[3 * label + 1];
307 pos[2] = this->LabelPositions[3 * label + 2];
308 }
309
310
314 const char* GetLabelText(int label);
315
316protected:
319
321
328
330
332
335 std::vector<vtkSmartPointer<vtkTextMapper>> TextMappers;
336 std::vector<double> LabelPositions;
338
340
341 virtual void AllocateLabels(int numLabels);
342 virtual void BuildLabels();
344
351 vtkDataSetAttributes* pd, int numItems, vtkDataObject* inputObj);
352
353 class Internals;
354 std::unique_ptr<Internals> Implementation;
355
356private:
358 void operator=(const vtkLabeledDataMapper&) = delete;
359
360 struct vtkLabeledDataMapperFormatter;
361};
362
363VTK_ABI_NAMESPACE_END
364#endif
a actor that draws 2D data
Definition vtkActor2D.h:145
general representation of visualization data
represent and manipulate attribute data in a dataset
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
a simple class to control print indentation
Definition vtkIndent.h:108
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
vtkLabeledFormatterInput ResolveLabeledFormatterInput(vtkDataSetAttributes *pd, int numItems, vtkDataObject *inputObj)
Resolve which data to label and build the format string.
virtual void SetLabelTextProperty(vtkTextProperty *p, int type)
Set/Get the text property.
virtual void SetCoordinateSystem(int)
Set/get the coordinate system used for output labels.
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 SetLabelModeToLabelIds()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
virtual void SetInputData(vtkDataObject *)
Set the input dataset to the mapper.
void SetLabelModeToLabelVectors()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
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.
virtual void SetLabelMode(int)
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property.
vtkDataSet * GetInput()
Use GetInputDataObject() to get the input data object for composite datasets.
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,...
std::unique_ptr< Internals > Implementation
static vtkLabeledDataMapper * New()
Instantiate object with {:<#6.3g} label format.
virtual void AllocateLabels(int numLabels)
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,...
virtual void BuildLabelsInternal(vtkDataSet *)
vtkMTimeType GetMTime() override
Return the modified time for this object.
std::vector< double > LabelPositions
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.
std::vector< vtkSmartPointer< vtkTextMapper > > TextMappers
virtual void BuildLabels()
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.
vtkMapper2D()=default
a vtkAbstractArray subclass for strings
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:61
Resolved label input for one dataset/graph, produced by vtkLabeledDataMapper::ResolveLabeledFormatter...
#define vtkDataArray
#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:318
#define VTK_INT_MAX
Definition vtkType.h:192
#define VTK_MARSHALAUTO