Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# Rendering/vtkAxisActor2D.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkAxisActor2D.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00071 #ifndef __vtkAxisActor2D_h
    00072 #define __vtkAxisActor2D_h
    00073
    00074 #include "vtkActor2D.h"
    00075
    00076 class vtkPolyDataMapper2D;
    00077 class vtkPolyData;
    00078 class vtkTextMapper;
    00079 class vtkTextProperty;
    00080
    00081 #define VTK_MAX_LABELS 25
    00082
    00083 class VTK_RENDERING_EXPORT vtkAxisActor2D : public vtkActor2D
    00084 {
    00085 public:
    00086   vtkTypeRevisionMacro(vtkAxisActor2D,vtkActor2D);
    00087   void PrintSelf(ostream& os, vtkIndent indent);
    00088
    00090   static vtkAxisActor2D *New();
    00091
    00093
    00095   virtual vtkCoordinate *GetPoint1Coordinate()
    00096     { return this->GetPositionCoordinate(); };
    00097   virtual void SetPoint1(float x[2]) { this->SetPosition(x); };
    00098   virtual void SetPoint1(float x, float y) { this->SetPosition(x,y); };
    00099   virtual float *GetPoint1() { return this->GetPosition(); };
    00101
    00103
    00107   virtual vtkCoordinate *GetPoint2Coordinate()
    00108     { return this->GetPosition2Coordinate(); };
    00109   virtual void SetPoint2(float x[2]) { this->SetPosition2(x); };
    00110   virtual void SetPoint2(float x, float y) { this->SetPosition2(x,y); };
    00111   virtual float *GetPoint2() { return this->GetPosition2(); };
    00113
    00115
    00117   vtkSetVector2Macro(Range,float);
    00118   vtkGetVectorMacro(Range,float,2);
    00120
    00122
    00123   vtkSetClampMacro(NumberOfLabels, int, 2, VTK_MAX_LABELS);
    00124   vtkGetMacro(NumberOfLabels, int);
    00126
    00128
    00129   vtkSetStringMacro(LabelFormat);
    00130   vtkGetStringMacro(LabelFormat);
    00132
    00134
    00139   vtkSetMacro(AdjustLabels, int);
    00140   vtkGetMacro(AdjustLabels, int);
    00141   vtkBooleanMacro(AdjustLabels, int);
    00142   virtual float *GetAdjustedRange()
    00143     {
    00144       this->UpdateAdjustedRange();
    00145       return this->AdjustedRange;
    00146     }
    00147   virtual void GetAdjustedRange(float &_arg1, float &_arg2)
    00148     {
    00149       this->UpdateAdjustedRange();
    00150       _arg1 = this->AdjustedRange[0];
    00151       _arg2 = this->AdjustedRange[1];
    00152     };
    00153   virtual void GetAdjustedRange(float _arg[2])
    00154     {
    00155       this->GetAdjustedRange(_arg[0], _arg[1]);
    00156     }
    00157   virtual int GetAdjustedNumberOfLabels()
    00158     {
    00159       this->UpdateAdjustedRange();
    00160       return this->AdjustedNumberOfLabels;
    00161     }
    00163
    00165
    00166   vtkSetStringMacro(Title);
    00167   vtkGetStringMacro(Title);
    00169
    00171
    00172   virtual void SetTitleTextProperty(vtkTextProperty *p);
    00173   vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
    00175
    00177
    00178   virtual void SetLabelTextProperty(vtkTextProperty *p);
    00179   vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
    00181
    00182 #ifndef VTK_REMOVE_LEGACY_CODE
    00183
    00184
    00189   virtual void SetFontFamily(int val);
    00190   virtual int GetFontFamily();
    00191   void SetFontFamilyToArial()   { this->SetFontFamily(VTK_ARIAL);  };
    00192   void SetFontFamilyToCourier() { this->SetFontFamily(VTK_COURIER);};
    00193   void SetFontFamilyToTimes()   { this->SetFontFamily(VTK_TIMES);  };
    00195 #endif
    00196
    00197 #ifndef VTK_REMOVE_LEGACY_CODE
    00198
    00199
    00202   virtual void SetBold(int val);
    00203   virtual int GetBold();
    00204   vtkBooleanMacro(Bold, int);
    00206 #endif
    00207
    00208 #ifndef VTK_REMOVE_LEGACY_CODE
    00209
    00210
    00213   virtual void SetItalic(int val);
    00214   virtual int GetItalic();
    00215   vtkBooleanMacro(Italic, int);
    00217 #endif
    00218
    00219 #ifndef VTK_REMOVE_LEGACY_CODE
    00220
    00221
    00224   virtual void SetShadow(int val);
    00225   virtual int GetShadow();
    00226   vtkBooleanMacro(Shadow, int);
    00228 #endif
    00229
    00231
    00233   vtkSetClampMacro(TickLength, int, 0, 100);
    00234   vtkGetMacro(TickLength, int);
    00236
    00238
    00241   vtkSetClampMacro(TickOffset, int, 0, 100);
    00242   vtkGetMacro(TickOffset, int);
    00244
    00246
    00247   vtkSetMacro(AxisVisibility, int);
    00248   vtkGetMacro(AxisVisibility, int);
    00249   vtkBooleanMacro(AxisVisibility, int);
    00251
    00253
    00254   vtkSetMacro(TickVisibility, int);
    00255   vtkGetMacro(TickVisibility, int);
    00256   vtkBooleanMacro(TickVisibility, int);
    00258
    00260
    00261   vtkSetMacro(LabelVisibility, int);
    00262   vtkGetMacro(LabelVisibility, int);
    00263   vtkBooleanMacro(LabelVisibility, int);
    00265
    00267
    00268   vtkSetMacro(TitleVisibility, int);
    00269   vtkGetMacro(TitleVisibility, int);
    00270   vtkBooleanMacro(TitleVisibility, int);
    00272
    00274
    00277   vtkSetClampMacro(FontFactor, float, 0.1, 2.0);
    00278   vtkGetMacro(FontFactor, float);
    00280
    00282
    00284   vtkSetClampMacro(LabelFactor, float, 0.1, 2.0);
    00285   vtkGetMacro(LabelFactor, float);
    00287
    00289
    00290   int RenderOverlay(vtkViewport* viewport);
    00291   int RenderOpaqueGeometry(vtkViewport* viewport);
    00292   int RenderTranslucentGeometry(vtkViewport *) {return 0;}
    00294
    00298   void ReleaseGraphicsResources(vtkWindow *);
    00299
    00301
    00309   static void ComputeRange(float inRange[2],
    00310                            float outRange[2],
    00311                            int inNumTicks,
    00312                            int &outNumTicks,
    00313                            float &interval);
    00315
    00317
    00324   static int SetFontSize(vtkViewport *viewport,
    00325                          vtkTextMapper *textMapper,
    00326                          int *targetSize,
    00327                          float factor,
    00328                          int *stringSize);
    00329   static int SetMultipleFontSize(vtkViewport *viewport,
    00330                                  vtkTextMapper **textMappers,
    00331                                  int nbOfMappers,
    00332                                  int *targetSize,
    00333                                  float factor,
    00334                                  int *stringSize);
    00336
    00338   void ShallowCopy(vtkProp *prop);
    00339
    00340 protected:
    00341   vtkAxisActor2D();
    00342   ~vtkAxisActor2D();
    00343
    00344   vtkTextProperty *TitleTextProperty;
    00345   vtkTextProperty *LabelTextProperty;
    00346
    00347   char  *Title;
    00348   float Range[2];
    00349   int   NumberOfLabels;
    00350   char  *LabelFormat;
    00351   int   AdjustLabels;
    00352   float FontFactor;
    00353   float LabelFactor;
    00354   int   TickLength;
    00355   int   TickOffset;
    00356
    00357   float AdjustedRange[2];
    00358   int   AdjustedNumberOfLabels;
    00359   int   NumberOfLabelsBuilt;
    00360
    00361   int   AxisVisibility;
    00362   int   TickVisibility;
    00363   int   LabelVisibility;
    00364   int   TitleVisibility;
    00365
    00366   int   LastPosition[2];
    00367   int   LastPosition2[2];
    00368
    00369   int   LastSize[2];
    00370   int   LastMaxLabelSize[2];
    00371
    00372   virtual void BuildAxis(vtkViewport *viewport);
    00373   static float ComputeStringOffset(float width, float height, float theta);
    00374   static void SetOffsetPosition(float xTick[3], float theta, int stringHeight,
    00375                                 int stringWidth, int offset, vtkActor2D *actor);
    00376   virtual void UpdateAdjustedRange();
    00377
    00378   vtkTextMapper *TitleMapper;
    00379   vtkActor2D    *TitleActor;
    00380
    00381   vtkTextMapper **LabelMappers;
    00382   vtkActor2D    **LabelActors;
    00383
    00384   vtkPolyData         *Axis;
    00385   vtkPolyDataMapper2D *AxisMapper;
    00386   vtkActor2D          *AxisActor;
    00387
    00388   vtkTimeStamp  AdjustedRangeBuildTime;
    00389   vtkTimeStamp  BuildTime;
    00390
    00391 private:
    00392   vtkAxisActor2D(const vtkAxisActor2D&);  // Not implemented.
    00393   void operator=(const vtkAxisActor2D&);  // Not implemented.
    00394 };
    00395
    00396
    00397 #endif