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 =========================================================================*/
51 #ifndef vtkLabeledDataMapper_h
52 #define vtkLabeledDataMapper_h
53 
54 #include "vtkRenderingLabelModule.h" // For export macro
55 #include "vtkMapper2D.h"
56 
57 #include <cassert> // For assert macro
58 
59 class vtkDataObject;
60 class vtkDataSet;
61 class vtkTextMapper;
62 class vtkTextProperty;
63 class vtkTransform;
64 
65 #define VTK_LABEL_IDS 0
66 #define VTK_LABEL_SCALARS 1
67 #define VTK_LABEL_VECTORS 2
68 #define VTK_LABEL_NORMALS 3
69 #define VTK_LABEL_TCOORDS 4
70 #define VTK_LABEL_TENSORS 5
71 #define VTK_LABEL_FIELD_DATA 6
72 
74 {
75 public:
78  static vtkLabeledDataMapper *New();
79 
81  void PrintSelf(ostream& os, vtkIndent indent);
82 
84 
92  vtkSetStringMacro(LabelFormat);
93  vtkGetStringMacro(LabelFormat);
95 
97 
102  vtkSetMacro(LabeledComponent,int);
103  vtkGetMacro(LabeledComponent,int);
105 
107 
110  void SetFieldDataArray(int arrayIndex);
111  vtkGetMacro(FieldDataArray,int);
113 
115 
118  void SetFieldDataName(const char *arrayName);
119  vtkGetStringMacro(FieldDataName);
121 
124  virtual void SetInputData(vtkDataObject*);
125 
128  vtkDataSet *GetInput();
129 
131 
135  vtkSetMacro(LabelMode, int);
136  vtkGetMacro(LabelMode, int);
137  void SetLabelModeToLabelIds() {this->SetLabelMode(VTK_LABEL_IDS);};
138  void SetLabelModeToLabelScalars() {this->SetLabelMode(VTK_LABEL_SCALARS);};
139  void SetLabelModeToLabelVectors() {this->SetLabelMode(VTK_LABEL_VECTORS);};
140  void SetLabelModeToLabelNormals() {this->SetLabelMode(VTK_LABEL_NORMALS);};
141  void SetLabelModeToLabelTCoords() {this->SetLabelMode(VTK_LABEL_TCOORDS);};
142  void SetLabelModeToLabelTensors() {this->SetLabelMode(VTK_LABEL_TENSORS);};
144  {this->SetLabelMode(VTK_LABEL_FIELD_DATA);};
146 
148 
152  { this->SetLabelTextProperty(p, 0); }
154  { return this->GetLabelTextProperty(0); }
155  virtual void SetLabelTextProperty(vtkTextProperty *p, int type);
156  virtual vtkTextProperty* GetLabelTextProperty(int type);
158 
160 
161  void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor);
162  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor);
164 
166  virtual void ReleaseGraphicsResources(vtkWindow *);
167 
169 
170  vtkGetObjectMacro(Transform, vtkTransform);
171  void SetTransform(vtkTransform* t);
173 
174  //BTX
177  {
178  WORLD=0,
179  DISPLAY=1
180  };
181  //ETX
182 
184 
187  vtkGetMacro(CoordinateSystem,int);
188  vtkSetClampMacro(CoordinateSystem,int,WORLD,DISPLAY);
189  void CoordinateSystemWorld() { this->SetCoordinateSystem( vtkLabeledDataMapper::WORLD ); }
190  void CoordinateSystemDisplay() { this->SetCoordinateSystem( vtkLabeledDataMapper::DISPLAY ); }
192 
194  virtual unsigned long GetMTime();
195 
197 
198  vtkGetMacro(NumberOfLabels, int)
200 
202 
203  void GetLabelPosition(int label, double pos[3])
204  {
205  assert("label index range" && label >= 0 && label < this->NumberOfLabels);
206  pos[0] = this->LabelPositions[3 * label];
207  pos[1] = this->LabelPositions[3 * label + 1];
208  pos[2] = this->LabelPositions[3 * label + 2];
209  }
211 
213  const char *GetLabelText(int label);
214 
215 protected:
218 
220 
221  char *LabelFormat;
227 
229 
233  double* LabelPositions;
235 
236  virtual int FillInputPortInformation(int, vtkInformation*);
237 
238  void AllocateLabels(int numLabels);
239  void BuildLabels();
240  void BuildLabelsInternal(vtkDataSet*);
241 
242  //BTX
243  class Internals;
244  Internals* Implementation;
245  //ETX
246 
247 private:
248  vtkLabeledDataMapper(const vtkLabeledDataMapper&); // Not implemented.
249  void operator=(const vtkLabeledDataMapper&); // Not implemented.
250 };
251 
252 #endif
253 
virtual unsigned long GetMTime()
#define VTK_LABEL_NORMALS
#define VTK_LABEL_VECTORS
Store vtkAlgorithm input/output information.
virtual void RenderOverlay(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:40
abstract specification for Viewports
Definition: vtkViewport.h:46
Output 3-D world-space coordinates for each label anchor.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
#define VTK_LABEL_IDS
vtkTextMapper ** TextMappers
a actor that draws 2D data
Definition: vtkActor2D.h:44
record modification and/or execution time
Definition: vtkTimeStamp.h:34
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:59
2D text annotation
Definition: vtkTextMapper.h:52
draw text labels at dataset points
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
a simple class to control print indentation
Definition: vtkIndent.h:38
#define VTKRENDERINGLABEL_EXPORT
void PrintSelf(ostream &os, vtkIndent indent)
represent text properties.
virtual int FillInputPortInformation(int port, vtkInformation *info)
#define VTK_LABEL_TENSORS
#define VTK_LABEL_FIELD_DATA
virtual void ReleaseGraphicsResources(vtkWindow *)
virtual vtkTextProperty * GetLabelTextProperty()
static vtkAlgorithm * New()
virtual void RenderOpaqueGeometry(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:41
general representation of visualization data
Definition: vtkDataObject.h:64
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:34
virtual void SetLabelTextProperty(vtkTextProperty *p)
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant)...