VTK
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 =========================================================================*/
45 #ifndef vtkLeaderActor2D_h
46 #define vtkLeaderActor2D_h
47 
48 #include "vtkRenderingAnnotationModule.h" // For export macro
49 #include "vtkActor2D.h"
50 
51 class vtkPoints;
52 class vtkCellArray;
53 class vtkPolyData;
55 class vtkTextMapper;
56 class vtkTextProperty;
57 
59 {
60 public:
62  void PrintSelf(ostream& os, vtkIndent indent);
63 
65  static vtkLeaderActor2D *New();
66 
68 
78  vtkSetMacro(Radius,double);
79  vtkGetMacro(Radius,double);
81 
83 
85  vtkSetStringMacro(Label);
86  vtkGetStringMacro(Label);
88 
90 
91  virtual void SetLabelTextProperty(vtkTextProperty *p);
92  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
94 
96 
98  vtkSetClampMacro(LabelFactor, double, 0.1, 2.0);
99  vtkGetMacro(LabelFactor, double);
101 
102 //BTX
103  // Enums defined to support methods for control of arrow placement and
104  // and appearance of arrow heads.
105  enum {VTK_ARROW_NONE=0,VTK_ARROW_POINT1,VTK_ARROW_POINT2,VTK_ARROW_BOTH};
106  enum {VTK_ARROW_FILLED=0,VTK_ARROW_OPEN,VTK_ARROW_HOLLOW};
107 //ETX
108 
110 
112  vtkSetClampMacro(ArrowPlacement,int,VTK_ARROW_NONE,VTK_ARROW_BOTH);
113  vtkGetMacro(ArrowPlacement,int);
114  void SetArrowPlacementToNone() {this->SetArrowPlacement(VTK_ARROW_NONE);}
115  void SetArrowPlacementToPoint1() {this->SetArrowPlacement(VTK_ARROW_POINT1);}
116  void SetArrowPlacementToPoint2() {this->SetArrowPlacement(VTK_ARROW_POINT2);}
117  void SetArrowPlacementToBoth() {this->SetArrowPlacement(VTK_ARROW_BOTH);}
119 
121 
124  vtkSetClampMacro(ArrowStyle,int,VTK_ARROW_FILLED,VTK_ARROW_HOLLOW);
125  vtkGetMacro(ArrowStyle,int);
126  void SetArrowStyleToFilled() {this->SetArrowStyle(VTK_ARROW_FILLED);}
127  void SetArrowStyleToOpen() {this->SetArrowStyle(VTK_ARROW_OPEN);}
128  void SetArrowStyleToHollow() {this->SetArrowStyle(VTK_ARROW_HOLLOW);}
130 
132 
134  vtkSetClampMacro(ArrowLength,double,0.0,1.0);
135  vtkGetMacro(ArrowLength,double);
136  vtkSetClampMacro(ArrowWidth,double,0.0,1.0);
137  vtkGetMacro(ArrowWidth,double);
139 
141 
145  vtkSetClampMacro(MinimumArrowSize,double,1.0,VTK_FLOAT_MAX);
146  vtkGetMacro(MinimumArrowSize,double);
147  vtkSetClampMacro(MaximumArrowSize,double,1.0,VTK_FLOAT_MAX);
148  vtkGetMacro(MaximumArrowSize,double);
150 
152 
156  vtkSetMacro(AutoLabel,int);
157  vtkGetMacro(AutoLabel,int);
158  vtkBooleanMacro(AutoLabel,int);
160 
162 
163  vtkSetStringMacro(LabelFormat);
164  vtkGetStringMacro(LabelFormat);
166 
168 
170  vtkGetMacro(Length,double);
171  vtkGetMacro(Angle,double);
173 
175 
176  int RenderOverlay(vtkViewport* viewport);
177  int RenderOpaqueGeometry(vtkViewport* viewport);
180 
182  virtual int HasTranslucentPolygonalGeometry();
183 
185  void ShallowCopy(vtkProp *prop);
186 
187 protected:
189  ~vtkLeaderActor2D();
190 
191  // Internal helper methods
192  virtual void BuildLeader(vtkViewport *viewport);
193  int SetFontSize(vtkViewport *viewport, vtkTextMapper *textMapper,
194  int *targetSize, double factor, int *stringSize);
195  int ClipLeader(double xL[3], int stringSize[2], double p1[3], double ray[3],
196  double c1[3], double c2[3]);
197  void BuildCurvedLeader(double p1[3], double p2[3], double ray[3], double rayLength,
198  double theta, vtkViewport *viewport, int viewportChanged);
199  int InStringBox(double center[3], int stringSize[2], double x[3]);
200 
201 
202  // Characteristics of the leader
203  double Radius;
204  double Length;
205  double Angle;
206 
208  char *LabelFormat;
209  char *Label;
210  double LabelFactor;
214 
217  double ArrowLength;
218  double ArrowWidth;
221 
228 
229  // Internal ivars for tracking whether to rebuild
230  int LastPosition[2];
231  int LastPosition2[2];
232  int LastSize[2];
234 
235 private:
236  vtkLeaderActor2D(const vtkLeaderActor2D&); // Not implemented.
237  void operator=(const vtkLeaderActor2D&); // Not implemented.
238 };
239 
240 
241 #endif
vtkCellArray * LeaderArrows
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
vtkActor2D * LeaderActor
vtkTextProperty * LabelTextProperty
virtual void ReleaseGraphicsResources(vtkWindow *)
vtkPoints * LeaderPoints
abstract specification for Viewports
Definition: vtkViewport.h:46
a actor that draws 2D data
Definition: vtkActor2D.h:44
record modification and/or execution time
Definition: vtkTimeStamp.h:34
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
void SetArrowPlacementToPoint1()
2D text annotation
Definition: vtkTextMapper.h:52
#define VTKRENDERINGANNOTATION_EXPORT
void SetArrowPlacementToNone()
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
#define VTK_FLOAT_MAX
Definition: vtkType.h:140
virtual int HasTranslucentPolygonalGeometry()
virtual int RenderOpaqueGeometry(vtkViewport *viewport)
vtkPolyData * Leader
a simple class to control print indentation
Definition: vtkIndent.h:38
void PrintSelf(ostream &os, vtkIndent indent)
create a leader with optional label and arrows
static vtkActor2D * New()
vtkCellArray * LeaderLines
represent text properties.
object to represent cell connectivity
Definition: vtkCellArray.h:49
virtual void ShallowCopy(vtkProp *prop)
void SetArrowPlacementToPoint2()
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
virtual int RenderOverlay(vtkViewport *viewport)
vtkActor2D * LabelActor
void SetArrowPlacementToBoth()
vtkPolyDataMapper2D * LeaderMapper
vtkTextMapper * LabelMapper
vtkTimeStamp BuildTime
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:38