VTK  9.0.1
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 =========================================================================*/
48 #ifndef vtkLabeledDataMapper_h
49 #define vtkLabeledDataMapper_h
50 
51 #include "vtkMapper2D.h"
52 #include "vtkRenderingLabelModule.h" // For export macro
53 
54 #include <cassert> // For assert macro
55 
56 class vtkDataObject;
57 class vtkDataSet;
58 class vtkTextMapper;
59 class vtkTextProperty;
60 class vtkTransform;
61 
62 #define VTK_LABEL_IDS 0
63 #define VTK_LABEL_SCALARS 1
64 #define VTK_LABEL_VECTORS 2
65 #define VTK_LABEL_NORMALS 3
66 #define VTK_LABEL_TCOORDS 4
67 #define VTK_LABEL_TENSORS 5
68 #define VTK_LABEL_FIELD_DATA 6
69 
70 class VTKRENDERINGLABEL_EXPORT vtkLabeledDataMapper : public vtkMapper2D
71 {
72 public:
78 
80  void PrintSelf(ostream& os, vtkIndent indent) override;
81 
83 
95  vtkSetStringMacro(LabelFormat);
96  vtkGetStringMacro(LabelFormat);
98 
100 
107  vtkSetMacro(LabeledComponent, int);
108  vtkGetMacro(LabeledComponent, int);
110 
112 
115  vtkSetMacro(ComponentSeparator, char);
116  vtkGetMacro(ComponentSeparator, char);
118 
120 
125  void SetFieldDataArray(int arrayIndex);
126  vtkGetMacro(FieldDataArray, int);
128 
130 
135  void SetFieldDataName(const char* arrayName);
136  vtkGetStringMacro(FieldDataName);
138 
142  virtual void SetInputData(vtkDataObject*);
143 
149 
151 
157  vtkSetMacro(LabelMode, int);
158  vtkGetMacro(LabelMode, int);
159  void SetLabelModeToLabelIds() { this->SetLabelMode(VTK_LABEL_IDS); }
160  void SetLabelModeToLabelScalars() { this->SetLabelMode(VTK_LABEL_SCALARS); }
161  void SetLabelModeToLabelVectors() { this->SetLabelMode(VTK_LABEL_VECTORS); }
162  void SetLabelModeToLabelNormals() { this->SetLabelMode(VTK_LABEL_NORMALS); }
163  void SetLabelModeToLabelTCoords() { this->SetLabelMode(VTK_LABEL_TCOORDS); }
164  void SetLabelModeToLabelTensors() { this->SetLabelMode(VTK_LABEL_TENSORS); }
165  void SetLabelModeToLabelFieldData() { this->SetLabelMode(VTK_LABEL_FIELD_DATA); }
167 
169 
180 
182 
185  void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor) override;
186  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
188 
193 
195 
198  vtkGetObjectMacro(Transform, vtkTransform);
201 
204  {
205  WORLD = 0,
206  DISPLAY = 1
207  };
209 
211 
215  vtkGetMacro(CoordinateSystem, int);
216  vtkSetClampMacro(CoordinateSystem, int, WORLD, DISPLAY);
217  void CoordinateSystemWorld() { this->SetCoordinateSystem(vtkLabeledDataMapper::WORLD); }
218  void CoordinateSystemDisplay() { this->SetCoordinateSystem(vtkLabeledDataMapper::DISPLAY); }
220 
224  vtkMTimeType GetMTime() override;
225 
227 
230  vtkGetMacro(NumberOfLabels, int);
232 
234 
237  void GetLabelPosition(int label, double pos[3])
238  {
239  assert("label index range" && label >= 0 && label < this->NumberOfLabels);
240  pos[0] = this->LabelPositions[3 * label];
241  pos[1] = this->LabelPositions[3 * label + 1];
242  pos[2] = this->LabelPositions[3 * label + 2];
243  }
245 
249  const char* GetLabelText(int label);
250 
251 protected:
254 
256 
257  char* LabelFormat;
263 
265 
267 
271  double* LabelPositions;
273 
275 
276  void AllocateLabels(int numLabels);
277  void BuildLabels();
279 
280  class Internals;
281  Internals* Implementation;
282 
283 private:
285  void operator=(const vtkLabeledDataMapper&) = delete;
286 };
287 
288 #endif
VTK_LABEL_VECTORS
#define VTK_LABEL_VECTORS
Definition: vtkLabeledDataMapper.h:64
vtkLabeledDataMapper::LabeledComponent
int LabeledComponent
Definition: vtkLabeledDataMapper.h:259
vtkLabeledDataMapper::SetLabelModeToLabelNormals
void SetLabelModeToLabelNormals()
Definition: vtkLabeledDataMapper.h:162
vtkLabeledDataMapper::LabelPositions
double * LabelPositions
Definition: vtkLabeledDataMapper.h:271
vtkLabeledDataMapper::CoordinateSystemDisplay
void CoordinateSystemDisplay()
Definition: vtkLabeledDataMapper.h:218
vtkLabeledDataMapper::CoordinateSystemWorld
void CoordinateSystemWorld()
Definition: vtkLabeledDataMapper.h:217
vtkLabeledDataMapper::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property.
Definition: vtkLabeledDataMapper.h:175
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()
Definition: vtkLabeledDataMapper.h:163
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:33
vtkLabeledDataMapper::Transform
vtkTransform * Transform
Definition: vtkLabeledDataMapper.h:272
vtkLabeledDataMapper::Implementation
Internals * Implementation
Definition: vtkLabeledDataMapper.h:280
vtkLabeledDataMapper::SetTransform
void SetTransform(vtkTransform *t)
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:55
vtkLabeledDataMapper::ComponentSeparator
char ComponentSeparator
Definition: vtkLabeledDataMapper.h:264
vtkX3D::Transform
@ Transform
Definition: vtkX3D.h:47
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkLabeledDataMapper::LabelFormat
char * LabelFormat
Definition: vtkLabeledDataMapper.h:257
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:48
vtkLabeledDataMapper::Coordinates
Coordinates
Coordinate systems that output dataset may use.
Definition: vtkLabeledDataMapper.h:204
vtkLabeledDataMapper::GetLabelText
const char * GetLabelText(int label)
Return the text for the requested label.
vtkLabeledDataMapper::RenderOverlay
void RenderOverlay(vtkViewport *viewport, vtkActor2D *actor) override
VTK_LABEL_FIELD_DATA
#define VTK_LABEL_FIELD_DATA
Definition: vtkLabeledDataMapper.h:68
vtkLabeledDataMapper::GetMTime
vtkMTimeType GetMTime() override
Return the modified time for this object.
vtkLabeledDataMapper::SetLabelModeToLabelScalars
void SetLabelModeToLabelScalars()
Definition: vtkLabeledDataMapper.h:160
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkLabeledDataMapper::WORLD
@ WORLD
Output 3-D world-space coordinates for each label anchor.
Definition: vtkLabeledDataMapper.h:205
vtkMapper2D.h
vtkLabeledDataMapper::New
static vtkLabeledDataMapper * New()
Instantiate object with %%-#6.3g label format.
vtkLabeledDataMapper::GetLabelTextProperty
virtual vtkTextProperty * GetLabelTextProperty()
Definition: vtkLabeledDataMapper.h:176
vtkLabeledDataMapper::BuildLabels
void BuildLabels()
vtkLabeledDataMapper::NumberOfLabelsAllocated
int NumberOfLabelsAllocated
Definition: vtkLabeledDataMapper.h:269
vtkLabeledDataMapper::NumberOfLabels
int NumberOfLabels
Definition: vtkLabeledDataMapper.h:268
vtkLabeledDataMapper::LabelMode
int LabelMode
Definition: vtkLabeledDataMapper.h:258
vtkLabeledDataMapper::DISPLAY
@ DISPLAY
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant).
Definition: vtkLabeledDataMapper.h:206
vtkLabeledDataMapper::SetLabelModeToLabelIds
void SetLabelModeToLabelIds()
Definition: vtkLabeledDataMapper.h:159
VTK_LABEL_NORMALS
#define VTK_LABEL_NORMALS
Definition: vtkLabeledDataMapper.h:65
vtkLabeledDataMapper::SetLabelModeToLabelVectors
void SetLabelModeToLabelVectors()
Definition: vtkLabeledDataMapper.h:161
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:45
vtkLabeledDataMapper::GetLabelPosition
void GetLabelPosition(int label, double pos[3])
Return the position of the requested label.
Definition: vtkLabeledDataMapper.h:237
vtkLabeledDataMapper::SetInputData
virtual void SetInputData(vtkDataObject *)
Set the input dataset to the mapper.
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:34
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:65
vtkLabeledDataMapper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
vtkLabeledDataMapper::FieldDataArray
int FieldDataArray
Definition: vtkLabeledDataMapper.h:260
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:40
vtkLabeledDataMapper
draw text labels at dataset points
Definition: vtkLabeledDataMapper.h:71
vtkLabeledDataMapper::Input
vtkDataSet * Input
Definition: vtkLabeledDataMapper.h:255
vtkLabeledDataMapper::BuildTime
vtkTimeStamp BuildTime
Definition: vtkLabeledDataMapper.h:266
vtkLabeledDataMapper::SetFieldDataArray
void SetFieldDataArray(int arrayIndex)
Set/Get the field data array to label.
vtkLabeledDataMapper::SetLabelModeToLabelFieldData
void SetLabelModeToLabelFieldData()
Definition: vtkLabeledDataMapper.h:165
vtkLabeledDataMapper::BuildLabelsInternal
void BuildLabelsInternal(vtkDataSet *)
vtkLabeledDataMapper::AllocateLabels
void AllocateLabels(int numLabels)
vtkLabeledDataMapper::CoordinateSystem
int CoordinateSystem
Definition: vtkLabeledDataMapper.h:262
vtkLabeledDataMapper::vtkLabeledDataMapper
vtkLabeledDataMapper()
vtkLabeledDataMapper::TextMappers
vtkTextMapper ** TextMappers
Definition: vtkLabeledDataMapper.h:270
vtkLabeledDataMapper::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p, int type)
vtkLabeledDataMapper::FieldDataName
char * FieldDataName
Definition: vtkLabeledDataMapper.h:261
vtkLabeledDataMapper::SetLabelModeToLabelTensors
void SetLabelModeToLabelTensors()
Definition: vtkLabeledDataMapper.h:164
VTK_LABEL_TCOORDS
#define VTK_LABEL_TCOORDS
Definition: vtkLabeledDataMapper.h:66
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:60
VTK_LABEL_TENSORS
#define VTK_LABEL_TENSORS
Definition: vtkLabeledDataMapper.h:67
VTK_LABEL_SCALARS
#define VTK_LABEL_SCALARS
Definition: vtkLabeledDataMapper.h:63
vtkLabeledDataMapper::~vtkLabeledDataMapper
~vtkLabeledDataMapper() override
VTK_LABEL_IDS
#define VTK_LABEL_IDS
Definition: vtkLabeledDataMapper.h:62
vtkLabeledDataMapper::GetInput
vtkDataSet * GetInput()
Use GetInputDataObject() to get the input data object for composite datasets.
vtkLabeledDataMapper::GetLabelTextProperty
virtual vtkTextProperty * GetLabelTextProperty(int type)
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293