VTK
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 =========================================================================*/
54 #ifndef vtkLabeledDataMapper_h
55 #define vtkLabeledDataMapper_h
56 
57 #include "vtkRenderingLabelModule.h" // For export macro
58 #include "vtkMapper2D.h"
59 
60 #include <cassert> // For assert macro
61 
62 class vtkDataObject;
63 class vtkDataSet;
64 class vtkTextMapper;
65 class vtkTextProperty;
66 class vtkTransform;
67 
68 #define VTK_LABEL_IDS 0
69 #define VTK_LABEL_SCALARS 1
70 #define VTK_LABEL_VECTORS 2
71 #define VTK_LABEL_NORMALS 3
72 #define VTK_LABEL_TCOORDS 4
73 #define VTK_LABEL_TENSORS 5
74 #define VTK_LABEL_FIELD_DATA 6
75 
76 class VTKRENDERINGLABEL_EXPORT vtkLabeledDataMapper : public vtkMapper2D
77 {
78 public:
84 
86  void PrintSelf(ostream& os, vtkIndent indent) override;
87 
89 
101  vtkSetStringMacro(LabelFormat);
102  vtkGetStringMacro(LabelFormat);
104 
106 
113  vtkSetMacro(LabeledComponent,int);
114  vtkGetMacro(LabeledComponent,int);
116 
118 
121  vtkSetMacro(ComponentSeparator,char);
122  vtkGetMacro(ComponentSeparator,char);
124 
126 
131  void SetFieldDataArray(int arrayIndex);
132  vtkGetMacro(FieldDataArray,int);
134 
136 
141  void SetFieldDataName(const char *arrayName);
142  vtkGetStringMacro(FieldDataName);
144 
148  virtual void SetInputData(vtkDataObject*);
149 
155 
157 
163  vtkSetMacro(LabelMode, int);
164  vtkGetMacro(LabelMode, int);
165  void SetLabelModeToLabelIds() {this->SetLabelMode(VTK_LABEL_IDS);};
166  void SetLabelModeToLabelScalars() {this->SetLabelMode(VTK_LABEL_SCALARS);};
167  void SetLabelModeToLabelVectors() {this->SetLabelMode(VTK_LABEL_VECTORS);};
168  void SetLabelModeToLabelNormals() {this->SetLabelMode(VTK_LABEL_NORMALS);};
169  void SetLabelModeToLabelTCoords() {this->SetLabelMode(VTK_LABEL_TCOORDS);};
170  void SetLabelModeToLabelTensors() {this->SetLabelMode(VTK_LABEL_TENSORS);};
172  {this->SetLabelMode(VTK_LABEL_FIELD_DATA);};
174 
176 
183  { this->SetLabelTextProperty(p, 0); }
185  { return this->GetLabelTextProperty(0); }
189 
191 
194  void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor) override;
195  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
197 
202 
204 
207  vtkGetObjectMacro(Transform, vtkTransform);
210 
213  {
214  WORLD=0,
215  DISPLAY=1
216  };
217 
219 
223  vtkGetMacro(CoordinateSystem,int);
224  vtkSetClampMacro(CoordinateSystem,int,WORLD,DISPLAY);
225  void CoordinateSystemWorld() { this->SetCoordinateSystem( vtkLabeledDataMapper::WORLD ); }
226  void CoordinateSystemDisplay() { this->SetCoordinateSystem( vtkLabeledDataMapper::DISPLAY ); }
228 
232  vtkMTimeType GetMTime() override;
233 
235 
238  vtkGetMacro(NumberOfLabels, int)
240 
242 
245  void GetLabelPosition(int label, double pos[3])
246  {
247  assert("label index range" && label >= 0 && label < this->NumberOfLabels);
248  pos[0] = this->LabelPositions[3 * label];
249  pos[1] = this->LabelPositions[3 * label + 1];
250  pos[2] = this->LabelPositions[3 * label + 2];
251  }
253 
257  const char *GetLabelText(int label);
258 
259 protected:
262 
264 
265  char *LabelFormat;
271 
273 
275 
279  double* LabelPositions;
281 
283 
284  void AllocateLabels(int numLabels);
285  void BuildLabels();
287 
288  class Internals;
289  Internals* Implementation;
290 
291 private:
293  void operator=(const vtkLabeledDataMapper&) = delete;
294 };
295 
296 #endif
297 
VTK_LABEL_VECTORS
#define VTK_LABEL_VECTORS
Definition: vtkLabeledDataMapper.h:70
vtkLabeledDataMapper::LabeledComponent
int LabeledComponent
Definition: vtkLabeledDataMapper.h:267
vtkLabeledDataMapper::SetLabelModeToLabelNormals
void SetLabelModeToLabelNormals()
Definition: vtkLabeledDataMapper.h:168
vtkLabeledDataMapper::LabelPositions
double * LabelPositions
Definition: vtkLabeledDataMapper.h:279
vtkLabeledDataMapper::CoordinateSystemDisplay
void CoordinateSystemDisplay()
Definition: vtkLabeledDataMapper.h:226
vtkLabeledDataMapper::CoordinateSystemWorld
void CoordinateSystemWorld()
Definition: vtkLabeledDataMapper.h:225
vtkLabeledDataMapper::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property.
Definition: vtkLabeledDataMapper.h:182
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:516
vtkLabeledDataMapper::SetLabelModeToLabelTCoords
void SetLabelModeToLabelTCoords()
Definition: vtkLabeledDataMapper.h:169
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:36
vtkLabeledDataMapper::Transform
vtkTransform * Transform
Definition: vtkLabeledDataMapper.h:280
vtkLabeledDataMapper::Implementation
Internals * Implementation
Definition: vtkLabeledDataMapper.h:288
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:61
vtkLabeledDataMapper::ComponentSeparator
char ComponentSeparator
Definition: vtkLabeledDataMapper.h:272
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
vtkLabeledDataMapper::LabelFormat
char * LabelFormat
Definition: vtkLabeledDataMapper.h:265
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:54
vtkLabeledDataMapper::Coordinates
Coordinates
Coordinate systems that output dataset may use.
Definition: vtkLabeledDataMapper.h:213
ADIOS::Transform
Transform
Definition: ADIOSDefs.h:41
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:74
vtkLabeledDataMapper::GetMTime
vtkMTimeType GetMTime() override
Return the modified time for this object.
vtkLabeledDataMapper::SetLabelModeToLabelScalars
void SetLabelModeToLabelScalars()
Definition: vtkLabeledDataMapper.h:166
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkLabeledDataMapper::WORLD
@ WORLD
Output 3-D world-space coordinates for each label anchor.
Definition: vtkLabeledDataMapper.h:214
vtkMapper2D.h
vtkLabeledDataMapper::New
static vtkLabeledDataMapper * New()
Instantiate object with %%-#6.3g label format.
vtkLabeledDataMapper::GetLabelTextProperty
virtual vtkTextProperty * GetLabelTextProperty()
Definition: vtkLabeledDataMapper.h:184
vtkLabeledDataMapper::BuildLabels
void BuildLabels()
vtkLabeledDataMapper::NumberOfLabelsAllocated
int NumberOfLabelsAllocated
Definition: vtkLabeledDataMapper.h:277
vtkLabeledDataMapper::NumberOfLabels
int NumberOfLabels
Definition: vtkLabeledDataMapper.h:276
vtkLabeledDataMapper::LabelMode
int LabelMode
Definition: vtkLabeledDataMapper.h:266
vtkLabeledDataMapper::DISPLAY
@ DISPLAY
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant).
Definition: vtkLabeledDataMapper.h:215
vtkLabeledDataMapper::SetLabelModeToLabelIds
void SetLabelModeToLabelIds()
Definition: vtkLabeledDataMapper.h:165
VTK_LABEL_NORMALS
#define VTK_LABEL_NORMALS
Definition: vtkLabeledDataMapper.h:71
vtkLabeledDataMapper::SetLabelModeToLabelVectors
void SetLabelModeToLabelVectors()
Definition: vtkLabeledDataMapper.h:167
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:48
vtkLabeledDataMapper::SetInputData
virtual void SetInputData(vtkDataObject *)
Set the input dataset to the mapper.
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:87
vtkLabeledDataMapper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
vtkLabeledDataMapper::FieldDataArray
int FieldDataArray
Definition: vtkLabeledDataMapper.h:268
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:46
vtkLabeledDataMapper
draw text labels at dataset points
Definition: vtkLabeledDataMapper.h:77
vtkLabeledDataMapper::Input
vtkDataSet * Input
Definition: vtkLabeledDataMapper.h:263
vtkLabeledDataMapper::BuildTime
vtkTimeStamp BuildTime
Definition: vtkLabeledDataMapper.h:274
vtkLabeledDataMapper::SetFieldDataArray
void SetFieldDataArray(int arrayIndex)
Set/Get the field data array to label.
vtkLabeledDataMapper::SetLabelModeToLabelFieldData
void SetLabelModeToLabelFieldData()
Definition: vtkLabeledDataMapper.h:171
vtkLabeledDataMapper::BuildLabelsInternal
void BuildLabelsInternal(vtkDataSet *)
vtkLabeledDataMapper::AllocateLabels
void AllocateLabels(int numLabels)
vtkLabeledDataMapper::CoordinateSystem
int CoordinateSystem
Definition: vtkLabeledDataMapper.h:270
vtkLabeledDataMapper::vtkLabeledDataMapper
vtkLabeledDataMapper()
vtkLabeledDataMapper::TextMappers
vtkTextMapper ** TextMappers
Definition: vtkLabeledDataMapper.h:278
vtkLabeledDataMapper::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p, int type)
vtkLabeledDataMapper::FieldDataName
char * FieldDataName
Definition: vtkLabeledDataMapper.h:269
vtkLabeledDataMapper::SetLabelModeToLabelTensors
void SetLabelModeToLabelTensors()
Definition: vtkLabeledDataMapper.h:170
VTK_LABEL_TCOORDS
#define VTK_LABEL_TCOORDS
Definition: vtkLabeledDataMapper.h:72
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
VTK_LABEL_TENSORS
#define VTK_LABEL_TENSORS
Definition: vtkLabeledDataMapper.h:73
VTK_LABEL_SCALARS
#define VTK_LABEL_SCALARS
Definition: vtkLabeledDataMapper.h:69
vtkLabeledDataMapper::~vtkLabeledDataMapper
~vtkLabeledDataMapper() override
VTK_LABEL_IDS
#define VTK_LABEL_IDS
Definition: vtkLabeledDataMapper.h:68
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:302