VTK: Rendering/Label/vtkLabelPlacer.h Source File

| VTK 9.3.1

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;
38 class vtkSelectVisiblePoints;
39
40 class VTKRENDERINGLABEL_EXPORT vtkLabelPlacer : public vtkPolyDataAlgorithm
41 {
42 public:
43 static vtkLabelPlacer* New();
44 vtkTypeMacro(vtkLabelPlacer, vtkPolyDataAlgorithm);
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
47 vtkGetObjectMacro(Renderer, vtkRenderer);
48 virtual void SetRenderer(vtkRenderer*);
49
50 vtkGetObjectMacro(AnchorTransform, vtkCoordinate);
51
53 enum LabelGravity
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
90 enum OutputCoordinates
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:
177 vtkLabelPlacer();
178 ~vtkLabelPlacer() override;
179
180 virtual void SetAnchorTransform(vtkCoordinate*);
181
182 int FillInputPortInformation(int port, vtkInformation* info) override;
183 int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
184 vtkInformationVector* outputVector) override;
185
186 class Internal;
187 Internal* Buckets;
188
189 vtkRenderer* Renderer;
190 vtkCoordinate* AnchorTransform;
191 vtkSelectVisiblePoints* VisiblePoints;
192 int Gravity;
193 double MaximumLabelFraction;
194 bool PositionsAsNormals;
195 bool OutputTraversedBounds;
196 bool GeneratePerturbedLabelSpokes;
197 bool UseDepthBuffer;
198
199 int LastRendererSize[2];
200 double LastCameraPosition[3];
201 double LastCameraFocalPoint[3];
202 double LastCameraViewUp[3];
203 double LastCameraParallelScale;
204 int IteratorType;
205 int OutputCoordinateSystem;
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
vtkCoordinate
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:78
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkLabelPlacer
place a prioritized hierarchy of labels in screen space
Definition: vtkLabelPlacer.h:41
vtkLabelPlacer::SetRenderer
virtual void SetRenderer(vtkRenderer *)
vtkLabelPlacer::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLabelPlacer::Buckets
Internal * Buckets
Definition: vtkLabelPlacer.h:186
vtkLabelPlacer::MaximumLabelFraction
double MaximumLabelFraction
Definition: vtkLabelPlacer.h:193
vtkLabelPlacer::New
static vtkLabelPlacer * New()
vtkLabelPlacer::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkLabelPlacer::Gravity
int Gravity
Definition: vtkLabelPlacer.h:192
vtkLabelPlacer::LabelGravity
LabelGravity
Specifications for the placement of the label relative to an anchor point.
Definition: vtkLabelPlacer.h:54
vtkLabelPlacer::OutputCoordinateSystemWorld
void OutputCoordinateSystemWorld()
Set/get the coordinate system used for output labels.
Definition: vtkLabelPlacer.h:172
vtkLabelPlacer::UseDepthBuffer
bool UseDepthBuffer
Definition: vtkLabelPlacer.h:197
vtkLabelPlacer::AnchorTransform
vtkCoordinate * AnchorTransform
Definition: vtkLabelPlacer.h:190
vtkLabelPlacer::SetAnchorTransform
virtual void SetAnchorTransform(vtkCoordinate *)
vtkLabelPlacer::OutputTraversedBounds
bool OutputTraversedBounds
Definition: vtkLabelPlacer.h:195
vtkLabelPlacer::~vtkLabelPlacer
~vtkLabelPlacer() override
vtkLabelPlacer::GetMTime
vtkMTimeType GetMTime() override
Return this object's modified time.
vtkLabelPlacer::OutputCoordinateSystemDisplay
void OutputCoordinateSystemDisplay()
Set/get the coordinate system used for output labels.
Definition: vtkLabelPlacer.h:173
vtkLabelPlacer::Renderer
vtkRenderer * Renderer
Definition: vtkLabelPlacer.h:189
vtkLabelPlacer::vtkLabelPlacer
vtkLabelPlacer()
vtkLabelPlacer::OutputCoordinates
OutputCoordinates
Coordinate systems that output dataset may use.
Definition: vtkLabelPlacer.h:91
vtkLabelPlacer::DISPLAY
@ DISPLAY
Output 2-D display coordinates for each label anchor (3 components but only 2 are significant).
Definition: vtkLabelPlacer.h:93
vtkLabelPlacer::WORLD
@ WORLD
Output 3-D world-space coordinates for each label anchor.
Definition: vtkLabelPlacer.h:92
vtkLabelPlacer::SetGravity
virtual void SetGravity(int gravity)
The placement of the label relative to the anchor point.
vtkLabelPlacer::PositionsAsNormals
bool PositionsAsNormals
Definition: vtkLabelPlacer.h:194
vtkLabelPlacer::RequestData
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
vtkLabelPlacer::VisiblePoints
vtkSelectVisiblePoints * VisiblePoints
Definition: vtkLabelPlacer.h:191
vtkLabelPlacer::IteratorType
int IteratorType
Definition: vtkLabelPlacer.h:204
vtkLabelPlacer::LastCameraParallelScale
double LastCameraParallelScale
Definition: vtkLabelPlacer.h:203
vtkLabelPlacer::GeneratePerturbedLabelSpokes
bool GeneratePerturbedLabelSpokes
Definition: vtkLabelPlacer.h:196
vtkLabelPlacer::OutputCoordinateSystem
int OutputCoordinateSystem
Definition: vtkLabelPlacer.h:205
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:43
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:71
vtkSelectVisiblePoints
extract points that are visible (based on z-buffer calculation)
Definition: vtkSelectVisiblePoints.h:59
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkPolyDataAlgorithm.h
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270