VTK  9.7.1
vtkFastLabeledDataMapper.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
21 #ifndef vtkFastLabeledDataMapper_h
22 #define vtkFastLabeledDataMapper_h
23 
24 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_7_0
25 #include "vtkLabeledDatatypeDefinitions.h" // For Data type Definitions
27 #include "vtkRenderingOpenGL2Module.h" // For export macro
28 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
29 
30 #include <memory> // For unique_ptr
31 
32 VTK_ABI_NAMESPACE_BEGIN
33 class vtkDataObject;
34 class vtkDataSet;
35 class vtkFloatArray;
36 class vtkIntArray;
37 class vtkTextProperty;
38 class vtkTransform;
39 VTK_ABI_NAMESPACE_END
40 
41 VTK_ABI_NAMESPACE_BEGIN
42 class VTK_DEPRECATED_IN_9_7_0("Use vtkBatchedLabeledDataMapper instead.") VTKRENDERINGOPENGL2_EXPORT
44 {
45 public:
46  static vtkFastLabeledDataMapper* New();
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51 
62  void SetLabelFormat(const char* format);
63  vtkGetStringMacro(LabelFormat);
65 
67 
74  vtkSetMacro(LabeledComponent, int);
75  vtkGetMacro(LabeledComponent, int);
77 
79 
82  vtkSetMacro(ComponentSeparator, char);
83  vtkGetMacro(ComponentSeparator, char);
85 
87 
92  vtkSetClampMacro(FieldDataArray, int, 0, VTK_INT_MAX);
93  vtkGetMacro(FieldDataArray, int);
95 
97 
102  vtkSetStringMacro(FieldDataName)
103  vtkGetStringMacro(FieldDataName);
105 
107 
113  vtkSetMacro(LabelMode, int);
114  vtkGetMacro(LabelMode, int);
115  void SetLabelModeToLabelIds() { this->SetLabelMode(VTK_LABEL_IDS); };
116  void SetLabelModeToLabelScalars() { this->SetLabelMode(VTK_LABEL_SCALARS); };
117  void SetLabelModeToLabelVectors() { this->SetLabelMode(VTK_LABEL_VECTORS); };
118  void SetLabelModeToLabelNormals() { this->SetLabelMode(VTK_LABEL_NORMALS); };
119  void SetLabelModeToLabelTCoords() { this->SetLabelMode(VTK_LABEL_TCOORDS); };
120  void SetLabelModeToLabelTensors() { this->SetLabelMode(VTK_LABEL_TENSORS); };
121  void SetLabelModeToLabelFieldData() { this->SetLabelMode(VTK_LABEL_FIELD_DATA); };
123 
125 
133  virtual void SetLabelTextProperty(vtkTextProperty* p, int type);
134  virtual vtkTextProperty* GetLabelTextProperty(int type);
136 
141  vtkSetStringMacro(FrameColorsName);
142  vtkGetStringMacro(FrameColorsName);
143 
145 
149  {
150  LowerLeft = 0,
158  Center
159  };
161 
163 
167  vtkSetMacro(TextAnchor, int);
168  vtkGetMacro(TextAnchor, int);
170 
172 
175  void RenderPiece(vtkRenderer* ren, vtkActor* act) override;
177 
179 
182  void RenderPieceStart(vtkRenderer* ren, vtkActor* act) override;
184 
186 
189  void RenderPieceFinish(vtkRenderer* ren, vtkActor* act) override;
191 
193 
196  virtual void SetInputData(vtkDataSet*);
198 
200 
203  vtkMTimeType GetMTime() override;
205 
207 
210  void ReleaseGraphicsResources(vtkWindow*) override;
212 
213 protected:
215  ~vtkFastLabeledDataMapper() override;
216 
218 
221  void SetMapperShaderParameters(vtkOpenGLHelper& cellBO, vtkRenderer* ren, vtkActor* act) override;
223 
225 
228  int FillInputPortInformation(int, vtkInformation*) override;
230 
231  void AllocateLabels(int numLabels);
232  void BuildLabels();
233  void BuildLabelsInternal(vtkDataSet*);
234  void MakeShaderArrays(
235  int numCurLabels, const std::vector<std::string>&, vtkIntArray*, vtkFloatArray*);
236  void MakeupShaders(vtkOpenGLShaderProperty* sp);
237 
238  vtkDataSet* Input = nullptr;
239  char* LabelFormat = nullptr;
240  int LabelMode = VTK_LABEL_IDS;
241  int LabeledComponent = -1;
242  int FieldDataArray = 0;
243  char* FieldDataName = nullptr;
244  char ComponentSeparator = ' ';
246 
248  int NumberOfLabelsAllocated = 0;
249 
250  class vtkInternals;
251  std::unique_ptr<vtkInternals> Implementation;
252 
253  char* FrameColorsName = nullptr;
254 
255 private:
257  void operator=(const vtkFastLabeledDataMapper&) = delete;
258 
259  struct vtkFastLabeledDataMapperFunctor;
260 
261 protected:
262  void BuildShaders(
263  std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer* ren, vtkActor* act) override;
264 };
265 VTK_ABI_NAMESPACE_END
266 
267 #endif
PolyDataMapper using OpenGL to render.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
virtual void RenderPieceFinish(vtkRenderer *ren, vtkActor *act)
Implemented by sub classes.
draw text labels at dataset points using batch rendering
static vtkOpenGLPolyDataMapper * New()
TextAnchor
Anchor option for labels.
std::unique_ptr< vtkInternals > Implementation
void SetInputData(vtkPolyData *in)
Specify the input data to map.
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
#define VTK_INT_MAX
Definition: vtkType.h:192
#define VTK_LABEL_IDS
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:31
abstract specification for renderers
Definition: vtkRenderer.h:63
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:50
represent GPU shader properties
#define VTK_LABEL_TCOORDS
void SetLabelModeToLabelFieldData()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors, or field data.
void SetLabelModeToLabelNormals()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors, or field data.
#define VTK_LABEL_NORMALS
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:35
#define VTK_LABEL_TENSORS
#define VTK_LABEL_SCALARS
a simple class to control print indentation
Definition: vtkIndent.h:28
#define VTK_LABEL_FIELD_DATA
virtual vtkTextProperty * GetLabelTextProperty()
Set/Get the text property.
void RenderPiece(vtkRenderer *ren, vtkActor *act) override
Implemented by sub classes.
void SetLabelModeToLabelVectors()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors, or field data.
void SetLabelModeToLabelTCoords()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors, or field data.
vtkMTimeType GetMTime() override
Overload standard modified time function.
virtual void BuildShaders(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act)
Build the shader source code, called by UpdateShader.
represent text properties.
virtual void SetMapperShaderParameters(vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act)
Set the shader parameters related to the mapper/input data, called by UpdateShader.
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
#define VTK_LABEL_VECTORS
virtual void RenderPieceStart(vtkRenderer *ren, vtkActor *act)
Implemented by sub classes.
draw text labels at dataset points
#define VTK_MARSHALAUTO
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
general representation of visualization data
Definition: vtkDataObject.h:55
void SetLabelModeToLabelScalars()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors, or field data.
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property.
void SetLabelModeToLabelTensors()
Specify which data to plot: IDs, scalars, vectors, normals, texture coords, tensors, or field data.
#define VTK_DEPRECATED_IN_9_7_0(reason)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.