VTK
vtkAxisActor2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAxisActor2D.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 =========================================================================*/
60 #ifndef __vtkAxisActor2D_h
61 #define __vtkAxisActor2D_h
62 
63 #include "vtkActor2D.h"
64 
66 class vtkPolyData;
67 class vtkTextMapper;
68 class vtkTextProperty;
69 
70 #define VTK_MAX_LABELS 25
71 
73 {
74 public:
75  vtkTypeMacro(vtkAxisActor2D,vtkActor2D);
76  void PrintSelf(ostream& os, vtkIndent indent);
77 
79  static vtkAxisActor2D *New();
80 
82 
85  { return this->GetPositionCoordinate(); };
86  virtual void SetPoint1(double x[2]) { this->SetPosition(x); };
87  virtual void SetPoint1(double x, double y) { this->SetPosition(x,y); };
88  virtual double *GetPoint1() { return this->GetPosition(); };
90 
92 
97  { return this->GetPosition2Coordinate(); };
98  virtual void SetPoint2(double x[2]) { this->SetPosition2(x); };
99  virtual void SetPoint2(double x, double y) { this->SetPosition2(x,y); };
100  virtual double *GetPoint2() { return this->GetPosition2(); };
102 
104 
106  vtkSetVector2Macro(Range,double);
107  vtkGetVectorMacro(Range,double,2);
109 
111 
114  vtkSetMacro(RulerMode,int);
115  vtkGetMacro(RulerMode,int);
116  vtkBooleanMacro(RulerMode,int);
118 
120 
122  vtkSetClampMacro(RulerDistance,double,0,VTK_LARGE_FLOAT);
123  vtkGetMacro(RulerDistance,double);
125 
127 
130  vtkSetClampMacro(NumberOfLabels, int, 2, VTK_MAX_LABELS);
131  vtkGetMacro(NumberOfLabels, int);
133 
135 
136  vtkSetStringMacro(LabelFormat);
137  vtkGetStringMacro(LabelFormat);
139 
141 
147  vtkSetMacro(AdjustLabels, int);
148  vtkGetMacro(AdjustLabels, int);
149  vtkBooleanMacro(AdjustLabels, int);
150  virtual double *GetAdjustedRange()
151  {
152  this->UpdateAdjustedRange();
153  return this->AdjustedRange;
154  }
155  virtual void GetAdjustedRange(double &_arg1, double &_arg2)
156  {
157  this->UpdateAdjustedRange();
158  _arg1 = this->AdjustedRange[0];
159  _arg2 = this->AdjustedRange[1];
160  };
161  virtual void GetAdjustedRange(double _arg[2])
162  {
163  this->GetAdjustedRange(_arg[0], _arg[1]);
164  }
166  {
167  this->UpdateAdjustedRange();
168  return this->AdjustedNumberOfLabels;
169  }
171 
173 
174  vtkSetStringMacro(Title);
175  vtkGetStringMacro(Title);
177 
179 
180  virtual void SetTitleTextProperty(vtkTextProperty *p);
181  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
183 
185 
186  virtual void SetLabelTextProperty(vtkTextProperty *p);
187  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
189 
191 
193  vtkSetClampMacro(TickLength, int, 0, 100);
194  vtkGetMacro(TickLength, int);
196 
198 
200  vtkSetClampMacro(NumberOfMinorTicks, int, 0, 20);
201  vtkGetMacro(NumberOfMinorTicks, int);
203 
205 
207  vtkSetClampMacro(MinorTickLength, int, 0, 100);
208  vtkGetMacro(MinorTickLength, int);
210 
212 
215  vtkSetClampMacro(TickOffset, int, 0, 100);
216  vtkGetMacro(TickOffset, int);
218 
220 
221  vtkSetMacro(AxisVisibility, int);
222  vtkGetMacro(AxisVisibility, int);
223  vtkBooleanMacro(AxisVisibility, int);
225 
227 
228  vtkSetMacro(TickVisibility, int);
229  vtkGetMacro(TickVisibility, int);
230  vtkBooleanMacro(TickVisibility, int);
232 
234 
235  vtkSetMacro(LabelVisibility, int);
236  vtkGetMacro(LabelVisibility, int);
237  vtkBooleanMacro(LabelVisibility, int);
239 
241 
242  vtkSetMacro(TitleVisibility, int);
243  vtkGetMacro(TitleVisibility, int);
244  vtkBooleanMacro(TitleVisibility, int);
246 
248 
250  vtkSetMacro(TitlePosition, double);
251  vtkGetMacro(TitlePosition, double);
253 
255 
258  vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
259  vtkGetMacro(FontFactor, double);
261 
263 
265  vtkSetClampMacro(LabelFactor, double, 0.1, 2.0);
266  vtkGetMacro(LabelFactor, double);
268 
270 
271  int RenderOverlay(vtkViewport* viewport);
272  int RenderOpaqueGeometry(vtkViewport* viewport);
275 
277  virtual int HasTranslucentPolygonalGeometry();
278 
283 
285 
293  static void ComputeRange(double inRange[2],
294  double outRange[2],
295  int inNumTicks,
296  int &outNumTicks,
297  double &interval);
299 
301 
308  static int SetMultipleFontSize(vtkViewport *viewport,
309  vtkTextMapper **textMappers,
310  int nbOfMappers,
311  int *targetSize,
312  double factor,
313  int *stringSize);
315 
317 
320  vtkSetMacro(SizeFontRelativeToAxis,int);
321  vtkGetMacro(SizeFontRelativeToAxis,int);
322  vtkBooleanMacro(SizeFontRelativeToAxis,int);
324 
326  void ShallowCopy(vtkProp *prop);
327 
328 protected:
329  vtkAxisActor2D();
330  ~vtkAxisActor2D();
331 
334 
335  char *Title;
336  double Range[2];
341  char *LabelFormat;
343  double FontFactor;
344  double LabelFactor;
349 
350  double AdjustedRange[2];
353 
358 
359  int LastPosition[2];
360  int LastPosition2[2];
361 
362  int LastSize[2];
363  int LastMaxLabelSize[2];
364 
366 
367  virtual void BuildAxis(vtkViewport *viewport);
368  static double ComputeStringOffset(double width, double height, double theta);
369  static void SetOffsetPosition(double xTick[3], double theta,
370  int stringHeight, int stringWidth,
371  int offset, vtkActor2D *actor);
372  virtual void UpdateAdjustedRange();
373 
376 
379 
383 
386 
387 private:
388  vtkAxisActor2D(const vtkAxisActor2D&); // Not implemented.
389  void operator=(const vtkAxisActor2D&); // Not implemented.
390 };
391 
392 
393 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
virtual void GetAdjustedRange(double _arg[2])
virtual void SetPosition(float x[2])
vtkActor2D * TitleActor
virtual void ReleaseGraphicsResources(vtkWindow *)
abstract specification for Viewports
Definition: vtkViewport.h:45
virtual double * GetPoint1()
a actor that draws 2D data
Definition: vtkActor2D.h:43
record modification and/or execution time
Definition: vtkTimeStamp.h:33
vtkActor2D ** LabelActors
virtual vtkCoordinate * GetPositionCoordinate()
Create an axis with tick marks and labels.
vtkTextProperty * TitleTextProperty
virtual void SetPoint1(double x, double y)
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:81
vtkActor2D * AxisActor
virtual void SetPoint2(double x, double y)
virtual float * GetPosition2()
2D text annotation
Definition: vtkTextMapper.h:43
virtual vtkCoordinate * GetPoint2Coordinate()
virtual void GetAdjustedRange(double &_arg1, double &_arg2)
virtual vtkCoordinate * GetPoint1Coordinate()
vtkPolyData * Axis
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
virtual double * GetAdjustedRange()
vtkTimeStamp AdjustedRangeBuildTime
vtkPolyDataMapper2D * AxisMapper
virtual int HasTranslucentPolygonalGeometry()
virtual int RenderOpaqueGeometry(vtkViewport *viewport)
virtual double * GetPoint2()
a simple class to control print indentation
Definition: vtkIndent.h:37
vtkTextMapper * TitleMapper
void PrintSelf(ostream &os, vtkIndent indent)
static vtkActor2D * New()
vtkTextMapper ** LabelMappers
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
virtual void SetPosition2(float x[2])
virtual float * GetPosition()
#define VTK_MAX_LABELS
virtual void SetPoint2(double x[2])
virtual vtkCoordinate * GetPosition2Coordinate()
represent text properties.
vtkTextProperty * LabelTextProperty
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems ...
Definition: vtkCoordinate.h:68
virtual void SetPoint1(double x[2])
#define VTK_RENDERING_EXPORT
virtual void ShallowCopy(vtkProp *prop)
#define VTK_LARGE_FLOAT
Definition: vtkType.h:149
virtual int RenderOverlay(vtkViewport *viewport)
virtual int GetAdjustedNumberOfLabels()
vtkTimeStamp BuildTime
draw vtkPolyData onto the image plane