VTK  9.1.0
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 =========================================================================*/
117 #ifndef vtkLabeledDataMapper_h
118 #define vtkLabeledDataMapper_h
119 
120 #include "vtkMapper2D.h"
121 #include "vtkRenderingLabelModule.h" // For export macro
122 
123 #include <cassert> // For assert macro
124 
125 class vtkDataObject;
126 class vtkDataSet;
127 class vtkTextMapper;
128 class vtkTextProperty;
129 class vtkTransform;
130 
131 #define VTK_LABEL_IDS 0
132 #define VTK_LABEL_SCALARS 1
133 #define VTK_LABEL_VECTORS 2
134 #define VTK_LABEL_NORMALS 3
135 #define VTK_LABEL_TCOORDS 4
136 #define VTK_LABEL_TENSORS 5
137 #define VTK_LABEL_FIELD_DATA 6
138 
139 class VTKRENDERINGLABEL_EXPORT vtkLabeledDataMapper : public vtkMapper2D
140 {
141 public:
147 
149  void PrintSelf(ostream& os, vtkIndent indent) override;
150 
152 
164  vtkSetStringMacro(LabelFormat);
165  vtkGetStringMacro(LabelFormat);
167 
169 
176  vtkSetMacro(LabeledComponent, int);
177  vtkGetMacro(LabeledComponent, int);
179 
181 
184  vtkSetMacro(ComponentSeparator, char);
185  vtkGetMacro(ComponentSeparator, char);
187 
189 
194  void SetFieldDataArray(int arrayIndex);
195  vtkGetMacro(FieldDataArray, int);
197 
199 
204  void SetFieldDataName(const char* arrayName);
205  vtkGetStringMacro(FieldDataName);
207 
211  virtual void SetInputData(vtkDataObject*);
212 
218 
220 
226  vtkSetMacro(LabelMode, int);
227  vtkGetMacro(LabelMode, int);
228  void SetLabelModeToLabelIds() { this->SetLabelMode(VTK_LABEL_IDS); }
229  void SetLabelModeToLabelScalars() { this->SetLabelMode(VTK_LABEL_SCALARS); }
230  void SetLabelModeToLabelVectors() { this->SetLabelMode(VTK_LABEL_VECTORS); }
231  void SetLabelModeToLabelNormals() { this->SetLabelMode(VTK_LABEL_NORMALS); }
232  void SetLabelModeToLabelTCoords() { this->SetLabelMode(VTK_LABEL_TCOORDS); }
233  void SetLabelModeToLabelTensors() { this->SetLabelMode(VTK_LABEL_TENSORS); }
234  void SetLabelModeToLabelFieldData() { this->SetLabelMode(VTK_LABEL_FIELD_DATA); }
236 
238 
249 
251 
254  void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor) override;
255  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
257 
262 
264 
267  vtkGetObjectMacro(Transform, vtkTransform);
270 
273  {
274  WORLD = 0,
275  DISPLAY = 1
276  };
278 
280 
284  vtkGetMacro(CoordinateSystem, int);
285  vtkSetClampMacro(CoordinateSystem, int, WORLD, DISPLAY);
286  void CoordinateSystemWorld() { this->SetCoordinateSystem(vtkLabeledDataMapper::WORLD); }
287  void CoordinateSystemDisplay() { this->SetCoordinateSystem(vtkLabeledDataMapper::DISPLAY); }
289 
293  vtkMTimeType GetMTime() override;
294 
296 
299  vtkGetMacro(NumberOfLabels, int);
301 
303 
306  void GetLabelPosition(int label, double pos[3])
307  {
308  assert("label index range" && label >= 0 && label < this->NumberOfLabels);
309  pos[0] = this->LabelPositions[3 * label];
310  pos[1] = this->LabelPositions[3 * label + 1];
311  pos[2] = this->LabelPositions[3 * label + 2];
312  }
314 
318  const char* GetLabelText(int label);
319 
320 protected:
323 
325 
326  char* LabelFormat;
332 
334 
336 
340  double* LabelPositions;
342 
344 
345  void AllocateLabels(int numLabels);
346  void BuildLabels();
348 
349  class Internals;
350  Internals* Implementation;
351 
352 private:
354  void operator=(const vtkLabeledDataMapper&) = delete;
355 };
356 
357 #endif
VTK_LABEL_VECTORS
#define VTK_LABEL_VECTORS
Definition: vtkLabeledDataMapper.h:133
vtkLabeledDataMapper::LabeledComponent
int LabeledComponent
Definition: vtkLabeledDataMapper.h:328
vtkLabeledDataMapper::SetLabelModeToLabelNormals
void SetLabelModeToLabelNormals()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
Definition: vtkLabeledDataMapper.h:231
vtkLabeledDataMapper::LabelPositions
double * LabelPositions
Definition: vtkLabeledDataMapper.h:340
vtkLabeledDataMapper::CoordinateSystemDisplay
void CoordinateSystemDisplay()
Set/get the coordinate system used for output labels.
Definition: vtkLabeledDataMapper.h:287
vtkLabeledDataMapper::CoordinateSystemWorld
void CoordinateSystemWorld()
Set/get the coordinate system used for output labels.
Definition: vtkLabeledDataMapper.h:286
vtkLabeledDataMapper::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property.
Definition: vtkLabeledDataMapper.h:244
vtkLabeledDataMapper::FillInputPortInformation
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
vtkLabeledDataMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::type
@ type
Definition: vtkX3D.h:522
vtkLabeledDataMapper::SetLabelModeToLabelTCoords
void SetLabelModeToLabelTCoords()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
Definition: vtkLabeledDataMapper.h:232
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:52
vtkLabeledDataMapper::Transform
vtkTransform * Transform
Definition: vtkLabeledDataMapper.h:341
vtkLabeledDataMapper::Implementation
Internals * Implementation
Definition: vtkLabeledDataMapper.h:349
vtkLabeledDataMapper::SetTransform
void SetTransform(vtkTransform *t)
The transform to apply to the labels before mapping to 2D.
vtkLabeledDataMapper::RenderOpaqueGeometry
void RenderOpaqueGeometry(vtkViewport *viewport, vtkActor2D *actor) override
Draw the text to the screen at each input point.
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:164
vtkLabeledDataMapper::ComponentSeparator
char ComponentSeparator
Definition: vtkLabeledDataMapper.h:333
vtkX3D::Transform
@ Transform
Definition: vtkX3D.h:47
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
vtkLabeledDataMapper::LabelFormat
char * LabelFormat
Definition: vtkLabeledDataMapper.h:326
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:157
vtkLabeledDataMapper::Coordinates
Coordinates
Coordinate systems that output dataset may use.
Definition: vtkLabeledDataMapper.h:273
vtkLabeledDataMapper::GetLabelText
const char * GetLabelText(int label)
Return the text for the requested label.
vtkLabeledDataMapper::RenderOverlay
void RenderOverlay(vtkViewport *viewport, vtkActor2D *actor) override
Draw the text to the screen at each input point.
VTK_LABEL_FIELD_DATA
#define VTK_LABEL_FIELD_DATA
Definition: vtkLabeledDataMapper.h:137
vtkLabeledDataMapper::GetMTime
vtkMTimeType GetMTime() override
Return the modified time for this object.
vtkLabeledDataMapper::SetLabelModeToLabelScalars
void SetLabelModeToLabelScalars()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
Definition: vtkLabeledDataMapper.h:229
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkLabeledDataMapper::WORLD
@ WORLD
Output 3-D world-space coordinates for each label anchor.
Definition: vtkLabeledDataMapper.h:274
vtkMapper2D.h
vtkLabeledDataMapper::New
static vtkLabeledDataMapper * New()
Instantiate object with %%-#6.3g label format.
vtkLabeledDataMapper::GetLabelTextProperty
virtual vtkTextProperty * GetLabelTextProperty()
Set/Get the text property.
Definition: vtkLabeledDataMapper.h:245
vtkLabeledDataMapper::BuildLabels
void BuildLabels()
vtkLabeledDataMapper::NumberOfLabelsAllocated
int NumberOfLabelsAllocated
Definition: vtkLabeledDataMapper.h:338
vtkLabeledDataMapper::NumberOfLabels
int NumberOfLabels
Definition: vtkLabeledDataMapper.h:337
vtkLabeledDataMapper::LabelMode
int LabelMode
Definition: vtkLabeledDataMapper.h:327
vtkLabeledDataMapper::DISPLAY
@ DISPLAY
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant).
Definition: vtkLabeledDataMapper.h:275
vtkLabeledDataMapper::SetLabelModeToLabelIds
void SetLabelModeToLabelIds()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
Definition: vtkLabeledDataMapper.h:228
VTK_LABEL_NORMALS
#define VTK_LABEL_NORMALS
Definition: vtkLabeledDataMapper.h:134
vtkLabeledDataMapper::SetLabelModeToLabelVectors
void SetLabelModeToLabelVectors()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
Definition: vtkLabeledDataMapper.h:230
vtkMapper2D
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:36
vtkLabeledDataMapper::SetFieldDataName
void SetFieldDataName(const char *arrayName)
Set/Get the name of the field data array to label.
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkLabeledDataMapper::GetLabelPosition
void GetLabelPosition(int label, double pos[3])
Return the position of the requested label.
Definition: vtkLabeledDataMapper.h:306
vtkLabeledDataMapper::SetInputData
virtual void SetInputData(vtkDataObject *)
Set the input dataset to the mapper.
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:143
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkLabeledDataMapper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
vtkLabeledDataMapper::FieldDataArray
int FieldDataArray
Definition: vtkLabeledDataMapper.h:329
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:149
vtkLabeledDataMapper
draw text labels at dataset points
Definition: vtkLabeledDataMapper.h:140
vtkLabeledDataMapper::Input
vtkDataSet * Input
Definition: vtkLabeledDataMapper.h:324
vtkLabeledDataMapper::BuildTime
vtkTimeStamp BuildTime
Definition: vtkLabeledDataMapper.h:335
vtkLabeledDataMapper::SetFieldDataArray
void SetFieldDataArray(int arrayIndex)
Set/Get the field data array to label.
vtkLabeledDataMapper::SetLabelModeToLabelFieldData
void SetLabelModeToLabelFieldData()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
Definition: vtkLabeledDataMapper.h:234
vtkLabeledDataMapper::BuildLabelsInternal
void BuildLabelsInternal(vtkDataSet *)
vtkLabeledDataMapper::AllocateLabels
void AllocateLabels(int numLabels)
vtkLabeledDataMapper::CoordinateSystem
int CoordinateSystem
Definition: vtkLabeledDataMapper.h:331
vtkLabeledDataMapper::vtkLabeledDataMapper
vtkLabeledDataMapper()
vtkLabeledDataMapper::TextMappers
vtkTextMapper ** TextMappers
Definition: vtkLabeledDataMapper.h:339
vtkLabeledDataMapper::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p, int type)
Set/Get the text property.
vtkLabeledDataMapper::FieldDataName
char * FieldDataName
Definition: vtkLabeledDataMapper.h:330
vtkLabeledDataMapper::SetLabelModeToLabelTensors
void SetLabelModeToLabelTensors()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors,...
Definition: vtkLabeledDataMapper.h:233
VTK_LABEL_TCOORDS
#define VTK_LABEL_TCOORDS
Definition: vtkLabeledDataMapper.h:135
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:169
VTK_LABEL_TENSORS
#define VTK_LABEL_TENSORS
Definition: vtkLabeledDataMapper.h:136
VTK_LABEL_SCALARS
#define VTK_LABEL_SCALARS
Definition: vtkLabeledDataMapper.h:132
vtkLabeledDataMapper::~vtkLabeledDataMapper
~vtkLabeledDataMapper() override
VTK_LABEL_IDS
#define VTK_LABEL_IDS
Definition: vtkLabeledDataMapper.h:131
vtkLabeledDataMapper::GetInput
vtkDataSet * GetInput()
Use GetInputDataObject() to get the input data object for composite datasets.
vtkLabeledDataMapper::GetLabelTextProperty
virtual vtkTextProperty * GetLabelTextProperty(int type)
Set/Get the text property.
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287