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 
58 class VTKRENDERINGANNOTATION_EXPORT vtkLeaderActor2D : public vtkActor2D
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_LARGE_FLOAT);
146  vtkGetMacro(MinimumArrowSize,double);
147  vtkSetClampMacro(MaximumArrowSize,double,1.0,VTK_LARGE_FLOAT);
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