VTK: Rendering/Annotation/vtkLeaderActor2D.h Source File

| VTK 9.3.1

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
40 VTK_ABI_NAMESPACE_BEGIN
41 class vtkPoints;
42 class vtkCellArray;
43 class vtkPolyData;
44 class vtkPolyDataMapper2D;
45 class vtkTextMapper;
46 class vtkTextProperty;
47
48 class VTKRENDERINGANNOTATION_EXPORT vtkLeaderActor2D : public vtkActor2D
49 {
50 public:
51 vtkTypeMacro(vtkLeaderActor2D, vtkActor2D);
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
57 static vtkLeaderActor2D* New();
58
60
72 vtkSetMacro(Radius, double);
73 vtkGetMacro(Radius, double);
75
77
81 vtkSetStringMacro(Label);
82 vtkGetStringMacro(Label);
84
86
89 virtual void SetLabelTextProperty(vtkTextProperty* p);
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,
107 VTK_ARROW_POINT1,
108 VTK_ARROW_POINT2,
109 VTK_ARROW_BOTH
110 };
111 enum
112 {
113 VTK_ARROW_FILLED = 0,
114 VTK_ARROW_OPEN,
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;
203 int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
205
209 vtkTypeBool HasTranslucentPolygonalGeometry() override;
210
211 void ReleaseGraphicsResources(vtkWindow*) override;
212 void ShallowCopy(vtkProp* prop) override;
213
215
220 vtkSetMacro(UseFontSizeFromProperty, vtkTypeBool);
221 vtkGetMacro(UseFontSizeFromProperty, vtkTypeBool);
222 vtkBooleanMacro(UseFontSizeFromProperty, vtkTypeBool);
224
225 protected:
226 vtkLeaderActor2D();
227 ~vtkLeaderActor2D() override;
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);
233 int ClipLeader(
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
244 vtkTypeBool AutoLabel;
245 char* LabelFormat;
246 char* Label;
247 double LabelFactor;
248 vtkTextMapper* LabelMapper;
249 vtkActor2D* LabelActor;
250 vtkTextProperty* LabelTextProperty;
251
252 vtkTypeBool UseFontSizeFromProperty;
253
254 int ArrowPlacement;
255 int ArrowStyle;
256 double ArrowLength;
257 double ArrowWidth;
258 double MinimumArrowSize;
259 double MaximumArrowSize;
260
261 vtkPoints* LeaderPoints;
262 vtkCellArray* LeaderLines;
263 vtkCellArray* LeaderArrows;
264 vtkPolyData* Leader;
265 vtkPolyDataMapper2D* LeaderMapper;
266 vtkActor2D* LeaderActor;
267
268 // Internal ivars for tracking whether to rebuild
269 int LastPosition[2];
270 int LastPosition2[2];
271 int LastSize[2];
272 vtkTimeStamp BuildTime;
273
274 private:
275 vtkLeaderActor2D(const vtkLeaderActor2D&) = delete;
276 void operator=(const vtkLeaderActor2D&) = delete;
277 };
278
279 VTK_ABI_NAMESPACE_END
280 #endif
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:44
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:185
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkLeaderActor2D
create a leader with optional label and arrows
Definition: vtkLeaderActor2D.h:49
vtkLeaderActor2D::LeaderArrows
vtkCellArray * LeaderArrows
Definition: vtkLeaderActor2D.h:263
vtkLeaderActor2D::VTK_ARROW_POINT1
@ VTK_ARROW_POINT1
Definition: vtkLeaderActor2D.h:107
vtkLeaderActor2D::VTK_ARROW_POINT2
@ VTK_ARROW_POINT2
Definition: vtkLeaderActor2D.h:108
vtkLeaderActor2D::Angle
double Angle
Definition: vtkLeaderActor2D.h:242
vtkLeaderActor2D::Radius
double Radius
Definition: vtkLeaderActor2D.h:240
vtkLeaderActor2D::SetArrowStyleToOpen
void SetArrowStyleToOpen()
Control the appearance of the arrow heads.
Definition: vtkLeaderActor2D.h:140
vtkLeaderActor2D::BuildCurvedLeader
void BuildCurvedLeader(double p1[3], double p2[3], double ray[3], double rayLength, double theta, vtkViewport *viewport, int viewportChanged)
vtkLeaderActor2D::MaximumArrowSize
double MaximumArrowSize
Definition: vtkLeaderActor2D.h:259
vtkLeaderActor2D::LabelActor
vtkActor2D * LabelActor
Definition: vtkLeaderActor2D.h:249
vtkLeaderActor2D::SetArrowPlacementToNone
void SetArrowPlacementToNone()
Control whether arrow heads are drawn on the leader.
Definition: vtkLeaderActor2D.h:125
vtkLeaderActor2D::InStringBox
int InStringBox(double center[3], int stringSize[2], double x[3])
vtkLeaderActor2D::ArrowStyle
int ArrowStyle
Definition: vtkLeaderActor2D.h:255
vtkLeaderActor2D::SetArrowPlacementToBoth
void SetArrowPlacementToBoth()
Control whether arrow heads are drawn on the leader.
Definition: vtkLeaderActor2D.h:128
vtkLeaderActor2D::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkProp.
vtkLeaderActor2D::Label
char * Label
Definition: vtkLeaderActor2D.h:246
vtkLeaderActor2D::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the text property of the label.
vtkLeaderActor2D::LeaderLines
vtkCellArray * LeaderLines
Definition: vtkLeaderActor2D.h:262
vtkLeaderActor2D::LeaderPoints
vtkPoints * LeaderPoints
Definition: vtkLeaderActor2D.h:261
vtkLeaderActor2D::VTK_ARROW_OPEN
@ VTK_ARROW_OPEN
Definition: vtkLeaderActor2D.h:114
vtkLeaderActor2D::SetFontSize
int SetFontSize(vtkViewport *viewport, vtkTextMapper *textMapper, const int *targetSize, double factor, int *stringSize)
vtkLeaderActor2D::BuildTime
vtkTimeStamp BuildTime
Definition: vtkLeaderActor2D.h:272
vtkLeaderActor2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLeaderActor2D::SetArrowStyleToHollow
void SetArrowStyleToHollow()
Control the appearance of the arrow heads.
Definition: vtkLeaderActor2D.h:141
vtkLeaderActor2D::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkLeaderActor2D::ArrowWidth
double ArrowWidth
Definition: vtkLeaderActor2D.h:257
vtkLeaderActor2D::LabelFactor
double LabelFactor
Definition: vtkLeaderActor2D.h:247
vtkLeaderActor2D::SetArrowStyleToFilled
void SetArrowStyleToFilled()
Control the appearance of the arrow heads.
Definition: vtkLeaderActor2D.h:139
vtkLeaderActor2D::LeaderMapper
vtkPolyDataMapper2D * LeaderMapper
Definition: vtkLeaderActor2D.h:265
vtkLeaderActor2D::BuildLeader
virtual void BuildLeader(vtkViewport *viewport)
vtkLeaderActor2D::vtkLeaderActor2D
vtkLeaderActor2D()
vtkLeaderActor2D::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *viewport) override
Methods required by vtkProp and vtkActor2D superclasses.
vtkLeaderActor2D::~vtkLeaderActor2D
~vtkLeaderActor2D() override
vtkLeaderActor2D::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods required by vtkProp and vtkActor2D superclasses.
Definition: vtkLeaderActor2D.h:203
vtkLeaderActor2D::Leader
vtkPolyData * Leader
Definition: vtkLeaderActor2D.h:264
vtkLeaderActor2D::SetArrowPlacementToPoint2
void SetArrowPlacementToPoint2()
Control whether arrow heads are drawn on the leader.
Definition: vtkLeaderActor2D.h:127
vtkLeaderActor2D::Length
double Length
Definition: vtkLeaderActor2D.h:241
vtkLeaderActor2D::LabelTextProperty
vtkTextProperty * LabelTextProperty
Definition: vtkLeaderActor2D.h:250
vtkLeaderActor2D::AutoLabel
vtkTypeBool AutoLabel
Definition: vtkLeaderActor2D.h:244
vtkLeaderActor2D::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
vtkLeaderActor2D::UseFontSizeFromProperty
vtkTypeBool UseFontSizeFromProperty
Definition: vtkLeaderActor2D.h:252
vtkLeaderActor2D::ClipLeader
int ClipLeader(double xL[3], int stringSize[2], double p1[3], double ray[3], double c1[3], double c2[3])
vtkLeaderActor2D::LabelMapper
vtkTextMapper * LabelMapper
Definition: vtkLeaderActor2D.h:248
vtkLeaderActor2D::ArrowLength
double ArrowLength
Definition: vtkLeaderActor2D.h:256
vtkLeaderActor2D::SetArrowPlacementToPoint1
void SetArrowPlacementToPoint1()
Control whether arrow heads are drawn on the leader.
Definition: vtkLeaderActor2D.h:126
vtkLeaderActor2D::MinimumArrowSize
double MinimumArrowSize
Definition: vtkLeaderActor2D.h:258
vtkLeaderActor2D::RenderOverlay
int RenderOverlay(vtkViewport *viewport) override
Methods required by vtkProp and vtkActor2D superclasses.
vtkLeaderActor2D::LeaderActor
vtkActor2D * LeaderActor
Definition: vtkLeaderActor2D.h:266
vtkLeaderActor2D::ArrowPlacement
int ArrowPlacement
Definition: vtkLeaderActor2D.h:254
vtkLeaderActor2D::New
static vtkLeaderActor2D * New()
Instantiate object.
vtkLeaderActor2D::LabelFormat
char * LabelFormat
Definition: vtkLeaderActor2D.h:245
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:38
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:49
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:55
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:49
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:35
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:34
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:54
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkX3D::center
@ center
Definition: vtkX3D.h:230
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkActor2D.h
VTK_FLOAT_MAX
#define VTK_FLOAT_MAX
Definition: vtkType.h:152