• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Rendering/vtkAxisActor2D.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkAxisActor2D.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00057 #ifndef __vtkAxisActor2D_h
00058 #define __vtkAxisActor2D_h
00059 
00060 #include "vtkActor2D.h"
00061 
00062 class vtkPolyDataMapper2D;
00063 class vtkPolyData;
00064 class vtkTextMapper;
00065 class vtkTextProperty;
00066 
00067 #define VTK_MAX_LABELS 25
00068 
00069 class VTK_RENDERING_EXPORT vtkAxisActor2D : public vtkActor2D
00070 {
00071 public:
00072   vtkTypeRevisionMacro(vtkAxisActor2D,vtkActor2D);
00073   void PrintSelf(ostream& os, vtkIndent indent);
00074 
00076   static vtkAxisActor2D *New();
00077 
00079 
00081   virtual vtkCoordinate *GetPoint1Coordinate() 
00082     { return this->GetPositionCoordinate(); };
00083   virtual void SetPoint1(double x[2]) { this->SetPosition(x); };
00084   virtual void SetPoint1(double x, double y) { this->SetPosition(x,y); };
00085   virtual double *GetPoint1() { return this->GetPosition(); };
00087 
00089 
00093   virtual vtkCoordinate *GetPoint2Coordinate() 
00094     { return this->GetPosition2Coordinate(); };
00095   virtual void SetPoint2(double x[2]) { this->SetPosition2(x); };
00096   virtual void SetPoint2(double x, double y) { this->SetPosition2(x,y); };
00097   virtual double *GetPoint2() { return this->GetPosition2(); };
00099 
00101 
00103   vtkSetVector2Macro(Range,double);
00104   vtkGetVectorMacro(Range,double,2);
00106 
00108 
00109   vtkSetClampMacro(NumberOfLabels, int, 2, VTK_MAX_LABELS);
00110   vtkGetMacro(NumberOfLabels, int);
00112   
00114 
00115   vtkSetStringMacro(LabelFormat);
00116   vtkGetStringMacro(LabelFormat);
00118 
00120 
00125   vtkSetMacro(AdjustLabels, int);
00126   vtkGetMacro(AdjustLabels, int);
00127   vtkBooleanMacro(AdjustLabels, int);
00128   virtual double *GetAdjustedRange()
00129     { 
00130       this->UpdateAdjustedRange();
00131       return this->AdjustedRange; 
00132     }
00133   virtual void GetAdjustedRange(double &_arg1, double &_arg2)
00134     { 
00135       this->UpdateAdjustedRange();
00136       _arg1 = this->AdjustedRange[0];
00137       _arg2 = this->AdjustedRange[1];
00138     }; 
00139   virtual void GetAdjustedRange(double _arg[2]) 
00140     { 
00141       this->GetAdjustedRange(_arg[0], _arg[1]);
00142     } 
00143   virtual int GetAdjustedNumberOfLabels()
00144     {
00145       this->UpdateAdjustedRange();
00146       return this->AdjustedNumberOfLabels; 
00147     }
00149 
00151 
00152   vtkSetStringMacro(Title);
00153   vtkGetStringMacro(Title);
00155 
00157 
00158   virtual void SetTitleTextProperty(vtkTextProperty *p);
00159   vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
00161   
00163 
00164   virtual void SetLabelTextProperty(vtkTextProperty *p);
00165   vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
00167       
00169 
00171   vtkSetClampMacro(TickLength, int, 0, 100);
00172   vtkGetMacro(TickLength, int);
00174 
00176 
00178   vtkSetClampMacro(NumberOfMinorTicks, int, 0, 20);
00179   vtkGetMacro(NumberOfMinorTicks, int);
00181 
00183 
00185   vtkSetClampMacro(MinorTickLength, int, 0, 100);
00186   vtkGetMacro(MinorTickLength, int);
00188   
00190 
00193   vtkSetClampMacro(TickOffset, int, 0, 100);
00194   vtkGetMacro(TickOffset, int);
00196   
00198 
00199   vtkSetMacro(AxisVisibility, int);
00200   vtkGetMacro(AxisVisibility, int);
00201   vtkBooleanMacro(AxisVisibility, int);
00203 
00205 
00206   vtkSetMacro(TickVisibility, int);
00207   vtkGetMacro(TickVisibility, int);
00208   vtkBooleanMacro(TickVisibility, int);
00210 
00212 
00213   vtkSetMacro(LabelVisibility, int);
00214   vtkGetMacro(LabelVisibility, int);
00215   vtkBooleanMacro(LabelVisibility, int);
00217 
00219 
00220   vtkSetMacro(TitleVisibility, int);
00221   vtkGetMacro(TitleVisibility, int);
00222   vtkBooleanMacro(TitleVisibility, int);
00224 
00226 
00228   vtkSetMacro(TitlePosition, double);
00229   vtkGetMacro(TitlePosition, double);
00231 
00233 
00236   vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
00237   vtkGetMacro(FontFactor, double);
00239 
00241 
00243   vtkSetClampMacro(LabelFactor, double, 0.1, 2.0);
00244   vtkGetMacro(LabelFactor, double);
00246 
00248 
00249   int RenderOverlay(vtkViewport* viewport);
00250   int RenderOpaqueGeometry(vtkViewport* viewport);
00251   virtual int RenderTranslucentPolygonalGeometry(vtkViewport *) {return 0;}
00253   
00255   virtual int HasTranslucentPolygonalGeometry();
00256   
00260   void ReleaseGraphicsResources(vtkWindow *);
00261 
00263 
00271   static void ComputeRange(double inRange[2], 
00272                            double outRange[2],
00273                            int inNumTicks, 
00274                            int &outNumTicks, 
00275                            double &interval);
00277 
00279 
00286   static int SetMultipleFontSize(vtkViewport *viewport, 
00287                                  vtkTextMapper **textMappers, 
00288                                  int nbOfMappers, 
00289                                  int *targetSize,
00290                                  double factor, 
00291                                  int *stringSize);
00293 
00295 
00298   vtkSetMacro(SizeFontRelativeToAxis,int);
00299   vtkGetMacro(SizeFontRelativeToAxis,int);
00300   vtkBooleanMacro(SizeFontRelativeToAxis,int);
00302 
00304   void ShallowCopy(vtkProp *prop);
00305 
00306 protected:
00307   vtkAxisActor2D();
00308   ~vtkAxisActor2D();
00309 
00310   vtkTextProperty *TitleTextProperty;
00311   vtkTextProperty *LabelTextProperty;
00312 
00313   char  *Title;
00314   double Range[2];
00315   double TitlePosition;
00316   int   NumberOfLabels;
00317   char  *LabelFormat;
00318   int   AdjustLabels;
00319   double FontFactor;
00320   double LabelFactor;
00321   int   TickLength;
00322   int   MinorTickLength;
00323   int   TickOffset;
00324   int NumberOfMinorTicks;
00325 
00326   double AdjustedRange[2];
00327   int   AdjustedNumberOfLabels;
00328   int   NumberOfLabelsBuilt;
00329 
00330   int   AxisVisibility;
00331   int   TickVisibility;
00332   int   LabelVisibility;
00333   int   TitleVisibility;
00334   
00335   int   LastPosition[2];
00336   int   LastPosition2[2];
00337   
00338   int   LastSize[2];
00339   int   LastMaxLabelSize[2];
00340   
00341   int  SizeFontRelativeToAxis;
00342 
00343   virtual void BuildAxis(vtkViewport *viewport);
00344   static double ComputeStringOffset(double width, double height, double theta);
00345   static void SetOffsetPosition(double xTick[3], double theta, 
00346                                 int stringHeight, int stringWidth, 
00347                                 int offset, vtkActor2D *actor);
00348   virtual void UpdateAdjustedRange();
00349   
00350   vtkTextMapper *TitleMapper;
00351   vtkActor2D    *TitleActor;
00352 
00353   vtkTextMapper **LabelMappers;
00354   vtkActor2D    **LabelActors;
00355 
00356   vtkPolyData         *Axis;
00357   vtkPolyDataMapper2D *AxisMapper;
00358   vtkActor2D          *AxisActor;
00359 
00360   vtkTimeStamp  AdjustedRangeBuildTime;
00361   vtkTimeStamp  BuildTime;
00362 
00363 private:
00364   vtkAxisActor2D(const vtkAxisActor2D&);  // Not implemented.
00365   void operator=(const vtkAxisActor2D&);  // Not implemented.
00366 };
00367 
00368 
00369 #endif

Generated by  doxygen 1.7.1