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 
vtkMapper2D::RenderOpaqueGeometry
virtual void RenderOpaqueGeometry(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:42
VTK_LABEL_VECTORS
#define VTK_LABEL_VECTORS
Definition: vtkLabeledDataMapper.h:70
vtkLabeledDataMapper::LabeledComponent
int LabeledComponent
Definition: vtkLabeledDataMapper.h:267
vtkMapper2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLabeledDataMapper::SetLabelModeToLabelNormals
void SetLabelModeToLabelNormals()
Definition: vtkLabeledDataMapper.h:168
vtkLabeledDataMapper::LabelPositions
double * LabelPositions
Definition: vtkLabeledDataMapper.h:279
vtkLabeledDataMapper::CoordinateSystemDisplay
void CoordinateSystemDisplay()
Definition: vtkLabeledDataMapper.h:226
vtkLabeledDataMapper::CoordinateSystemWorld
void CoordinateSystemWorld()
Definition: vtkLabeledDataMapper.h:225
vtkLabeledDataMapper::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property.
Definition: vtkLabeledDataMapper.h:182
vtkMapper2D::RenderOverlay
virtual void RenderOverlay(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:41
vtkX3D::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:169
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkAbstractMapper::GetMTime
vtkMTimeType GetMTime() override
Override Modifiedtime as we have added Clipping planes.
vtkLabeledDataMapper::Transform
vtkTransform * Transform
Definition: vtkLabeledDataMapper.h:280
vtkLabeledDataMapper::Implementation
Internals * Implementation
Definition: vtkLabeledDataMapper.h:288
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkLabeledDataMapper::ComponentSeparator
char ComponentSeparator
Definition: vtkLabeledDataMapper.h:272
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkLabeledDataMapper::LabelFormat
char * LabelFormat
Definition: vtkLabeledDataMapper.h:265
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:53
vtkLabeledDataMapper::Coordinates
Coordinates
Coordinate systems that output dataset may use.
Definition: vtkLabeledDataMapper.h:212
ADIOS::Transform
Transform
Definition: ADIOSDefs.h:40
VTK_LABEL_FIELD_DATA
#define VTK_LABEL_FIELD_DATA
Definition: vtkLabeledDataMapper.h:74
vtkLabeledDataMapper::SetLabelModeToLabelScalars
void SetLabelModeToLabelScalars()
Definition: vtkLabeledDataMapper.h:166
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkLabeledDataMapper::WORLD
Output 3-D world-space coordinates for each label anchor.
Definition: vtkLabeledDataMapper.h:214
vtkMapper2D.h
vtkLabeledDataMapper::GetLabelTextProperty
virtual vtkTextProperty * GetLabelTextProperty()
Definition: vtkLabeledDataMapper.h:184
vtkLabeledDataMapper::NumberOfLabelsAllocated
int NumberOfLabelsAllocated
Definition: vtkLabeledDataMapper.h:277
vtkLabeledDataMapper::NumberOfLabels
int NumberOfLabels
Definition: vtkLabeledDataMapper.h:276
vtkLabeledDataMapper::LabelMode
int LabelMode
Definition: vtkLabeledDataMapper.h:266
vtkLabeledDataMapper::DISPLAY
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant).
Definition: vtkLabeledDataMapper.h:215
vtkAbstractMapper::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
Definition: vtkAbstractMapper.h:71
vtkLabeledDataMapper::SetLabelModeToLabelIds
void SetLabelModeToLabelIds()
Definition: vtkLabeledDataMapper.h:165
VTK_LABEL_NORMALS
#define VTK_LABEL_NORMALS
Definition: vtkLabeledDataMapper.h:71
vtkLabeledDataMapper::SetLabelModeToLabelVectors
void SetLabelModeToLabelVectors()
Definition: vtkLabeledDataMapper.h:167
vtkMapper2D
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:35
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
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
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkLabeledDataMapper::FieldDataArray
int FieldDataArray
Definition: vtkLabeledDataMapper.h:268
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:45
vtkLabeledDataMapper
draw text labels at dataset points
Definition: vtkLabeledDataMapper.h:76
vtkLabeledDataMapper::Input
vtkDataSet * Input
Definition: vtkLabeledDataMapper.h:263
vtkLabeledDataMapper::BuildTime
vtkTimeStamp BuildTime
Definition: vtkLabeledDataMapper.h:274
vtkLabeledDataMapper::SetLabelModeToLabelFieldData
void SetLabelModeToLabelFieldData()
Definition: vtkLabeledDataMapper.h:171
vtkLabeledDataMapper::CoordinateSystem
int CoordinateSystem
Definition: vtkLabeledDataMapper.h:270
vtkLabeledDataMapper::TextMappers
vtkTextMapper ** TextMappers
Definition: vtkLabeledDataMapper.h:278
vtkLabeledDataMapper::FieldDataName
char * FieldDataName
Definition: vtkLabeledDataMapper.h:269
vtkLabeledDataMapper::SetLabelModeToLabelTensors
void SetLabelModeToLabelTensors()
Definition: vtkLabeledDataMapper.h:170
VTK_LABEL_TCOORDS
#define VTK_LABEL_TCOORDS
Definition: vtkLabeledDataMapper.h:72
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
VTK_LABEL_TENSORS
#define VTK_LABEL_TENSORS
Definition: vtkLabeledDataMapper.h:73
VTK_LABEL_SCALARS
#define VTK_LABEL_SCALARS
Definition: vtkLabeledDataMapper.h:69
VTK_LABEL_IDS
#define VTK_LABEL_IDS
Definition: vtkLabeledDataMapper.h:68
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302