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 =========================================================================*/
54 #ifndef vtkLabeledDataMapper_h
55 #define vtkLabeledDataMapper_h
56 
57 #include "vtkRenderingLabelModule.h" // For export macro
58 #include "vtkMapper2D.h"
59 
60 #include <cassert> // For assert macro
61 
62 class vtkDataObject;
63 class vtkDataSet;
64 class vtkTextMapper;
65 class vtkTextProperty;
66 class vtkTransform;
67 
68 #define VTK_LABEL_IDS 0
69 #define VTK_LABEL_SCALARS 1
70 #define VTK_LABEL_VECTORS 2
71 #define VTK_LABEL_NORMALS 3
72 #define VTK_LABEL_TCOORDS 4
73 #define VTK_LABEL_TENSORS 5
74 #define VTK_LABEL_FIELD_DATA 6
75 
76 class VTKRENDERINGLABEL_EXPORT vtkLabeledDataMapper : public vtkMapper2D
77 {
78 public:
83  static vtkLabeledDataMapper *New();
84 
86  void PrintSelf(ostream& os, vtkIndent indent) override;
87 
89 
101  vtkSetStringMacro(LabelFormat);
102  vtkGetStringMacro(LabelFormat);
104 
106 
113  vtkSetMacro(LabeledComponent,int);
114  vtkGetMacro(LabeledComponent,int);
116 
118 
121  vtkSetMacro(ComponentSeparator,char);
122  vtkGetMacro(ComponentSeparator,char);
124 
126 
131  void SetFieldDataArray(int arrayIndex);
132  vtkGetMacro(FieldDataArray,int);
134 
136 
141  void SetFieldDataName(const char *arrayName);
142  vtkGetStringMacro(FieldDataName);
144 
148  virtual void SetInputData(vtkDataObject*);
149 
154  vtkDataSet *GetInput();
155 
157 
163  vtkSetMacro(LabelMode, int);
164  vtkGetMacro(LabelMode, int);
165  void SetLabelModeToLabelIds() {this->SetLabelMode(VTK_LABEL_IDS);};
166  void SetLabelModeToLabelScalars() {this->SetLabelMode(VTK_LABEL_SCALARS);};
167  void SetLabelModeToLabelVectors() {this->SetLabelMode(VTK_LABEL_VECTORS);};
168  void SetLabelModeToLabelNormals() {this->SetLabelMode(VTK_LABEL_NORMALS);};
169  void SetLabelModeToLabelTCoords() {this->SetLabelMode(VTK_LABEL_TCOORDS);};
170  void SetLabelModeToLabelTensors() {this->SetLabelMode(VTK_LABEL_TENSORS);};
172  {this->SetLabelMode(VTK_LABEL_FIELD_DATA);};
174 
176 
183  { this->SetLabelTextProperty(p, 0); }
185  { return this->GetLabelTextProperty(0); }
186  virtual void SetLabelTextProperty(vtkTextProperty *p, int type);
187  virtual vtkTextProperty* GetLabelTextProperty(int type);
189 
191 
194  void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor) override;
195  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
197 
201  void ReleaseGraphicsResources(vtkWindow *) override;
202 
204 
207  vtkGetObjectMacro(Transform, vtkTransform);
208  void SetTransform(vtkTransform* t);
210 
213  {
214  WORLD=0,
215  DISPLAY=1
216  };
217 
219 
223  vtkGetMacro(CoordinateSystem,int);
224  vtkSetClampMacro(CoordinateSystem,int,WORLD,DISPLAY);
225  void CoordinateSystemWorld() { this->SetCoordinateSystem( vtkLabeledDataMapper::WORLD ); }
226  void CoordinateSystemDisplay() { this->SetCoordinateSystem( vtkLabeledDataMapper::DISPLAY ); }
228 
232  vtkMTimeType GetMTime() override;
233 
235 
238  vtkGetMacro(NumberOfLabels, int)
240 
242 
245  void GetLabelPosition(int label, double pos[3])
246  {
247  assert("label index range" && label >= 0 && label < this->NumberOfLabels);
248  pos[0] = this->LabelPositions[3 * label];
249  pos[1] = this->LabelPositions[3 * label + 1];
250  pos[2] = this->LabelPositions[3 * label + 2];
251  }
253 
257  const char *GetLabelText(int label);
258 
259 protected:
261  ~vtkLabeledDataMapper() override;
262 
264 
265  char *LabelFormat;
271 
273 
275 
279  double* LabelPositions;
281 
282  int FillInputPortInformation(int, vtkInformation*) override;
283 
284  void AllocateLabels(int numLabels);
285  void BuildLabels();
286  void BuildLabelsInternal(vtkDataSet*);
287 
288  class Internals;
289  Internals* Implementation;
290 
291 private:
293  void operator=(const vtkLabeledDataMapper&) = delete;
294 };
295 
296 #endif
297 
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.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
virtual void RenderOverlay(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:41
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkMTimeType GetMTime() override
Override Modifiedtime as we have added Clipping planes.
Output 3-D world-space coordinates for each label anchor.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
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.
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
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.
#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
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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:40