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:
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 
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); }
158 
160 
161  void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor);
162  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor);
164 
167 
169 
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 
237 
238  void AllocateLabels(int numLabels);
239  void BuildLabels();
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 
vtkLabeledDataMapper::RenderOpaqueGeometry
void RenderOpaqueGeometry(vtkViewport *viewport, vtkActor2D *actor)
VTK_LABEL_VECTORS
#define VTK_LABEL_VECTORS
Definition: vtkLabeledDataMapper.h:67
vtkLabeledDataMapper::LabeledComponent
int LabeledComponent
Definition: vtkLabeledDataMapper.h:223
vtkRenderingLabelModule.h
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkLabeledDataMapper::SetLabelModeToLabelNormals
void SetLabelModeToLabelNormals()
Definition: vtkLabeledDataMapper.h:140
vtkLabeledDataMapper::LabelPositions
double * LabelPositions
Definition: vtkLabeledDataMapper.h:233
vtkLabeledDataMapper::CoordinateSystemDisplay
void CoordinateSystemDisplay()
Definition: vtkLabeledDataMapper.h:190
vtkLabeledDataMapper::CoordinateSystemWorld
void CoordinateSystemWorld()
Definition: vtkLabeledDataMapper.h:189
vtkLabeledDataMapper::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p)
Definition: vtkLabeledDataMapper.h:151
vtkLabeledDataMapper::SetLabelModeToLabelTCoords
void SetLabelModeToLabelTCoords()
Definition: vtkLabeledDataMapper.h:141
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
VTKRENDERINGLABEL_EXPORT
#define VTKRENDERINGLABEL_EXPORT
Definition: vtkRenderingLabelModule.h:15
vtkLabeledDataMapper::Transform
vtkTransform * Transform
Definition: vtkLabeledDataMapper.h:234
vtkLabeledDataMapper::Implementation
Internals * Implementation
Definition: vtkLabeledDataMapper.h:243
vtkLabeledDataMapper::SetTransform
void SetTransform(vtkTransform *t)
vtkLabeledDataMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkX3D::Transform
@ Transform
Definition: vtkX3D.h:41
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkSetClampMacro
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:143
vtkLabeledDataMapper::LabelFormat
char * LabelFormat
Definition: vtkLabeledDataMapper.h:221
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:53
vtkLabeledDataMapper::Coordinates
Coordinates
Coordinate systems that output dataset may use.
Definition: vtkLabeledDataMapper.h:177
vtkLabeledDataMapper::GetLabelText
const char * GetLabelText(int label)
VTK_LABEL_FIELD_DATA
#define VTK_LABEL_FIELD_DATA
Definition: vtkLabeledDataMapper.h:71
vtkLabeledDataMapper::SetLabelModeToLabelScalars
void SetLabelModeToLabelScalars()
Definition: vtkLabeledDataMapper.h:138
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSetStringMacro
#define vtkSetStringMacro(name)
Definition: vtkSetGet.h:104
vtkLabeledDataMapper::WORLD
@ WORLD
Output 3-D world-space coordinates for each label anchor.
Definition: vtkLabeledDataMapper.h:178
vtkMapper2D.h
vtkLabeledDataMapper::New
static vtkLabeledDataMapper * New()
vtkLabeledDataMapper::GetLabelTextProperty
virtual vtkTextProperty * GetLabelTextProperty()
Definition: vtkLabeledDataMapper.h:153
vtkLabeledDataMapper::BuildLabels
void BuildLabels()
vtkLabeledDataMapper::NumberOfLabelsAllocated
int NumberOfLabelsAllocated
Definition: vtkLabeledDataMapper.h:231
vtkLabeledDataMapper::NumberOfLabels
int NumberOfLabels
Definition: vtkLabeledDataMapper.h:230
vtkLabeledDataMapper::LabelMode
int LabelMode
Definition: vtkLabeledDataMapper.h:222
vtkLabeledDataMapper::DISPLAY
@ DISPLAY
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant).
Definition: vtkLabeledDataMapper.h:179
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkGetStringMacro
vtkGetStringMacro(ExtensionsString)
vtkLabeledDataMapper::SetLabelModeToLabelIds
void SetLabelModeToLabelIds()
Definition: vtkLabeledDataMapper.h:137
VTK_LABEL_NORMALS
#define VTK_LABEL_NORMALS
Definition: vtkLabeledDataMapper.h:68
vtkLabeledDataMapper::SetLabelModeToLabelVectors
void SetLabelModeToLabelVectors()
Definition: vtkLabeledDataMapper.h:139
vtkMapper2D
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:35
vtkLabeledDataMapper::SetFieldDataName
void SetFieldDataName(const char *arrayName)
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkLabeledDataMapper::SetInputData
virtual void SetInputData(vtkDataObject *)
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)
vtkLabeledDataMapper::FillInputPortInformation
virtual int FillInputPortInformation(int, vtkInformation *)
vtkLabeledDataMapper::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
vtkLabeledDataMapper::FieldDataArray
int FieldDataArray
Definition: vtkLabeledDataMapper.h:224
vtkgl::t
GLdouble GLdouble t
Definition: vtkgl.h:11602
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:219
vtkLabeledDataMapper::BuildTime
vtkTimeStamp BuildTime
Definition: vtkLabeledDataMapper.h:228
vtkLabeledDataMapper::SetFieldDataArray
void SetFieldDataArray(int arrayIndex)
vtkLabeledDataMapper::SetLabelModeToLabelFieldData
void SetLabelModeToLabelFieldData()
Definition: vtkLabeledDataMapper.h:143
vtkLabeledDataMapper::BuildLabelsInternal
void BuildLabelsInternal(vtkDataSet *)
vtkLabeledDataMapper::AllocateLabels
void AllocateLabels(int numLabels)
vtkLabeledDataMapper::CoordinateSystem
int CoordinateSystem
Definition: vtkLabeledDataMapper.h:226
vtkLabeledDataMapper::vtkLabeledDataMapper
vtkLabeledDataMapper()
vtkLabeledDataMapper::TextMappers
vtkTextMapper ** TextMappers
Definition: vtkLabeledDataMapper.h:232
vtkLabeledDataMapper::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p, int type)
vtkLabeledDataMapper::~vtkLabeledDataMapper
~vtkLabeledDataMapper()
vtkLabeledDataMapper::FieldDataName
char * FieldDataName
Definition: vtkLabeledDataMapper.h:225
vtkgl::p
GLfloat GLfloat p
Definition: vtkgl.h:15717
vtkgl::void
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
vtkLabeledDataMapper::SetLabelModeToLabelTensors
void SetLabelModeToLabelTensors()
Definition: vtkLabeledDataMapper.h:142
VTK_LABEL_TCOORDS
#define VTK_LABEL_TCOORDS
Definition: vtkLabeledDataMapper.h:69
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
VTK_LABEL_TENSORS
#define VTK_LABEL_TENSORS
Definition: vtkLabeledDataMapper.h:70
VTK_LABEL_SCALARS
#define VTK_LABEL_SCALARS
Definition: vtkLabeledDataMapper.h:66
vtkLabeledDataMapper::GetMTime
virtual unsigned long GetMTime()
vtkgl::type
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
vtkLabeledDataMapper::RenderOverlay
void RenderOverlay(vtkViewport *viewport, vtkActor2D *actor)
VTK_LABEL_IDS
#define VTK_LABEL_IDS
Definition: vtkLabeledDataMapper.h:65
vtkLabeledDataMapper::GetInput
vtkDataSet * GetInput()
vtkLabeledDataMapper::GetLabelTextProperty
virtual vtkTextProperty * GetLabelTextProperty(int type)