VTK  9.7.1
vtkBatchedLabeledDataMapper.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
24 #ifndef vtkBatchedLabeledDataMapper_h
25 #define vtkBatchedLabeledDataMapper_h
26 
27 #include "vtkLabeledDataMapper.h"
28 #include "vtkRenderingLabelModule.h" // For export macro
29 #include "vtkWrappingHints.h" // For VTK_MARSHALMANUAL
30 
31 #include <memory> // For unique_ptr
32 
33 VTK_ABI_NAMESPACE_BEGIN
34 class vtkDataSet;
35 class vtkFloatArray;
36 class vtkImageData;
37 class vtkIntArray;
38 class vtkPolyData;
39 class vtkTextProperty;
40 VTK_ABI_NAMESPACE_END
41 
42 VTK_ABI_NAMESPACE_BEGIN
43 class VTKRENDERINGLABEL_EXPORT VTK_MARSHALMANUAL vtkBatchedLabeledDataMapper
44  : public vtkLabeledDataMapper
45 {
46 public:
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
52 
59  static constexpr int MaxTextProperties = 128;
60  static constexpr int GlyphAtlasPadding = 5;
61  static constexpr int GlyphAtlasColumnSize = 10;
63 
65 
70  void SetLabelTextProperty(vtkTextProperty* p) override { this->SetLabelTextProperty(p, 0); }
72  void SetLabelTextProperty(vtkTextProperty* p, int type) override;
75 
79  vtkSetStringMacro(FrameColorsName);
80  vtkGetStringMacro(FrameColorsName);
81 
83 
87  {
88  LowerLeft = 0,
89  LowerRight = 1,
90  UpperLeft = 2,
91  UpperRight = 3,
92  LowerEdge = 4,
93  RightEdge = 5,
94  LeftEdge = 6,
95  UpperEdge = 7,
96  Center = 8
97  };
99 
101 
105  vtkSetClampMacro(TextAnchor, int, LowerLeft, Center);
106  vtkGetMacro(TextAnchor, int);
108 
110 
115  vtkSetVector2Macro(DisplayOffset, int);
116  vtkGetVector2Macro(DisplayOffset, int);
118 
122  vtkMTimeType GetMTime() override;
123 
127  void RenderOverlay(vtkViewport*, vtkActor2D*) override {}
129  void ReleaseGraphicsResources(vtkWindow*) override;
130 
131 protected:
133  ~vtkBatchedLabeledDataMapper() override;
134 
135  int FillInputPortInformation(int, vtkInformation*) override;
136 
138  void AllocateLabels(int numLabels) override;
139 
141  void BuildLabels() override;
142 
144  void BuildLabelsInternal(vtkDataSet*) override;
145 
151  void MakeShaderArrays(int numCurLabels, const std::vector<std::string>&, vtkIntArray*,
152  vtkFloatArray*, const std::vector<bool>& visible);
153 
158  virtual void UploadGlyphAtlas(vtkImageData* atlas);
159 
163  virtual void ActivateGlyphTexture();
164  virtual void DeactivateGlyphTexture();
165 
167 
172  vtkImageData* GetGlyphAtlas() const;
173  vtkPolyData* GetPreparedPolyData() const;
174  const float* GetBackgroundColors() const;
175  const int* GetFrameWidths() const;
176  const int* GetMaxGlyphHeights() const;
177  const int* GetDescenders() const;
179 
184  void UpdateRenderWindowDPI(int dpi);
185 
186 private:
188  void operator=(const vtkBatchedLabeledDataMapper&) = delete;
189 
190  int TextAnchor = vtkBatchedLabeledDataMapper::Center;
191  int DisplayOffset[2] = { 0, 0 };
192 
193  char* FrameColorsName = nullptr;
194 
195  class vtkInternals;
196  std::unique_ptr<vtkInternals> Impl;
197 
198  struct vtkBatchedLabeledDataMapperFormatter;
199 };
200 VTK_ABI_NAMESPACE_END
201 
202 #endif
TextAnchorTypes
Anchor option for labels.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
draw text labels at dataset points using batch rendering
void SetLabelTextProperty(vtkTextProperty *p) override
Set/Get the text property.
Store vtkAlgorithm input/output information.
static vtkLabeledDataMapper * New()
Instantiate object with {:<#6.3g} label format.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
abstract specification for Viewports
Definition: vtkViewport.h:46
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkTextProperty * GetLabelTextProperty() override
Set/Get the text property.
a actor that draws 2D data
Definition: vtkActor2D.h:35
void RenderOpaqueGeometry(vtkViewport *, vtkActor2D *) override
No-op: backend subclasses override this to drive the render pipeline.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:31
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
draw text labels at dataset points
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:35
#define VTK_MARSHALMANUAL
virtual void BuildLabels()
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
void RenderOverlay(vtkViewport *, vtkActor2D *) override
No-op: all label drawing happens in RenderOpaqueGeometry.
virtual void BuildLabelsInternal(vtkDataSet *)
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
represent text properties.
virtual vtkTextProperty * GetLabelTextProperty()
Set/Get the text property.
vtkMTimeType GetMTime() override
Return the modified time for this object.
virtual void AllocateLabels(int numLabels)
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property.