VTK  9.1.0
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=========================================================================*/
43#ifndef vtkLeaderActor2D_h
44#define vtkLeaderActor2D_h
45
46#include "vtkActor2D.h"
47#include "vtkRenderingAnnotationModule.h" // For export macro
48
49class vtkPoints;
50class vtkCellArray;
51class vtkPolyData;
53class vtkTextMapper;
54class vtkTextProperty;
55
56class VTKRENDERINGANNOTATION_EXPORT vtkLeaderActor2D : public vtkActor2D
57{
58public:
60 void PrintSelf(ostream& os, vtkIndent indent) override;
61
66
68
80 vtkSetMacro(Radius, double);
81 vtkGetMacro(Radius, double);
83
85
89 vtkSetStringMacro(Label);
90 vtkGetStringMacro(Label);
92
94
98 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
100
102
106 vtkSetClampMacro(LabelFactor, double, 0.1, 2.0);
107 vtkGetMacro(LabelFactor, double);
109
110 // Enums defined to support methods for control of arrow placement and
111 // and appearance of arrow heads.
112 enum
113 {
114 VTK_ARROW_NONE = 0,
117 VTK_ARROW_BOTH
118 };
119 enum
120 {
121 VTK_ARROW_FILLED = 0,
123 VTK_ARROW_HOLLOW
124 };
125
127
131 vtkSetClampMacro(ArrowPlacement, int, VTK_ARROW_NONE, VTK_ARROW_BOTH);
132 vtkGetMacro(ArrowPlacement, int);
133 void SetArrowPlacementToNone() { this->SetArrowPlacement(VTK_ARROW_NONE); }
134 void SetArrowPlacementToPoint1() { this->SetArrowPlacement(VTK_ARROW_POINT1); }
135 void SetArrowPlacementToPoint2() { this->SetArrowPlacement(VTK_ARROW_POINT2); }
136 void SetArrowPlacementToBoth() { this->SetArrowPlacement(VTK_ARROW_BOTH); }
138
140
145 vtkSetClampMacro(ArrowStyle, int, VTK_ARROW_FILLED, VTK_ARROW_HOLLOW);
146 vtkGetMacro(ArrowStyle, int);
147 void SetArrowStyleToFilled() { this->SetArrowStyle(VTK_ARROW_FILLED); }
148 void SetArrowStyleToOpen() { this->SetArrowStyle(VTK_ARROW_OPEN); }
149 void SetArrowStyleToHollow() { this->SetArrowStyle(VTK_ARROW_HOLLOW); }
151
153
157 vtkSetClampMacro(ArrowLength, double, 0.0, 1.0);
158 vtkGetMacro(ArrowLength, double);
159 vtkSetClampMacro(ArrowWidth, double, 0.0, 1.0);
160 vtkGetMacro(ArrowWidth, double);
162
164
170 vtkSetClampMacro(MinimumArrowSize, double, 1.0, VTK_FLOAT_MAX);
171 vtkGetMacro(MinimumArrowSize, double);
172 vtkSetClampMacro(MaximumArrowSize, double, 1.0, VTK_FLOAT_MAX);
173 vtkGetMacro(MaximumArrowSize, double);
175
177
183 vtkSetMacro(AutoLabel, vtkTypeBool);
184 vtkGetMacro(AutoLabel, vtkTypeBool);
185 vtkBooleanMacro(AutoLabel, vtkTypeBool);
187
189
192 vtkSetStringMacro(LabelFormat);
193 vtkGetStringMacro(LabelFormat);
195
197
201 vtkGetMacro(Length, double);
202 vtkGetMacro(Angle, double);
204
206
209 int RenderOverlay(vtkViewport* viewport) override;
210 int RenderOpaqueGeometry(vtkViewport* viewport) override;
213
218
220 void ShallowCopy(vtkProp* prop) override;
221
222protected:
225
226 // Internal helper methods
227 virtual void BuildLeader(vtkViewport* viewport);
228 int SetFontSize(vtkViewport* viewport, vtkTextMapper* textMapper, const int* targetSize,
229 double factor, int* stringSize);
231 double xL[3], int stringSize[2], double p1[3], double ray[3], double c1[3], double c2[3]);
232 void BuildCurvedLeader(double p1[3], double p2[3], double ray[3], double rayLength, double theta,
233 vtkViewport* viewport, int viewportChanged);
234 int InStringBox(double center[3], int stringSize[2], double x[3]);
235
236 // Characteristics of the leader
237 double Radius;
238 double Length;
239 double Angle;
240
243 char* Label;
248
255
262
263 // Internal ivars for tracking whether to rebuild
264 int LastPosition[2];
265 int LastPosition2[2];
266 int LastSize[2];
268
269private:
270 vtkLeaderActor2D(const vtkLeaderActor2D&) = delete;
271 void operator=(const vtkLeaderActor2D&) = delete;
272};
273
274#endif
a actor that draws 2D data
Definition: vtkActor2D.h:149
object to represent cell connectivity
Definition: vtkCellArray.h:290
a simple class to control print indentation
Definition: vtkIndent.h:113
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...
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:143
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
2D text annotation
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:52
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_FLOAT_MAX
Definition: vtkType.h:163