VTK  9.0.1
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 
49 class vtkPoints;
50 class vtkCellArray;
51 class vtkPolyData;
53 class vtkTextMapper;
54 class vtkTextProperty;
55 
56 class VTKRENDERINGANNOTATION_EXPORT vtkLeaderActor2D : public vtkActor2D
57 {
58 public:
59  vtkTypeMacro(vtkLeaderActor2D, vtkActor2D);
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
65  static vtkLeaderActor2D* New();
66 
68 
80  vtkSetMacro(Radius, double);
81  vtkGetMacro(Radius, double);
83 
85 
89  vtkSetStringMacro(Label);
90  vtkGetStringMacro(Label);
92 
94 
97  virtual void SetLabelTextProperty(vtkTextProperty* p);
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;
211  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
213 
218 
219  void ReleaseGraphicsResources(vtkWindow*) override;
220  void ShallowCopy(vtkProp* prop) override;
221 
222 protected:
224  ~vtkLeaderActor2D() override;
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);
230  int ClipLeader(
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 
242  char* LabelFormat;
243  char* Label;
244  double LabelFactor;
248 
251  double ArrowLength;
252  double ArrowWidth;
255 
262 
263  // Internal ivars for tracking whether to rebuild
264  int LastPosition[2];
265  int LastPosition2[2];
266  int LastSize[2];
268 
269 private:
270  vtkLeaderActor2D(const vtkLeaderActor2D&) = delete;
271  void operator=(const vtkLeaderActor2D&) = delete;
272 };
273 
274 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkLeaderActor2D::Leader
vtkPolyData * Leader
Definition: vtkLeaderActor2D.h:259
vtkActor2D::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkLeaderActor2D::SetArrowStyleToOpen
void SetArrowStyleToOpen()
Definition: vtkLeaderActor2D.h:148
vtkLeaderActor2D::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Definition: vtkLeaderActor2D.h:211
vtkLeaderActor2D::ArrowWidth
double ArrowWidth
Definition: vtkLeaderActor2D.h:252
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:44
vtkLeaderActor2D::VTK_ARROW_POINT2
@ VTK_ARROW_POINT2
Definition: vtkLeaderActor2D.h:116
vtkLeaderActor2D::LeaderLines
vtkCellArray * LeaderLines
Definition: vtkLeaderActor2D.h:257
vtkLeaderActor2D::SetArrowPlacementToPoint2
void SetArrowPlacementToPoint2()
Definition: vtkLeaderActor2D.h:135
vtkActor2D::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkActor2D.
vtkLeaderActor2D::MaximumArrowSize
double MaximumArrowSize
Definition: vtkLeaderActor2D.h:254
vtkLeaderActor2D::LabelActor
vtkActor2D * LabelActor
Definition: vtkLeaderActor2D.h:246
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkActor2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLeaderActor2D::LeaderMapper
vtkPolyDataMapper2D * LeaderMapper
Definition: vtkLeaderActor2D.h:260
vtkLeaderActor2D::ArrowPlacement
int ArrowPlacement
Definition: vtkLeaderActor2D.h:249
vtkLeaderActor2D::LabelMapper
vtkTextMapper * LabelMapper
Definition: vtkLeaderActor2D.h:245
vtkX3D::center
@ center
Definition: vtkX3D.h:236
vtkLeaderActor2D::ArrowStyle
int ArrowStyle
Definition: vtkLeaderActor2D.h:250
vtkLeaderActor2D::LeaderArrows
vtkCellArray * LeaderArrows
Definition: vtkLeaderActor2D.h:258
vtkLeaderActor2D::Label
char * Label
Definition: vtkLeaderActor2D.h:243
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkLeaderActor2D::ArrowLength
double ArrowLength
Definition: vtkLeaderActor2D.h:251
vtkLeaderActor2D::VTK_ARROW_POINT1
@ VTK_ARROW_POINT1
Definition: vtkLeaderActor2D.h:115
vtkActor2D::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:47
vtkLeaderActor2D::Length
double Length
Definition: vtkLeaderActor2D.h:238
vtkLeaderActor2D::LabelTextProperty
vtkTextProperty * LabelTextProperty
Definition: vtkLeaderActor2D.h:247
vtkLeaderActor2D::SetArrowPlacementToBoth
void SetArrowPlacementToBoth()
Definition: vtkLeaderActor2D.h:136
vtkLeaderActor2D::Radius
double Radius
Definition: vtkLeaderActor2D.h:237
vtkLeaderActor2D::LeaderActor
vtkActor2D * LeaderActor
Definition: vtkLeaderActor2D.h:261
vtkActor2D::RenderOverlay
int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:179
vtkLeaderActor2D::BuildTime
vtkTimeStamp BuildTime
Definition: vtkLeaderActor2D.h:267
vtkLeaderActor2D::MinimumArrowSize
double MinimumArrowSize
Definition: vtkLeaderActor2D.h:253
VTK_FLOAT_MAX
#define VTK_FLOAT_MAX
Definition: vtkType.h:163
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkLeaderActor2D::SetArrowStyleToHollow
void SetArrowStyleToHollow()
Definition: vtkLeaderActor2D.h:149
vtkLeaderActor2D::LabelFactor
double LabelFactor
Definition: vtkLeaderActor2D.h:244
vtkLeaderActor2D::SetArrowPlacementToPoint1
void SetArrowPlacementToPoint1()
Definition: vtkLeaderActor2D.h:134
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:33
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
vtkLeaderActor2D::AutoLabel
vtkTypeBool AutoLabel
Definition: vtkLeaderActor2D.h:241
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:39
vtkActor2D.h
vtkActor2D::New
static vtkActor2D * New()
Creates an actor2D with the following defaults: position (0,0) (coordinate system is viewport); at la...
vtkLeaderActor2D::SetArrowStyleToFilled
void SetArrowStyleToFilled()
Definition: vtkLeaderActor2D.h:147
vtkLeaderActor2D::LeaderPoints
vtkPoints * LeaderPoints
Definition: vtkLeaderActor2D.h:256
vtkLeaderActor2D::VTK_ARROW_OPEN
@ VTK_ARROW_OPEN
Definition: vtkLeaderActor2D.h:122
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkLeaderActor2D::SetArrowPlacementToNone
void SetArrowPlacementToNone()
Definition: vtkLeaderActor2D.h:133
vtkLeaderActor2D::Angle
double Angle
Definition: vtkLeaderActor2D.h:239
vtkLeaderActor2D::LabelFormat
char * LabelFormat
Definition: vtkLeaderActor2D.h:242
vtkActor2D::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkLeaderActor2D
create a leader with optional label and arrows
Definition: vtkLeaderActor2D.h:56
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69