VTK  9.2.6
vtkLabeledDataMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLabeledDataMapper.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 =========================================================================*/
63 #ifndef vtkLabeledDataMapper_h
64 #define vtkLabeledDataMapper_h
65 
66 #include "vtkMapper2D.h"
67 #include "vtkRenderingLabelModule.h" // For export macro
68 
69 #include <cassert> // For assert macro
70 
71 class vtkDataObject;
72 class vtkDataSet;
73 class vtkTextMapper;
74 class vtkTextProperty;
75 class vtkTransform;
76 
77 #define VTK_LABEL_IDS 0
78 #define VTK_LABEL_SCALARS 1
79 #define VTK_LABEL_VECTORS 2
80 #define VTK_LABEL_NORMALS 3
81 #define VTK_LABEL_TCOORDS 4
82 #define VTK_LABEL_TENSORS 5
83 #define VTK_LABEL_FIELD_DATA 6
84 
85 class VTKRENDERINGLABEL_EXPORT vtkLabeledDataMapper : public vtkMapper2D
86 {
87 public:
93 
95  void PrintSelf(ostream& os, vtkIndent indent) override;
96 
98 
110  vtkSetStringMacro(LabelFormat);
111  vtkGetStringMacro(LabelFormat);
113 
115 
122  vtkSetMacro(LabeledComponent, int);
123  vtkGetMacro(LabeledComponent, int);
125 
127 
130  vtkSetMacro(ComponentSeparator, char);
131  vtkGetMacro(ComponentSeparator, char);
133 
135 
140  void SetFieldDataArray(int arrayIndex);
141  vtkGetMacro(FieldDataArray, int);
143 
145 
150  void SetFieldDataName(const char* arrayName);
151  vtkGetStringMacro(FieldDataName);
153 
157  virtual void SetInputData(vtkDataObject*);
158 
164 
166 
172  vtkSetMacro(LabelMode, int);
173  vtkGetMacro(LabelMode, int);
174  void SetLabelModeToLabelIds() { this->SetLabelMode(VTK_LABEL_IDS); }
175  void SetLabelModeToLabelScalars() { this->SetLabelMode(VTK_LABEL_SCALARS); }
176  void SetLabelModeToLabelVectors() { this->SetLabelMode(VTK_LABEL_VECTORS); }
177  void SetLabelModeToLabelNormals() { this->SetLabelMode(VTK_LABEL_NORMALS); }
178  void SetLabelModeToLabelTCoords() { this->SetLabelMode(VTK_LABEL_TCOORDS); }
179  void SetLabelModeToLabelTensors() { this->SetLabelMode(VTK_LABEL_TENSORS); }
180  void SetLabelModeToLabelFieldData() { this->SetLabelMode(VTK_LABEL_FIELD_DATA); }
182 
184 
195 
197 
200  void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor) override;
201  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
203 
208 
210 
213  vtkGetObjectMacro(Transform, vtkTransform);
216 
219  {
220  WORLD = 0,
221  DISPLAY = 1
223  };
224 
226 
230  vtkGetMacro(CoordinateSystem, int);
231  vtkSetClampMacro(CoordinateSystem, int, WORLD, DISPLAY);
232  void CoordinateSystemWorld() { this->SetCoordinateSystem(vtkLabeledDataMapper::WORLD); }
233  void CoordinateSystemDisplay() { this->SetCoordinateSystem(vtkLabeledDataMapper::DISPLAY); }
235 
239  vtkMTimeType GetMTime() override;
240 
242 
245  vtkGetMacro(NumberOfLabels, int);
247 
249 
252  void GetLabelPosition(int label, double pos[3])
253  {
254  assert("label index range" && label >= 0 && label < this->NumberOfLabels);
255  pos[0] = this->LabelPositions[3 * label];
256  pos[1] = this->LabelPositions[3 * label + 1];
257  pos[2] = this->LabelPositions[3 * label + 2];
258  }
260 
264  const char* GetLabelText(int label);
265 
266 protected:
269 
271 
272  char* LabelFormat;
278 
280 
282 
286  double* LabelPositions;
288 
290 
291  void AllocateLabels(int numLabels);
292  void BuildLabels();
294 
295  class Internals;
296  Internals* Implementation;
297 
298 private:
300  void operator=(const vtkLabeledDataMapper&) = delete;
301 };
302 
303 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:55
general representation of visualization data
Definition: vtkDataObject.h:75
abstract class to specify dataset behavior
Definition: vtkDataSet.h:72
a simple class to control print indentation
Definition: vtkIndent.h:49
Store vtkAlgorithm input/output information.
draw text labels at dataset points
void SetFieldDataName(const char *arrayName)
Set/Get the name of the field data array to label.
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 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,...
vtkDataSet * GetInput()
Use GetInputDataObject() to get the input data object for composite datasets.
vtkTextMapper ** TextMappers
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,...
void SetLabelModeToLabelScalars()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
void SetFieldDataArray(int arrayIndex)
Set/Get the field data array to label.
virtual vtkTextProperty * GetLabelTextProperty()
Set/Get the text property.
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
virtual vtkTextProperty * GetLabelTextProperty(int type)
Set/Get the text property.
static vtkLabeledDataMapper * New()
Instantiate object with %%-#6.3g label format.
void SetTransform(vtkTransform *t)
The transform to apply to the labels before mapping to 2D.
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.
const char * GetLabelText(int label)
Return the text for the requested label.
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:36
2D text annotation
Definition: vtkTextMapper.h:60
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:45
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:70
abstract specification for Viewports
Definition: vtkViewport.h:65
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ Transform
Definition: vtkX3D.h:47
@ type
Definition: vtkX3D.h:522
#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