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 
a actor that draws 2D data
Definition: vtkActor2D.h:46
general representation of visualization data
Definition: vtkDataObject.h:65
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
a simple class to control print indentation
Definition: vtkIndent.h:40
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.
void RenderOverlay(vtkViewport *viewport, vtkActor2D *actor)
virtual void SetLabelTextProperty(vtkTextProperty *p, int type)
virtual void SetInputData(vtkDataObject *)
Set the input dataset to the mapper.
vtkDataSet * GetInput()
Use GetInputDataObject() to get the input data object for composite datasets.
vtkTextMapper ** TextMappers
void AllocateLabels(int numLabels)
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property.
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this actor.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void SetFieldDataArray(int arrayIndex)
Set/Get the field data array to label.
void RenderOpaqueGeometry(vtkViewport *viewport, vtkActor2D *actor)
Draw the text to the screen at each input point.
virtual vtkTextProperty * GetLabelTextProperty()
virtual vtkMTimeType GetMTime()
Return the modified time for this object.
virtual int FillInputPortInformation(int, vtkInformation *)
Fill the input port information objects for this algorithm.
virtual vtkTextProperty * GetLabelTextProperty(int type)
static vtkLabeledDataMapper * New()
Instantiate object with %%-#6.3g label format.
void SetTransform(vtkTransform *t)
void BuildLabelsInternal(vtkDataSet *)
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:54
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:36
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
abstract specification for Viewports
Definition: vtkViewport.h:48
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
Transform
Definition: ADIOSDefs.h:40
@ type
Definition: vtkX3D.h:516
#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
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248