VTK  9.2.5
vtkLeaderActor2D.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkLeaderActor2D.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
46#ifndef vtkLeaderActor2D_h
47#define vtkLeaderActor2D_h
48
49#include "vtkActor2D.h"
50#include "vtkRenderingAnnotationModule.h" // For export macro
51
52class vtkPoints;
53class vtkCellArray;
54class vtkPolyData;
56class vtkTextMapper;
57class vtkTextProperty;
58
59class VTKRENDERINGANNOTATION_EXPORT vtkLeaderActor2D : public vtkActor2D
60{
61public:
63 void PrintSelf(ostream& os, vtkIndent indent) override;
64
69
71
83 vtkSetMacro(Radius, double);
84 vtkGetMacro(Radius, double);
86
88
92 vtkSetStringMacro(Label);
93 vtkGetStringMacro(Label);
95
97
101 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
103
105
109 vtkSetClampMacro(LabelFactor, double, 0.1, 2.0);
110 vtkGetMacro(LabelFactor, double);
112
113 // Enums defined to support methods for control of arrow placement and
114 // and appearance of arrow heads.
115 enum
116 {
117 VTK_ARROW_NONE = 0,
120 VTK_ARROW_BOTH
121 };
122 enum
123 {
124 VTK_ARROW_FILLED = 0,
126 VTK_ARROW_HOLLOW
127 };
128
130
134 vtkSetClampMacro(ArrowPlacement, int, VTK_ARROW_NONE, VTK_ARROW_BOTH);
135 vtkGetMacro(ArrowPlacement, int);
136 void SetArrowPlacementToNone() { this->SetArrowPlacement(VTK_ARROW_NONE); }
137 void SetArrowPlacementToPoint1() { this->SetArrowPlacement(VTK_ARROW_POINT1); }
138 void SetArrowPlacementToPoint2() { this->SetArrowPlacement(VTK_ARROW_POINT2); }
139 void SetArrowPlacementToBoth() { this->SetArrowPlacement(VTK_ARROW_BOTH); }
141
143
148 vtkSetClampMacro(ArrowStyle, int, VTK_ARROW_FILLED, VTK_ARROW_HOLLOW);
149 vtkGetMacro(ArrowStyle, int);
150 void SetArrowStyleToFilled() { this->SetArrowStyle(VTK_ARROW_FILLED); }
151 void SetArrowStyleToOpen() { this->SetArrowStyle(VTK_ARROW_OPEN); }
152 void SetArrowStyleToHollow() { this->SetArrowStyle(VTK_ARROW_HOLLOW); }
154
156
160 vtkSetClampMacro(ArrowLength, double, 0.0, 1.0);
161 vtkGetMacro(ArrowLength, double);
162 vtkSetClampMacro(ArrowWidth, double, 0.0, 1.0);
163 vtkGetMacro(ArrowWidth, double);
165
167
173 vtkSetClampMacro(MinimumArrowSize, double, 1.0, VTK_FLOAT_MAX);
174 vtkGetMacro(MinimumArrowSize, double);
175 vtkSetClampMacro(MaximumArrowSize, double, 1.0, VTK_FLOAT_MAX);
176 vtkGetMacro(MaximumArrowSize, double);
178
180
186 vtkSetMacro(AutoLabel, vtkTypeBool);
187 vtkGetMacro(AutoLabel, vtkTypeBool);
188 vtkBooleanMacro(AutoLabel, vtkTypeBool);
190
192
195 vtkSetStringMacro(LabelFormat);
196 vtkGetStringMacro(LabelFormat);
198
200
204 vtkGetMacro(Length, double);
205 vtkGetMacro(Angle, double);
207
209
212 int RenderOverlay(vtkViewport* viewport) override;
213 int RenderOpaqueGeometry(vtkViewport* viewport) override;
216
221
223 void ShallowCopy(vtkProp* prop) override;
224
226
231 vtkSetMacro(UseFontSizeFromProperty, vtkTypeBool);
232 vtkGetMacro(UseFontSizeFromProperty, vtkTypeBool);
233 vtkBooleanMacro(UseFontSizeFromProperty, vtkTypeBool);
235
236protected:
239
240 // Internal helper methods
241 virtual void BuildLeader(vtkViewport* viewport);
242 int SetFontSize(vtkViewport* viewport, vtkTextMapper* textMapper, const int* targetSize,
243 double factor, int* stringSize);
245 double xL[3], int stringSize[2], double p1[3], double ray[3], double c1[3], double c2[3]);
246 void BuildCurvedLeader(double p1[3], double p2[3], double ray[3], double rayLength, double theta,
247 vtkViewport* viewport, int viewportChanged);
248 int InStringBox(double center[3], int stringSize[2], double x[3]);
249
250 // Characteristics of the leader
251 double Radius;
252 double Length;
253 double Angle;
254
257 char* Label;
262
264
271
278
279 // Internal ivars for tracking whether to rebuild
280 int LastPosition[2];
281 int LastPosition2[2];
282 int LastSize[2];
284
285private:
286 vtkLeaderActor2D(const vtkLeaderActor2D&) = delete;
287 void operator=(const vtkLeaderActor2D&) = delete;
288};
289
290#endif
a actor that draws 2D data
Definition: vtkActor2D.h:46
object to represent cell connectivity
Definition: vtkCellArray.h:187
a simple class to control print indentation
Definition: vtkIndent.h:40
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 vtkProp.
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
vtkTypeBool AutoLabel
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
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:40
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:91
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:57
2D text annotation
Definition: vtkTextMapper.h:51
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:36
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_FLOAT_MAX
Definition: vtkType.h:163