VTK  9.5.20250905
vtkLeaderActor2D.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
34#ifndef vtkLeaderActor2D_h
35#define vtkLeaderActor2D_h
36
37#include "vtkActor2D.h"
38#include "vtkRenderingAnnotationModule.h" // For export macro
39#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
40
41VTK_ABI_NAMESPACE_BEGIN
42class vtkPoints;
43class vtkCellArray;
44class vtkPolyData;
46class vtkTextMapper;
47class vtkTextProperty;
48
49class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkLeaderActor2D : public vtkActor2D
50{
51public:
53 void PrintSelf(ostream& os, vtkIndent indent) override;
54
59
61
73 vtkSetMacro(Radius, double);
74 vtkGetMacro(Radius, double);
76
78
82 vtkSetStringMacro(Label);
83 vtkGetStringMacro(Label);
85
87
91 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
93
95
99 vtkSetClampMacro(LabelFactor, double, 0.1, 2.0);
100 vtkGetMacro(LabelFactor, double);
102
103 // Enums defined to support methods for control of arrow placement and
104 // and appearance of arrow heads.
105 enum
106 {
107 VTK_ARROW_NONE = 0,
110 VTK_ARROW_BOTH
111 };
112 enum
113 {
114 VTK_ARROW_FILLED = 0,
116 VTK_ARROW_HOLLOW
117 };
118
120
124 vtkSetClampMacro(ArrowPlacement, int, VTK_ARROW_NONE, VTK_ARROW_BOTH);
125 vtkGetMacro(ArrowPlacement, int);
126 void SetArrowPlacementToNone() { this->SetArrowPlacement(VTK_ARROW_NONE); }
127 void SetArrowPlacementToPoint1() { this->SetArrowPlacement(VTK_ARROW_POINT1); }
128 void SetArrowPlacementToPoint2() { this->SetArrowPlacement(VTK_ARROW_POINT2); }
129 void SetArrowPlacementToBoth() { this->SetArrowPlacement(VTK_ARROW_BOTH); }
131
133
138 vtkSetClampMacro(ArrowStyle, int, VTK_ARROW_FILLED, VTK_ARROW_HOLLOW);
139 vtkGetMacro(ArrowStyle, int);
140 void SetArrowStyleToFilled() { this->SetArrowStyle(VTK_ARROW_FILLED); }
141 void SetArrowStyleToOpen() { this->SetArrowStyle(VTK_ARROW_OPEN); }
142 void SetArrowStyleToHollow() { this->SetArrowStyle(VTK_ARROW_HOLLOW); }
144
146
150 vtkSetClampMacro(ArrowLength, double, 0.0, 1.0);
151 vtkGetMacro(ArrowLength, double);
152 vtkSetClampMacro(ArrowWidth, double, 0.0, 1.0);
153 vtkGetMacro(ArrowWidth, double);
155
157
163 vtkSetClampMacro(MinimumArrowSize, double, 1.0, VTK_FLOAT_MAX);
164 vtkGetMacro(MinimumArrowSize, double);
165 vtkSetClampMacro(MaximumArrowSize, double, 1.0, VTK_FLOAT_MAX);
166 vtkGetMacro(MaximumArrowSize, double);
168
170
176 vtkSetMacro(AutoLabel, vtkTypeBool);
177 vtkGetMacro(AutoLabel, vtkTypeBool);
178 vtkBooleanMacro(AutoLabel, vtkTypeBool);
180
182
185 void SetLabelFormat(const char* format);
186 vtkGetStringMacro(LabelFormat);
188
190
194 vtkGetMacro(Length, double);
195 vtkGetMacro(Angle, double);
197
199
202 int RenderOverlay(vtkViewport* viewport) override;
203 int RenderOpaqueGeometry(vtkViewport* viewport) override;
206
211
213 void ShallowCopy(vtkProp* prop) override;
214
216
221 vtkSetMacro(UseFontSizeFromProperty, vtkTypeBool);
222 vtkGetMacro(UseFontSizeFromProperty, vtkTypeBool);
223 vtkBooleanMacro(UseFontSizeFromProperty, vtkTypeBool);
225
226protected:
229
230 // Internal helper methods
231 virtual void BuildLeader(vtkViewport* viewport);
232 int SetFontSize(vtkViewport* viewport, vtkTextMapper* textMapper, const int* targetSize,
233 double factor, int* stringSize);
235 double xL[3], int stringSize[2], double p1[3], double ray[3], double c1[3], double c2[3]);
236 void BuildCurvedLeader(double p1[3], double p2[3], double ray[3], double rayLength, double theta,
237 vtkViewport* viewport, int viewportChanged);
238 int InStringBox(double center[3], int stringSize[2], double x[3]);
239
240 // Characteristics of the leader
241 double Radius;
242 double Length;
243 double Angle;
244
247 char* Label;
252
254
261
268
269 // Internal ivars for tracking whether to rebuild
270 int LastPosition[2];
271 int LastPosition2[2];
272 int LastSize[2];
274
275private:
276 vtkLeaderActor2D(const vtkLeaderActor2D&) = delete;
277 void operator=(const vtkLeaderActor2D&) = delete;
278};
279
280VTK_ABI_NAMESPACE_END
281#endif
a actor that draws 2D data
Definition vtkActor2D.h:145
object to represent cell connectivity
a simple class to control print indentation
Definition vtkIndent.h:108
create a leader with optional label and arrows
vtkCellArray * LeaderArrows
void SetArrowStyleToOpen()
Control the appearance of the arrow heads.
void BuildCurvedLeader(double p1[3], double p2[3], double ray[3], double rayLength, double theta, vtkViewport *viewport, int viewportChanged)
vtkActor2D * LabelActor
void SetArrowPlacementToNone()
Control whether arrow heads are drawn on the leader.
int InStringBox(double center[3], int stringSize[2], double x[3])
void SetArrowPlacementToBoth()
Control whether arrow heads are drawn on the leader.
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkActor2D.
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property of the label.
vtkCellArray * LeaderLines
vtkPoints * LeaderPoints
int SetFontSize(vtkViewport *viewport, vtkTextMapper *textMapper, const int *targetSize, double factor, int *stringSize)
vtkTimeStamp BuildTime
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetArrowStyleToHollow()
Control the appearance of the arrow heads.
void SetLabelFormat(const char *format)
Specify the std::format style format to use for auto-labelling.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
void SetArrowStyleToFilled()
Control the appearance of the arrow heads.
vtkPolyDataMapper2D * LeaderMapper
virtual void BuildLeader(vtkViewport *viewport)
int RenderOpaqueGeometry(vtkViewport *viewport) override
Methods required by vtkProp and vtkActor2D superclasses.
~vtkLeaderActor2D() override
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods required by vtkProp and vtkActor2D superclasses.
vtkPolyData * Leader
void SetArrowPlacementToPoint2()
Control whether arrow heads are drawn on the leader.
vtkTextProperty * LabelTextProperty
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
vtkTypeBool UseFontSizeFromProperty
int ClipLeader(double xL[3], int stringSize[2], double p1[3], double ray[3], double c1[3], double c2[3])
vtkTextMapper * LabelMapper
void SetArrowPlacementToPoint1()
Control whether arrow heads are drawn on the leader.
int RenderOverlay(vtkViewport *viewport) override
Methods required by vtkProp and vtkActor2D superclasses.
static vtkLeaderActor2D * New()
Instantiate object.
vtkActor2D * LeaderActor
represent and manipulate 3D points
Definition vtkPoints.h:139
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:69
2D text annotation
represent text properties.
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:66
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_FLOAT_MAX
Definition vtkType.h:169
#define VTK_MARSHALAUTO