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 class vtkDataObject;
58 class vtkDataSet;
59 class vtkTextMapper;
60 class vtkTextProperty;
61 class vtkTransform;
62 
63 #define VTK_LABEL_IDS 0
64 #define VTK_LABEL_SCALARS 1
65 #define VTK_LABEL_VECTORS 2
66 #define VTK_LABEL_NORMALS 3
67 #define VTK_LABEL_TCOORDS 4
68 #define VTK_LABEL_TENSORS 5
69 #define VTK_LABEL_FIELD_DATA 6
70 
71 class VTKRENDERINGLABEL_EXPORT vtkLabeledDataMapper : public vtkMapper2D
72 {
73 public:
76  static vtkLabeledDataMapper *New();
77 
79  void PrintSelf(ostream& os, vtkIndent indent);
80 
82 
90  vtkSetStringMacro(LabelFormat);
91  vtkGetStringMacro(LabelFormat);
93 
95 
100  vtkSetMacro(LabeledComponent,int);
101  vtkGetMacro(LabeledComponent,int);
103 
105 
108  void SetFieldDataArray(int arrayIndex);
109  vtkGetMacro(FieldDataArray,int);
111 
113 
116  void SetFieldDataName(const char *arrayName);
117  vtkGetStringMacro(FieldDataName);
119 
122  virtual void SetInputData(vtkDataObject*);
123 
126  vtkDataSet *GetInput();
127 
129 
133  vtkSetMacro(LabelMode, int);
134  vtkGetMacro(LabelMode, int);
135  void SetLabelModeToLabelIds() {this->SetLabelMode(VTK_LABEL_IDS);};
136  void SetLabelModeToLabelScalars() {this->SetLabelMode(VTK_LABEL_SCALARS);};
137  void SetLabelModeToLabelVectors() {this->SetLabelMode(VTK_LABEL_VECTORS);};
138  void SetLabelModeToLabelNormals() {this->SetLabelMode(VTK_LABEL_NORMALS);};
139  void SetLabelModeToLabelTCoords() {this->SetLabelMode(VTK_LABEL_TCOORDS);};
140  void SetLabelModeToLabelTensors() {this->SetLabelMode(VTK_LABEL_TENSORS);};
141  void SetLabelModeToLabelFieldData()
142  {this->SetLabelMode(VTK_LABEL_FIELD_DATA);};
144 
146 
149  virtual void SetLabelTextProperty(vtkTextProperty *p)
150  { this->SetLabelTextProperty(p, 0); }
151  virtual vtkTextProperty* GetLabelTextProperty()
152  { return this->GetLabelTextProperty(0); }
153  virtual void SetLabelTextProperty(vtkTextProperty *p, int type);
154  virtual vtkTextProperty* GetLabelTextProperty(int type);
156 
158 
159  void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor);
160  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor);
162 
164  virtual void ReleaseGraphicsResources(vtkWindow *);
165 
167 
168  vtkGetObjectMacro(Transform, vtkTransform);
169  void SetTransform(vtkTransform* t);
171 
172  //BTX
175  {
176  WORLD=0,
177  DISPLAY=1
178  };
179  //ETX
180 
182 
185  vtkGetMacro(CoordinateSystem,int);
186  vtkSetClampMacro(CoordinateSystem,int,WORLD,DISPLAY);
187  void CoordinateSystemWorld() { this->SetCoordinateSystem( vtkLabeledDataMapper::WORLD ); }
188  void CoordinateSystemDisplay() { this->SetCoordinateSystem( vtkLabeledDataMapper::DISPLAY ); }
190 
192  virtual unsigned long GetMTime();
193 
194 protected:
197 
199 
200  char *LabelFormat;
206 
208 
212  double* LabelPositions;
214 
215  virtual int FillInputPortInformation(int, vtkInformation*);
216 
217  void AllocateLabels(int numLabels);
218  void BuildLabels();
219  void BuildLabelsInternal(vtkDataSet*);
220 
221  //BTX
222  class Internals;
223  Internals* Implementation;
224  //ETX
225 
226 private:
227  vtkLabeledDataMapper(const vtkLabeledDataMapper&); // Not implemented.
228  void operator=(const vtkLabeledDataMapper&); // Not implemented.
229 };
230 
231 #endif
232