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 "vtkActor2D.h"
49 
50 class vtkPoints;
51 class vtkCellArray;
52 class vtkPolyData;
54 class vtkTextMapper;
55 class vtkTextProperty;
56 
58 {
59 public:
61  void PrintSelf(ostream& os, vtkIndent indent);
62 
64  static vtkLeaderActor2D *New();
65 
67 
77  vtkSetMacro(Radius,double);
78  vtkGetMacro(Radius,double);
80 
82 
84  vtkSetStringMacro(Label);
85  vtkGetStringMacro(Label);
87 
89 
90  virtual void SetLabelTextProperty(vtkTextProperty *p);
91  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
93 
95 
97  vtkSetClampMacro(LabelFactor, double, 0.1, 2.0);
98  vtkGetMacro(LabelFactor, double);
100 
101 //BTX
102  // Enums defined to support methods for control of arrow placement and
103  // and appearance of arrow heads.
104  enum {VTK_ARROW_NONE=0,VTK_ARROW_POINT1,VTK_ARROW_POINT2,VTK_ARROW_BOTH};
105  enum {VTK_ARROW_FILLED=0,VTK_ARROW_OPEN,VTK_ARROW_HOLLOW};
106 //ETX
107 
109 
111  vtkSetClampMacro(ArrowPlacement,int,VTK_ARROW_NONE,VTK_ARROW_BOTH);
112  vtkGetMacro(ArrowPlacement,int);
113  void SetArrowPlacementToNone() {this->SetArrowPlacement(VTK_ARROW_NONE);}
114  void SetArrowPlacementToPoint1() {this->SetArrowPlacement(VTK_ARROW_POINT1);}
115  void SetArrowPlacementToPoint2() {this->SetArrowPlacement(VTK_ARROW_POINT2);}
116  void SetArrowPlacementToBoth() {this->SetArrowPlacement(VTK_ARROW_BOTH);}
118 
120 
123  vtkSetClampMacro(ArrowStyle,int,VTK_ARROW_FILLED,VTK_ARROW_HOLLOW);
124  vtkGetMacro(ArrowStyle,int);
125  void SetArrowStyleToFilled() {this->SetArrowStyle(VTK_ARROW_FILLED);}
126  void SetArrowStyleToOpen() {this->SetArrowStyle(VTK_ARROW_OPEN);}
127  void SetArrowStyleToHollow() {this->SetArrowStyle(VTK_ARROW_HOLLOW);}
129 
131 
133  vtkSetClampMacro(ArrowLength,double,0.0,1.0);
134  vtkGetMacro(ArrowLength,double);
135  vtkSetClampMacro(ArrowWidth,double,0.0,1.0);
136  vtkGetMacro(ArrowWidth,double);
138 
140 
144  vtkSetClampMacro(MinimumArrowSize,double,1.0,VTK_LARGE_FLOAT);
145  vtkGetMacro(MinimumArrowSize,double);
146  vtkSetClampMacro(MaximumArrowSize,double,1.0,VTK_LARGE_FLOAT);
147  vtkGetMacro(MaximumArrowSize,double);
149 
151 
155  vtkSetMacro(AutoLabel,int);
156  vtkGetMacro(AutoLabel,int);
157  vtkBooleanMacro(AutoLabel,int);
159 
161 
162  vtkSetStringMacro(LabelFormat);
163  vtkGetStringMacro(LabelFormat);
165 
167 
169  vtkGetMacro(Length,double);
170  vtkGetMacro(Angle,double);
172 
174 
175  int RenderOverlay(vtkViewport* viewport);
176  int RenderOpaqueGeometry(vtkViewport* viewport);
179 
181  virtual int HasTranslucentPolygonalGeometry();
182 
184  void ShallowCopy(vtkProp *prop);
185 
186 protected:
188  ~vtkLeaderActor2D();
189 
190  // Internal helper methods
191  virtual void BuildLeader(vtkViewport *viewport);
192  int SetFontSize(vtkViewport *viewport, vtkTextMapper *textMapper,
193  int *targetSize, double factor, int *stringSize);
194  int ClipLeader(double xL[3], int stringSize[2], double p1[3], double ray[3],
195  double c1[3], double c2[3]);
196  void BuildCurvedLeader(double p1[3], double p2[3], double ray[3], double rayLength,
197  double theta, vtkViewport *viewport, int viewportChanged);
198  int InStringBox(double center[3], int stringSize[2], double x[3]);
199 
200 
201  // Characteristics of the leader
202  double Radius;
203  double Length;
204  double Angle;
205 
207  char *LabelFormat;
208  char *Label;
209  double LabelFactor;
213 
216  double ArrowLength;
217  double ArrowWidth;
220 
227 
228  // Internal ivars for tracking whether to rebuild
229  int LastPosition[2];
230  int LastPosition2[2];
231  int LastSize[2];
233 
234 private:
235  vtkLeaderActor2D(const vtkLeaderActor2D&); // Not implemented.
236  void operator=(const vtkLeaderActor2D&); // Not implemented.
237 };
238 
239 
240 #endif