VTK  9.3.0
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
40VTK_ABI_NAMESPACE_BEGIN
41class vtkPoints;
42class vtkCellArray;
43class vtkPolyData;
45class vtkTextMapper;
46class vtkTextProperty;
47
48class VTKRENDERINGANNOTATION_EXPORT vtkLeaderActor2D : public vtkActor2D
49{
50public:
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
58
60
72 vtkSetMacro(Radius, double);
73 vtkGetMacro(Radius, double);
75
77
81 vtkSetStringMacro(Label);
82 vtkGetStringMacro(Label);
84
86
90 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
92
94
98 vtkSetClampMacro(LabelFactor, double, 0.1, 2.0);
99 vtkGetMacro(LabelFactor, double);
101
102 // Enums defined to support methods for control of arrow placement and
103 // and appearance of arrow heads.
104 enum
105 {
106 VTK_ARROW_NONE = 0,
109 VTK_ARROW_BOTH
110 };
111 enum
112 {
113 VTK_ARROW_FILLED = 0,
115 VTK_ARROW_HOLLOW
116 };
117
119
123 vtkSetClampMacro(ArrowPlacement, int, VTK_ARROW_NONE, VTK_ARROW_BOTH);
124 vtkGetMacro(ArrowPlacement, int);
125 void SetArrowPlacementToNone() { this->SetArrowPlacement(VTK_ARROW_NONE); }
126 void SetArrowPlacementToPoint1() { this->SetArrowPlacement(VTK_ARROW_POINT1); }
127 void SetArrowPlacementToPoint2() { this->SetArrowPlacement(VTK_ARROW_POINT2); }
128 void SetArrowPlacementToBoth() { this->SetArrowPlacement(VTK_ARROW_BOTH); }
130
132
137 vtkSetClampMacro(ArrowStyle, int, VTK_ARROW_FILLED, VTK_ARROW_HOLLOW);
138 vtkGetMacro(ArrowStyle, int);
139 void SetArrowStyleToFilled() { this->SetArrowStyle(VTK_ARROW_FILLED); }
140 void SetArrowStyleToOpen() { this->SetArrowStyle(VTK_ARROW_OPEN); }
141 void SetArrowStyleToHollow() { this->SetArrowStyle(VTK_ARROW_HOLLOW); }
143
145
149 vtkSetClampMacro(ArrowLength, double, 0.0, 1.0);
150 vtkGetMacro(ArrowLength, double);
151 vtkSetClampMacro(ArrowWidth, double, 0.0, 1.0);
152 vtkGetMacro(ArrowWidth, double);
154
156
162 vtkSetClampMacro(MinimumArrowSize, double, 1.0, VTK_FLOAT_MAX);
163 vtkGetMacro(MinimumArrowSize, double);
164 vtkSetClampMacro(MaximumArrowSize, double, 1.0, VTK_FLOAT_MAX);
165 vtkGetMacro(MaximumArrowSize, double);
167
169
175 vtkSetMacro(AutoLabel, vtkTypeBool);
176 vtkGetMacro(AutoLabel, vtkTypeBool);
177 vtkBooleanMacro(AutoLabel, vtkTypeBool);
179
181
184 vtkSetStringMacro(LabelFormat);
185 vtkGetStringMacro(LabelFormat);
187
189
193 vtkGetMacro(Length, double);
194 vtkGetMacro(Angle, double);
196
198
201 int RenderOverlay(vtkViewport* viewport) override;
202 int RenderOpaqueGeometry(vtkViewport* viewport) override;
205
210
212 void ShallowCopy(vtkProp* prop) override;
213
215
220 vtkSetMacro(UseFontSizeFromProperty, vtkTypeBool);
221 vtkGetMacro(UseFontSizeFromProperty, vtkTypeBool);
222 vtkBooleanMacro(UseFontSizeFromProperty, vtkTypeBool);
224
225protected:
228
229 // Internal helper methods
230 virtual void BuildLeader(vtkViewport* viewport);
231 int SetFontSize(vtkViewport* viewport, vtkTextMapper* textMapper, const int* targetSize,
232 double factor, int* stringSize);
234 double xL[3], int stringSize[2], double p1[3], double ray[3], double c1[3], double c2[3]);
235 void BuildCurvedLeader(double p1[3], double p2[3], double ray[3], double rayLength, double theta,
236 vtkViewport* viewport, int viewportChanged);
237 int InStringBox(double center[3], int stringSize[2], double x[3]);
238
239 // Characteristics of the leader
240 double Radius;
241 double Length;
242 double Angle;
243
246 char* Label;
251
253
260
267
268 // Internal ivars for tracking whether to rebuild
269 int LastPosition[2];
270 int LastPosition2[2];
271 int LastSize[2];
273
274private:
275 vtkLeaderActor2D(const vtkLeaderActor2D&) = delete;
276 void operator=(const vtkLeaderActor2D&) = delete;
277};
278
279VTK_ABI_NAMESPACE_END
280#endif
a actor that draws 2D data
Definition vtkActor2D.h:35
object to represent cell connectivity
a simple class to control print indentation
Definition vtkIndent.h:29
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.
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:29
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:80
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:43
2D text annotation
represent text properties.
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:45
window superclass for vtkRenderWindow
Definition vtkWindow.h:25
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_FLOAT_MAX
Definition vtkType.h:152