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 
vtkMapper2D::RenderOpaqueGeometry
virtual void RenderOpaqueGeometry(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:42
VTK_LABEL_VECTORS
#define VTK_LABEL_VECTORS
Definition: vtkLabeledDataMapper.h:68
vtkLabeledDataMapper::LabeledComponent
int LabeledComponent
Definition: vtkLabeledDataMapper.h:257
vtkLabeledDataMapper::SetLabelModeToLabelNormals
void SetLabelModeToLabelNormals()
Definition: vtkLabeledDataMapper.h:158
vtkLabeledDataMapper::LabelPositions
double * LabelPositions
Definition: vtkLabeledDataMapper.h:267
vtkLabeledDataMapper::CoordinateSystemDisplay
void CoordinateSystemDisplay()
Definition: vtkLabeledDataMapper.h:216
vtkLabeledDataMapper::CoordinateSystemWorld
void CoordinateSystemWorld()
Definition: vtkLabeledDataMapper.h:215
vtkLabeledDataMapper::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property.
Definition: vtkLabeledDataMapper.h:172
vtkMapper2D::RenderOverlay
virtual void RenderOverlay(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:41
vtkX3D::type
@ type
Definition: vtkX3D.h:516
vtkAlgorithm::FillInputPortInformation
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
vtkLabeledDataMapper::SetLabelModeToLabelTCoords
void SetLabelModeToLabelTCoords()
Definition: vtkLabeledDataMapper.h:159
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkAbstractMapper::GetMTime
virtual vtkMTimeType GetMTime()
Override Modifiedtime as we have added Clipping planes.
vtkLabeledDataMapper::Transform
vtkTransform * Transform
Definition: vtkLabeledDataMapper.h:268
vtkLabeledDataMapper::Implementation
Internals * Implementation
Definition: vtkLabeledDataMapper.h:276
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkMTimeType
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
vtkLabeledDataMapper::LabelFormat
char * LabelFormat
Definition: vtkLabeledDataMapper.h:255
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:53
vtkLabeledDataMapper::Coordinates
Coordinates
Coordinate systems that output dataset may use.
Definition: vtkLabeledDataMapper.h:202
ADIOS::Transform
Transform
Definition: ADIOSDefs.h:39
VTK_LABEL_FIELD_DATA
#define VTK_LABEL_FIELD_DATA
Definition: vtkLabeledDataMapper.h:72
vtkLabeledDataMapper::SetLabelModeToLabelScalars
void SetLabelModeToLabelScalars()
Definition: vtkLabeledDataMapper.h:156
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkLabeledDataMapper::WORLD
@ WORLD
Output 3-D world-space coordinates for each label anchor.
Definition: vtkLabeledDataMapper.h:204
vtkMapper2D.h
vtkLabeledDataMapper::GetLabelTextProperty
virtual vtkTextProperty * GetLabelTextProperty()
Definition: vtkLabeledDataMapper.h:174
vtkLabeledDataMapper::NumberOfLabelsAllocated
int NumberOfLabelsAllocated
Definition: vtkLabeledDataMapper.h:265
vtkLabeledDataMapper::NumberOfLabels
int NumberOfLabels
Definition: vtkLabeledDataMapper.h:264
vtkLabeledDataMapper::LabelMode
int LabelMode
Definition: vtkLabeledDataMapper.h:256
vtkLabeledDataMapper::DISPLAY
@ DISPLAY
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant).
Definition: vtkLabeledDataMapper.h:205
vtkAbstractMapper::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
Definition: vtkAbstractMapper.h:71
vtkGetStringMacro
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkLabeledDataMapper::SetLabelModeToLabelIds
void SetLabelModeToLabelIds()
Definition: vtkLabeledDataMapper.h:155
VTK_LABEL_NORMALS
#define VTK_LABEL_NORMALS
Definition: vtkLabeledDataMapper.h:69
vtkLabeledDataMapper::SetLabelModeToLabelVectors
void SetLabelModeToLabelVectors()
Definition: vtkLabeledDataMapper.h:157
vtkMapper2D
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:35
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkMapper2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:39
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkLabeledDataMapper::FieldDataArray
int FieldDataArray
Definition: vtkLabeledDataMapper.h:258
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:45
vtkLabeledDataMapper
draw text labels at dataset points
Definition: vtkLabeledDataMapper.h:74
vtkLabeledDataMapper::Input
vtkDataSet * Input
Definition: vtkLabeledDataMapper.h:253
vtkLabeledDataMapper::BuildTime
vtkTimeStamp BuildTime
Definition: vtkLabeledDataMapper.h:262
vtkLabeledDataMapper::SetLabelModeToLabelFieldData
void SetLabelModeToLabelFieldData()
Definition: vtkLabeledDataMapper.h:161
vtkLabeledDataMapper::CoordinateSystem
int CoordinateSystem
Definition: vtkLabeledDataMapper.h:260
vtkLabeledDataMapper::TextMappers
vtkTextMapper ** TextMappers
Definition: vtkLabeledDataMapper.h:266
vtkLabeledDataMapper::FieldDataName
char * FieldDataName
Definition: vtkLabeledDataMapper.h:259
vtkLabeledDataMapper::SetLabelModeToLabelTensors
void SetLabelModeToLabelTensors()
Definition: vtkLabeledDataMapper.h:160
VTK_LABEL_TCOORDS
#define VTK_LABEL_TCOORDS
Definition: vtkLabeledDataMapper.h:70
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
VTK_LABEL_TENSORS
#define VTK_LABEL_TENSORS
Definition: vtkLabeledDataMapper.h:71
VTK_LABEL_SCALARS
#define VTK_LABEL_SCALARS
Definition: vtkLabeledDataMapper.h:67
VTK_LABEL_IDS
#define VTK_LABEL_IDS
Definition: vtkLabeledDataMapper.h:66