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:
81  static vtkLabeledDataMapper *New();
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 
144  vtkDataSet *GetInput();
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); }
176  virtual void SetLabelTextProperty(vtkTextProperty *p, int type);
177  virtual vtkTextProperty* GetLabelTextProperty(int type);
179 
181 
184  void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor);
185  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor);
187 
191  virtual void ReleaseGraphicsResources(vtkWindow *);
192 
194 
197  vtkGetObjectMacro(Transform, vtkTransform);
198  void SetTransform(vtkTransform* t);
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 
222  virtual vtkMTimeType GetMTime();
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 
270  virtual int FillInputPortInformation(int, vtkInformation*);
271 
272  void AllocateLabels(int numLabels);
273  void BuildLabels();
274  void BuildLabelsInternal(vtkDataSet*);
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 
void SetLabelModeToLabelFieldData()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors, or field data.
void CoordinateSystemWorld()
Set/get the coordinate system used for output labels.
#define VTK_LABEL_NORMALS
#define VTK_LABEL_VECTORS
void SetLabelModeToLabelTCoords()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors, or field data.
Store vtkAlgorithm input/output information.
virtual void RenderOverlay(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:41
abstract specification for Viewports
Definition: vtkViewport.h:47
Output 3-D world-space coordinates for each label anchor.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
virtual vtkMTimeType GetMTime()
Override Modifiedtime as we have added Clipping planes.
void SetLabelModeToLabelTensors()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors, or field data.
#define VTK_LABEL_IDS
vtkTextMapper ** TextMappers
a actor that draws 2D data
Definition: vtkActor2D.h:45
record modification and/or execution time
Definition: vtkTimeStamp.h:35
Coordinates
Coordinate systems that output dataset may use.
#define VTK_LABEL_SCALARS
#define VTK_LABEL_TCOORDS
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
void SetLabelModeToLabelIds()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors, or field data.
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
2D text annotation
Definition: vtkTextMapper.h:53
draw text labels at dataset points
void SetLabelModeToLabelVectors()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors, or field data.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
void CoordinateSystemDisplay()
Set/get the coordinate system used for output labels.
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
represent text properties.
void SetLabelModeToLabelScalars()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors, or field data.
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
#define VTK_LABEL_TENSORS
#define VTK_LABEL_FIELD_DATA
void SetLabelModeToLabelNormals()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors, or field data.
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
virtual vtkTextProperty * GetLabelTextProperty()
Set/Get the text property.
static vtkAlgorithm * New()
virtual void RenderOpaqueGeometry(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:42
general representation of visualization data
Definition: vtkDataObject.h:64
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:35
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property.
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant)...
Transform
Definition: ADIOSDefs.h:39