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 "vtkRenderingAnnotationModule.h" // For export macro
64 #include "vtkActor2D.h"
65 
67 class vtkPolyData;
68 class vtkTextMapper;
69 class vtkTextProperty;
70 
71 #define VTK_MAX_LABELS 25
72 
74 {
75 public:
76  vtkTypeMacro(vtkAxisActor2D,vtkActor2D);
77  void PrintSelf(ostream& os, vtkIndent indent);
78 
80  static vtkAxisActor2D *New();
81 
83 
86  { return this->GetPositionCoordinate(); };
87  virtual void SetPoint1(double x[2]) { this->SetPosition(x); };
88  virtual void SetPoint1(double x, double y) { this->SetPosition(x,y); };
89  virtual double *GetPoint1() { return this->GetPosition(); };
91 
93 
98  { return this->GetPosition2Coordinate(); };
99  virtual void SetPoint2(double x[2]) { this->SetPosition2(x); };
100  virtual void SetPoint2(double x, double y) { this->SetPosition2(x,y); };
101  virtual double *GetPoint2() { return this->GetPosition2(); };
103 
105 
107  vtkSetVector2Macro(Range,double);
108  vtkGetVectorMacro(Range,double,2);
110 
112 
115  vtkSetMacro(RulerMode,int);
116  vtkGetMacro(RulerMode,int);
117  vtkBooleanMacro(RulerMode,int);
119 
121 
123  vtkSetClampMacro(RulerDistance,double,0,VTK_FLOAT_MAX);
124  vtkGetMacro(RulerDistance,double);
126 
128 
131  vtkSetClampMacro(NumberOfLabels, int, 2, VTK_MAX_LABELS);
132  vtkGetMacro(NumberOfLabels, int);
134 
136 
137  vtkSetStringMacro(LabelFormat);
138  vtkGetStringMacro(LabelFormat);
140 
142 
148  vtkSetMacro(AdjustLabels, int);
149  vtkGetMacro(AdjustLabels, int);
150  vtkBooleanMacro(AdjustLabels, int);
151  virtual double *GetAdjustedRange()
152  {
153  this->UpdateAdjustedRange();
154  return this->AdjustedRange;
155  }
156  virtual void GetAdjustedRange(double &_arg1, double &_arg2)
157  {
158  this->UpdateAdjustedRange();
159  _arg1 = this->AdjustedRange[0];
160  _arg2 = this->AdjustedRange[1];
161  };
162  virtual void GetAdjustedRange(double _arg[2])
163  {
164  this->GetAdjustedRange(_arg[0], _arg[1]);
165  }
167  {
168  this->UpdateAdjustedRange();
169  return this->AdjustedNumberOfLabels;
170  }
172 
174 
175  vtkSetStringMacro(Title);
176  vtkGetStringMacro(Title);
178 
180 
181  virtual void SetTitleTextProperty(vtkTextProperty *p);
182  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
184 
186 
187  virtual void SetLabelTextProperty(vtkTextProperty *p);
188  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
190 
192 
194  vtkSetClampMacro(TickLength, int, 0, 100);
195  vtkGetMacro(TickLength, int);
197 
199 
201  vtkSetClampMacro(NumberOfMinorTicks, int, 0, 20);
202  vtkGetMacro(NumberOfMinorTicks, int);
204 
206 
208  vtkSetClampMacro(MinorTickLength, int, 0, 100);
209  vtkGetMacro(MinorTickLength, int);
211 
213 
216  vtkSetClampMacro(TickOffset, int, 0, 100);
217  vtkGetMacro(TickOffset, int);
219 
221 
222  vtkSetMacro(AxisVisibility, int);
223  vtkGetMacro(AxisVisibility, int);
224  vtkBooleanMacro(AxisVisibility, int);
226 
228 
229  vtkSetMacro(TickVisibility, int);
230  vtkGetMacro(TickVisibility, int);
231  vtkBooleanMacro(TickVisibility, int);
233 
235 
236  vtkSetMacro(LabelVisibility, int);
237  vtkGetMacro(LabelVisibility, int);
238  vtkBooleanMacro(LabelVisibility, int);
240 
242 
243  vtkSetMacro(TitleVisibility, int);
244  vtkGetMacro(TitleVisibility, int);
245  vtkBooleanMacro(TitleVisibility, int);
247 
249 
251  vtkSetMacro(TitlePosition, double);
252  vtkGetMacro(TitlePosition, double);
254 
256 
259  vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
260  vtkGetMacro(FontFactor, double);
262 
264 
266  vtkSetClampMacro(LabelFactor, double, 0.1, 2.0);
267  vtkGetMacro(LabelFactor, double);
269 
271 
272  int RenderOverlay(vtkViewport* viewport);
273  int RenderOpaqueGeometry(vtkViewport* viewport);
276 
278  virtual int HasTranslucentPolygonalGeometry();
279 
284 
286 
294  static void ComputeRange(double inRange[2],
295  double outRange[2],
296  int inNumTicks,
297  int &outNumTicks,
298  double &interval);
300 
302 
309  static int SetMultipleFontSize(vtkViewport *viewport,
310  vtkTextMapper **textMappers,
311  int nbOfMappers,
312  int *targetSize,
313  double factor,
314  int *stringSize);
316 
318 
321  vtkSetMacro(SizeFontRelativeToAxis,int);
322  vtkGetMacro(SizeFontRelativeToAxis,int);
323  vtkBooleanMacro(SizeFontRelativeToAxis,int);
325 
327  void ShallowCopy(vtkProp *prop);
328 
329 protected:
330  vtkAxisActor2D();
331  ~vtkAxisActor2D();
332 
335 
336  char *Title;
337  double Range[2];
342  char *LabelFormat;
344  double FontFactor;
345  double LabelFactor;
350 
351  double AdjustedRange[2];
354 
359 
360  int LastPosition[2];
361  int LastPosition2[2];
362 
363  int LastSize[2];
364  int LastMaxLabelSize[2];
365 
367 
368  virtual void BuildAxis(vtkViewport *viewport);
369  static double ComputeStringOffset(double width, double height, double theta);
370  static void SetOffsetPosition(double xTick[3], double theta,
371  int stringHeight, int stringWidth,
372  int offset, vtkActor2D *actor);
373  virtual void UpdateAdjustedRange();
374 
377 
380 
384 
387 
388 private:
389  vtkAxisActor2D(const vtkAxisActor2D&); // Not implemented.
390  void operator=(const vtkAxisActor2D&); // Not implemented.
391 };
392 
393 
394 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
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:46
virtual double * GetPoint1()
a actor that draws 2D data
Definition: vtkActor2D.h:44
record modification and/or execution time
Definition: vtkTimeStamp.h:34
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:84
vtkActor2D * AxisActor
virtual void SetPoint2(double x, double y)
virtual float * GetPosition2()
2D text annotation
Definition: vtkTextMapper.h:52
#define VTKRENDERINGANNOTATION_EXPORT
virtual vtkCoordinate * GetPoint2Coordinate()
virtual void GetAdjustedRange(double &_arg1, double &_arg2)
virtual vtkCoordinate * GetPoint1Coordinate()
vtkPolyData * Axis
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
virtual double * GetAdjustedRange()
vtkTimeStamp AdjustedRangeBuildTime
#define VTK_FLOAT_MAX
Definition: vtkType.h:138
vtkPolyDataMapper2D * AxisMapper
virtual int HasTranslucentPolygonalGeometry()
virtual int RenderOpaqueGeometry(vtkViewport *viewport)
virtual double * GetPoint2()
a simple class to control print indentation
Definition: vtkIndent.h:38
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:69
virtual void SetPoint1(double x[2])
virtual void ShallowCopy(vtkProp *prop)
virtual int RenderOverlay(vtkViewport *viewport)
virtual int GetAdjustedNumberOfLabels()
vtkTimeStamp BuildTime
draw vtkPolyData onto the image plane