VTK  9.3.20240328
vtkLabelPlacer.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
29 #ifndef vtkLabelPlacer_h
30 #define vtkLabelPlacer_h
31 
32 #include "vtkPolyDataAlgorithm.h"
33 #include "vtkRenderingLabelModule.h" // For export macro
34 
35 VTK_ABI_NAMESPACE_BEGIN
36 class vtkRenderer;
37 class vtkCoordinate;
39 
40 class VTKRENDERINGLABEL_EXPORT vtkLabelPlacer : public vtkPolyDataAlgorithm
41 {
42 public:
43  static vtkLabelPlacer* New();
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
47  vtkGetObjectMacro(Renderer, vtkRenderer);
48  virtual void SetRenderer(vtkRenderer*);
49 
50  vtkGetObjectMacro(AnchorTransform, vtkCoordinate);
51 
54  {
55  VerticalBottomBit = 1,
56  VerticalBaselineBit = 2,
57  VerticalCenterBit = 4,
58  VerticalTopBit = 8,
59  HorizontalLeftBit = 16,
60  HorizontalCenterBit = 32,
61  HorizontalRightBit = 64,
62  VerticalBitMask = 15,
63  HorizontalBitMask = 112,
64 
65  LowerLeft = 17,
66  LowerCenter =
67  33,
68  LowerRight = 65,
69 
70  BaselineLeft = 18,
72  BaselineCenter = 34,
74  BaselineRight = 66,
76 
77  CenterLeft = 20,
79  CenterCenter =
80  36,
81  CenterRight = 68,
83 
84  UpperLeft = 24,
85  UpperCenter = 40,
86  UpperRight = 72
87  };
88 
91  {
92  WORLD = 0,
93  DISPLAY = 1
95  };
96 
98 
101  virtual void SetGravity(int gravity);
102  vtkGetMacro(Gravity, int);
104 
106 
110  vtkSetClampMacro(MaximumLabelFraction, double, 0., 1.);
111  vtkGetMacro(MaximumLabelFraction, double);
113 
115 
119  vtkSetMacro(IteratorType, int);
120  vtkGetMacro(IteratorType, int);
122 
123  vtkMTimeType GetMTime() override;
124 
126 
131  vtkGetMacro(PositionsAsNormals, bool);
132  vtkSetMacro(PositionsAsNormals, bool);
133  vtkBooleanMacro(PositionsAsNormals, bool);
135 
137 
141  vtkGetMacro(GeneratePerturbedLabelSpokes, bool);
142  vtkSetMacro(GeneratePerturbedLabelSpokes, bool);
143  vtkBooleanMacro(GeneratePerturbedLabelSpokes, bool);
145 
147 
151  vtkGetMacro(UseDepthBuffer, bool);
152  vtkSetMacro(UseDepthBuffer, bool);
153  vtkBooleanMacro(UseDepthBuffer, bool);
155 
157 
160  vtkGetMacro(OutputTraversedBounds, bool);
161  vtkSetMacro(OutputTraversedBounds, bool);
162  vtkBooleanMacro(OutputTraversedBounds, bool);
164 
166 
170  vtkGetMacro(OutputCoordinateSystem, int);
171  vtkSetClampMacro(OutputCoordinateSystem, int, WORLD, DISPLAY);
172  void OutputCoordinateSystemWorld() { this->SetOutputCoordinateSystem(vtkLabelPlacer::WORLD); }
173  void OutputCoordinateSystemDisplay() { this->SetOutputCoordinateSystem(vtkLabelPlacer::DISPLAY); }
175 
176 protected:
178  ~vtkLabelPlacer() override;
179 
181 
183  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
184  vtkInformationVector* outputVector) override;
185 
186  class Internal;
187  Internal* Buckets;
188 
192  int Gravity;
198 
199  int LastRendererSize[2];
200  double LastCameraPosition[3];
201  double LastCameraFocalPoint[3];
202  double LastCameraViewUp[3];
206 
207 private:
208  vtkLabelPlacer(const vtkLabelPlacer&) = delete;
209  void operator=(const vtkLabelPlacer&) = delete;
210 };
211 
212 VTK_ABI_NAMESPACE_END
213 #endif // vtkLabelPlacer_h
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
place a prioritized hierarchy of labels in screen space
virtual void SetRenderer(vtkRenderer *)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Internal * Buckets
double MaximumLabelFraction
static vtkLabelPlacer * New()
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
LabelGravity
Specifications for the placement of the label relative to an anchor point.
void OutputCoordinateSystemWorld()
Set/get the coordinate system used for output labels.
vtkCoordinate * AnchorTransform
virtual void SetAnchorTransform(vtkCoordinate *)
bool OutputTraversedBounds
~vtkLabelPlacer() override
vtkMTimeType GetMTime() override
Return this object's modified time.
void OutputCoordinateSystemDisplay()
Set/get the coordinate system used for output labels.
vtkRenderer * Renderer
OutputCoordinates
Coordinate systems that output dataset may use.
@ DISPLAY
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant).
@ WORLD
Output 3-D world-space coordinates for each label anchor.
virtual void SetGravity(int gravity)
The placement of the label relative to the anchor point.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
vtkSelectVisiblePoints * VisiblePoints
double LastCameraParallelScale
bool GeneratePerturbedLabelSpokes
Superclass for algorithms that produce only polydata as output.
abstract specification for renderers
Definition: vtkRenderer.h:171
extract points that are visible (based on z-buffer calculation)
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270