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 =========================================================================*/
48 #ifndef vtkLabeledDataMapper_h
49 #define vtkLabeledDataMapper_h
50 
51 #include "vtkRenderingLabelModule.h" // For export macro
52 #include "vtkMapper2D.h"
53 
54 #include <cassert> // For assert macro
55 
56 class vtkDataObject;
57 class vtkDataSet;
58 class vtkTextMapper;
59 class vtkTextProperty;
60 class vtkTransform;
61 
62 #define VTK_LABEL_IDS 0
63 #define VTK_LABEL_SCALARS 1
64 #define VTK_LABEL_VECTORS 2
65 #define VTK_LABEL_NORMALS 3
66 #define VTK_LABEL_TCOORDS 4
67 #define VTK_LABEL_TENSORS 5
68 #define VTK_LABEL_FIELD_DATA 6
69 
70 class VTKRENDERINGLABEL_EXPORT vtkLabeledDataMapper : public vtkMapper2D
71 {
72 public:
77  static vtkLabeledDataMapper *New();
78 
80  void PrintSelf(ostream& os, vtkIndent indent) override;
81 
83 
95  vtkSetStringMacro(LabelFormat);
96  vtkGetStringMacro(LabelFormat);
98 
100 
107  vtkSetMacro(LabeledComponent,int);
108  vtkGetMacro(LabeledComponent,int);
110 
112 
115  vtkSetMacro(ComponentSeparator,char);
116  vtkGetMacro(ComponentSeparator,char);
118 
120 
125  void SetFieldDataArray(int arrayIndex);
126  vtkGetMacro(FieldDataArray,int);
128 
130 
135  void SetFieldDataName(const char *arrayName);
136  vtkGetStringMacro(FieldDataName);
138 
142  virtual void SetInputData(vtkDataObject*);
143 
148  vtkDataSet *GetInput();
149 
151 
157  vtkSetMacro(LabelMode, int);
158  vtkGetMacro(LabelMode, int);
159  void SetLabelModeToLabelIds() {this->SetLabelMode(VTK_LABEL_IDS);};
160  void SetLabelModeToLabelScalars() {this->SetLabelMode(VTK_LABEL_SCALARS);};
161  void SetLabelModeToLabelVectors() {this->SetLabelMode(VTK_LABEL_VECTORS);};
162  void SetLabelModeToLabelNormals() {this->SetLabelMode(VTK_LABEL_NORMALS);};
163  void SetLabelModeToLabelTCoords() {this->SetLabelMode(VTK_LABEL_TCOORDS);};
164  void SetLabelModeToLabelTensors() {this->SetLabelMode(VTK_LABEL_TENSORS);};
166  {this->SetLabelMode(VTK_LABEL_FIELD_DATA);};
168 
170 
177  { this->SetLabelTextProperty(p, 0); }
179  { return this->GetLabelTextProperty(0); }
180  virtual void SetLabelTextProperty(vtkTextProperty *p, int type);
181  virtual vtkTextProperty* GetLabelTextProperty(int type);
183 
185 
188  void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor) override;
189  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
191 
195  void ReleaseGraphicsResources(vtkWindow *) override;
196 
198 
201  vtkGetObjectMacro(Transform, vtkTransform);
202  void SetTransform(vtkTransform* t);
204 
207  {
208  WORLD=0,
209  DISPLAY=1
210  };
211 
213 
217  vtkGetMacro(CoordinateSystem,int);
218  vtkSetClampMacro(CoordinateSystem,int,WORLD,DISPLAY);
219  void CoordinateSystemWorld() { this->SetCoordinateSystem( vtkLabeledDataMapper::WORLD ); }
220  void CoordinateSystemDisplay() { this->SetCoordinateSystem( vtkLabeledDataMapper::DISPLAY ); }
222 
226  vtkMTimeType GetMTime() override;
227 
229 
232  vtkGetMacro(NumberOfLabels, int)
234 
236 
239  void GetLabelPosition(int label, double pos[3])
240  {
241  assert("label index range" && label >= 0 && label < this->NumberOfLabels);
242  pos[0] = this->LabelPositions[3 * label];
243  pos[1] = this->LabelPositions[3 * label + 1];
244  pos[2] = this->LabelPositions[3 * label + 2];
245  }
247 
251  const char *GetLabelText(int label);
252 
253 protected:
255  ~vtkLabeledDataMapper() override;
256 
258 
259  char *LabelFormat;
265 
267 
269 
273  double* LabelPositions;
275 
276  int FillInputPortInformation(int, vtkInformation*) override;
277 
278  void AllocateLabels(int numLabels);
279  void BuildLabels();
280  void BuildLabelsInternal(vtkDataSet*);
281 
282  class Internals;
283  Internals* Implementation;
284 
285 private:
287  void operator=(const vtkLabeledDataMapper&) = delete;
288 };
289 
290 #endif
291 
vtkMapper2D::RenderOpaqueGeometry
virtual void RenderOpaqueGeometry(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:42
VTK_LABEL_VECTORS
#define VTK_LABEL_VECTORS
Definition: vtkLabeledDataMapper.h:64
vtkLabeledDataMapper::LabeledComponent
int LabeledComponent
Definition: vtkLabeledDataMapper.h:261
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:162
vtkLabeledDataMapper::LabelPositions
double * LabelPositions
Definition: vtkLabeledDataMapper.h:273
vtkLabeledDataMapper::CoordinateSystemDisplay
void CoordinateSystemDisplay()
Definition: vtkLabeledDataMapper.h:220
vtkLabeledDataMapper::CoordinateSystemWorld
void CoordinateSystemWorld()
Definition: vtkLabeledDataMapper.h:219
vtkLabeledDataMapper::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property.
Definition: vtkLabeledDataMapper.h:176
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:163
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkAbstractMapper::GetMTime
vtkMTimeType GetMTime() override
Override Modifiedtime as we have added Clipping planes.
vtkLabeledDataMapper::Transform
vtkTransform * Transform
Definition: vtkLabeledDataMapper.h:274
vtkLabeledDataMapper::Implementation
Internals * Implementation
Definition: vtkLabeledDataMapper.h:282
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
vtkLabeledDataMapper::ComponentSeparator
char ComponentSeparator
Definition: vtkLabeledDataMapper.h:266
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkLabeledDataMapper::LabelFormat
char * LabelFormat
Definition: vtkLabeledDataMapper.h:259
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:47
vtkLabeledDataMapper::Coordinates
Coordinates
Coordinate systems that output dataset may use.
Definition: vtkLabeledDataMapper.h:206
ADIOS::Transform
Transform
Definition: ADIOSDefs.h:40
VTK_LABEL_FIELD_DATA
#define VTK_LABEL_FIELD_DATA
Definition: vtkLabeledDataMapper.h:68
vtkLabeledDataMapper::SetLabelModeToLabelScalars
void SetLabelModeToLabelScalars()
Definition: vtkLabeledDataMapper.h:160
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkLabeledDataMapper::WORLD
Output 3-D world-space coordinates for each label anchor.
Definition: vtkLabeledDataMapper.h:208
vtkMapper2D.h
vtkLabeledDataMapper::GetLabelTextProperty
virtual vtkTextProperty * GetLabelTextProperty()
Definition: vtkLabeledDataMapper.h:178
vtkLabeledDataMapper::NumberOfLabelsAllocated
int NumberOfLabelsAllocated
Definition: vtkLabeledDataMapper.h:271
vtkLabeledDataMapper::NumberOfLabels
int NumberOfLabels
Definition: vtkLabeledDataMapper.h:270
vtkLabeledDataMapper::LabelMode
int LabelMode
Definition: vtkLabeledDataMapper.h:260
vtkLabeledDataMapper::DISPLAY
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant).
Definition: vtkLabeledDataMapper.h:209
vtkAbstractMapper::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
Definition: vtkAbstractMapper.h:68
vtkLabeledDataMapper::SetLabelModeToLabelIds
void SetLabelModeToLabelIds()
Definition: vtkLabeledDataMapper.h:159
VTK_LABEL_NORMALS
#define VTK_LABEL_NORMALS
Definition: vtkLabeledDataMapper.h:65
vtkLabeledDataMapper::SetLabelModeToLabelVectors
void SetLabelModeToLabelVectors()
Definition: vtkLabeledDataMapper.h:161
vtkMapper2D
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:35
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:33
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkLabeledDataMapper::FieldDataArray
int FieldDataArray
Definition: vtkLabeledDataMapper.h:262
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:39
vtkLabeledDataMapper
draw text labels at dataset points
Definition: vtkLabeledDataMapper.h:70
vtkLabeledDataMapper::Input
vtkDataSet * Input
Definition: vtkLabeledDataMapper.h:257
vtkLabeledDataMapper::BuildTime
vtkTimeStamp BuildTime
Definition: vtkLabeledDataMapper.h:268
vtkLabeledDataMapper::SetLabelModeToLabelFieldData
void SetLabelModeToLabelFieldData()
Definition: vtkLabeledDataMapper.h:165
vtkLabeledDataMapper::CoordinateSystem
int CoordinateSystem
Definition: vtkLabeledDataMapper.h:264
vtkLabeledDataMapper::TextMappers
vtkTextMapper ** TextMappers
Definition: vtkLabeledDataMapper.h:272
vtkLabeledDataMapper::FieldDataName
char * FieldDataName
Definition: vtkLabeledDataMapper.h:263
vtkLabeledDataMapper::SetLabelModeToLabelTensors
void SetLabelModeToLabelTensors()
Definition: vtkLabeledDataMapper.h:164
VTK_LABEL_TCOORDS
#define VTK_LABEL_TCOORDS
Definition: vtkLabeledDataMapper.h:66
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:58
VTK_LABEL_TENSORS
#define VTK_LABEL_TENSORS
Definition: vtkLabeledDataMapper.h:67
VTK_LABEL_SCALARS
#define VTK_LABEL_SCALARS
Definition: vtkLabeledDataMapper.h:63
VTK_LABEL_IDS
#define VTK_LABEL_IDS
Definition: vtkLabeledDataMapper.h:62
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302