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 =========================================================================*/
52 #ifndef vtkLabeledDataMapper_h
53 #define vtkLabeledDataMapper_h
54 
55 #include "vtkRenderingLabelModule.h" // For export macro
56 #include "vtkMapper2D.h"
57 
58 #include <cassert> // For assert macro
59 
60 class vtkDataObject;
61 class vtkDataSet;
62 class vtkTextMapper;
63 class vtkTextProperty;
64 class vtkTransform;
65 
66 #define VTK_LABEL_IDS 0
67 #define VTK_LABEL_SCALARS 1
68 #define VTK_LABEL_VECTORS 2
69 #define VTK_LABEL_NORMALS 3
70 #define VTK_LABEL_TCOORDS 4
71 #define VTK_LABEL_TENSORS 5
72 #define VTK_LABEL_FIELD_DATA 6
73 
74 class VTKRENDERINGLABEL_EXPORT vtkLabeledDataMapper : public vtkMapper2D
75 {
76 public:
82 
84  void PrintSelf(ostream& os, vtkIndent indent);
85 
87 
99  vtkSetStringMacro(LabelFormat);
100  vtkGetStringMacro(LabelFormat);
102 
104 
111  vtkSetMacro(LabeledComponent,int);
112  vtkGetMacro(LabeledComponent,int);
114 
116 
121  void SetFieldDataArray(int arrayIndex);
122  vtkGetMacro(FieldDataArray,int);
124 
126 
131  void SetFieldDataName(const char *arrayName);
132  vtkGetStringMacro(FieldDataName);
134 
138  virtual void SetInputData(vtkDataObject*);
139 
145 
147 
153  vtkSetMacro(LabelMode, int);
154  vtkGetMacro(LabelMode, int);
155  void SetLabelModeToLabelIds() {this->SetLabelMode(VTK_LABEL_IDS);};
156  void SetLabelModeToLabelScalars() {this->SetLabelMode(VTK_LABEL_SCALARS);};
157  void SetLabelModeToLabelVectors() {this->SetLabelMode(VTK_LABEL_VECTORS);};
158  void SetLabelModeToLabelNormals() {this->SetLabelMode(VTK_LABEL_NORMALS);};
159  void SetLabelModeToLabelTCoords() {this->SetLabelMode(VTK_LABEL_TCOORDS);};
160  void SetLabelModeToLabelTensors() {this->SetLabelMode(VTK_LABEL_TENSORS);};
162  {this->SetLabelMode(VTK_LABEL_FIELD_DATA);};
164 
166 
173  { this->SetLabelTextProperty(p, 0); }
175  { return this->GetLabelTextProperty(0); }
179 
181 
184  void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor);
185  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor);
187 
192 
194 
197  vtkGetObjectMacro(Transform, vtkTransform);
200 
203  {
204  WORLD=0,
205  DISPLAY=1
206  };
207 
209 
213  vtkGetMacro(CoordinateSystem,int);
214  vtkSetClampMacro(CoordinateSystem,int,WORLD,DISPLAY);
215  void CoordinateSystemWorld() { this->SetCoordinateSystem( vtkLabeledDataMapper::WORLD ); }
216  void CoordinateSystemDisplay() { this->SetCoordinateSystem( vtkLabeledDataMapper::DISPLAY ); }
218 
223 
225 
228  vtkGetMacro(NumberOfLabels, int)
230 
232 
235  void GetLabelPosition(int label, double pos[3])
236  {
237  assert("label index range" && label >= 0 && label < this->NumberOfLabels);
238  pos[0] = this->LabelPositions[3 * label];
239  pos[1] = this->LabelPositions[3 * label + 1];
240  pos[2] = this->LabelPositions[3 * label + 2];
241  }
243 
247  const char *GetLabelText(int label);
248 
249 protected:
252 
254 
255  char *LabelFormat;
261 
263 
267  double* LabelPositions;
269 
271 
272  void AllocateLabels(int numLabels);
273  void BuildLabels();
275 
276  class Internals;
277  Internals* Implementation;
278 
279 private:
280  vtkLabeledDataMapper(const vtkLabeledDataMapper&) VTK_DELETE_FUNCTION;
281  void operator=(const vtkLabeledDataMapper&) VTK_DELETE_FUNCTION;
282 };
283 
284 #endif
285 
vtkLabeledDataMapper::RenderOpaqueGeometry
void RenderOpaqueGeometry(vtkViewport *viewport, vtkActor2D *actor)
Draw the text to the screen at each input point.
VTK_LABEL_VECTORS
#define VTK_LABEL_VECTORS
Definition: vtkLabeledDataMapper.h:68
vtkLabeledDataMapper::LabeledComponent
int LabeledComponent
Definition: vtkLabeledDataMapper.h:257
vtkLabeledDataMapper::SetLabelModeToLabelNormals
void SetLabelModeToLabelNormals()
Definition: vtkLabeledDataMapper.h:158
vtkLabeledDataMapper::LabelPositions
double * LabelPositions
Definition: vtkLabeledDataMapper.h:267
vtkLabeledDataMapper::CoordinateSystemDisplay
void CoordinateSystemDisplay()
Definition: vtkLabeledDataMapper.h:216
vtkLabeledDataMapper::CoordinateSystemWorld
void CoordinateSystemWorld()
Definition: vtkLabeledDataMapper.h:215
vtkLabeledDataMapper::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property.
Definition: vtkLabeledDataMapper.h:172
vtkX3D::type
@ type
Definition: vtkX3D.h:516
vtkLabeledDataMapper::SetLabelModeToLabelTCoords
void SetLabelModeToLabelTCoords()
Definition: vtkLabeledDataMapper.h:159
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:36
vtkLabeledDataMapper::Transform
vtkTransform * Transform
Definition: vtkLabeledDataMapper.h:268
vtkLabeledDataMapper::Implementation
Internals * Implementation
Definition: vtkLabeledDataMapper.h:276
vtkLabeledDataMapper::SetTransform
void SetTransform(vtkTransform *t)
vtkLabeledDataMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkMTimeType
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
vtkLabeledDataMapper::LabelFormat
char * LabelFormat
Definition: vtkLabeledDataMapper.h:255
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:54
vtkLabeledDataMapper::Coordinates
Coordinates
Coordinate systems that output dataset may use.
Definition: vtkLabeledDataMapper.h:203
ADIOS::Transform
Transform
Definition: ADIOSDefs.h:40
vtkLabeledDataMapper::GetLabelText
const char * GetLabelText(int label)
Return the text for the requested label.
VTK_LABEL_FIELD_DATA
#define VTK_LABEL_FIELD_DATA
Definition: vtkLabeledDataMapper.h:72
vtkLabeledDataMapper::SetLabelModeToLabelScalars
void SetLabelModeToLabelScalars()
Definition: vtkLabeledDataMapper.h:156
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:204
vtkMapper2D.h
vtkLabeledDataMapper::New
static vtkLabeledDataMapper * New()
Instantiate object with %%-#6.3g label format.
vtkLabeledDataMapper::GetLabelTextProperty
virtual vtkTextProperty * GetLabelTextProperty()
Definition: vtkLabeledDataMapper.h:174
vtkLabeledDataMapper::BuildLabels
void BuildLabels()
vtkLabeledDataMapper::NumberOfLabelsAllocated
int NumberOfLabelsAllocated
Definition: vtkLabeledDataMapper.h:265
vtkLabeledDataMapper::NumberOfLabels
int NumberOfLabels
Definition: vtkLabeledDataMapper.h:264
vtkLabeledDataMapper::LabelMode
int LabelMode
Definition: vtkLabeledDataMapper.h:256
vtkLabeledDataMapper::DISPLAY
@ DISPLAY
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant).
Definition: vtkLabeledDataMapper.h:205
vtkGetStringMacro
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkLabeledDataMapper::SetLabelModeToLabelIds
void SetLabelModeToLabelIds()
Definition: vtkLabeledDataMapper.h:155
VTK_LABEL_NORMALS
#define VTK_LABEL_NORMALS
Definition: vtkLabeledDataMapper.h:69
vtkLabeledDataMapper::SetLabelModeToLabelVectors
void SetLabelModeToLabelVectors()
Definition: vtkLabeledDataMapper.h:157
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
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkLabeledDataMapper::FillInputPortInformation
virtual int FillInputPortInformation(int, vtkInformation *)
Fill the input port information objects for this algorithm.
vtkLabeledDataMapper::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this actor.
vtkLabeledDataMapper::FieldDataArray
int FieldDataArray
Definition: vtkLabeledDataMapper.h:258
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:46
vtkLabeledDataMapper
draw text labels at dataset points
Definition: vtkLabeledDataMapper.h:75
vtkLabeledDataMapper::Input
vtkDataSet * Input
Definition: vtkLabeledDataMapper.h:253
vtkLabeledDataMapper::BuildTime
vtkTimeStamp BuildTime
Definition: vtkLabeledDataMapper.h:262
vtkLabeledDataMapper::SetFieldDataArray
void SetFieldDataArray(int arrayIndex)
Set/Get the field data array to label.
vtkLabeledDataMapper::SetLabelModeToLabelFieldData
void SetLabelModeToLabelFieldData()
Definition: vtkLabeledDataMapper.h:161
vtkLabeledDataMapper::BuildLabelsInternal
void BuildLabelsInternal(vtkDataSet *)
vtkLabeledDataMapper::AllocateLabels
void AllocateLabels(int numLabels)
vtkLabeledDataMapper::CoordinateSystem
int CoordinateSystem
Definition: vtkLabeledDataMapper.h:260
vtkLabeledDataMapper::vtkLabeledDataMapper
vtkLabeledDataMapper()
vtkLabeledDataMapper::TextMappers
vtkTextMapper ** TextMappers
Definition: vtkLabeledDataMapper.h:266
vtkLabeledDataMapper::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p, int type)
vtkLabeledDataMapper::~vtkLabeledDataMapper
~vtkLabeledDataMapper()
vtkLabeledDataMapper::FieldDataName
char * FieldDataName
Definition: vtkLabeledDataMapper.h:259
vtkLabeledDataMapper::SetLabelModeToLabelTensors
void SetLabelModeToLabelTensors()
Definition: vtkLabeledDataMapper.h:160
vtkLabeledDataMapper::GetMTime
virtual vtkMTimeType GetMTime()
Return the modified time for this object.
VTK_LABEL_TCOORDS
#define VTK_LABEL_TCOORDS
Definition: vtkLabeledDataMapper.h:70
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
VTK_LABEL_TENSORS
#define VTK_LABEL_TENSORS
Definition: vtkLabeledDataMapper.h:71
VTK_LABEL_SCALARS
#define VTK_LABEL_SCALARS
Definition: vtkLabeledDataMapper.h:67
vtkLabeledDataMapper::RenderOverlay
void RenderOverlay(vtkViewport *viewport, vtkActor2D *actor)
VTK_LABEL_IDS
#define VTK_LABEL_IDS
Definition: vtkLabeledDataMapper.h:66
vtkLabeledDataMapper::GetInput
vtkDataSet * GetInput()
Use GetInputDataObject() to get the input data object for composite datasets.
vtkLabeledDataMapper::GetLabelTextProperty
virtual vtkTextProperty * GetLabelTextProperty(int type)