VTK
dox/Hybrid/vtkLegendScaleActor.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkLegendScaleActor.h
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 =========================================================================*/
00039 #ifndef __vtkLegendScaleActor_h
00040 #define __vtkLegendScaleActor_h
00041 
00042 #include "vtkProp.h"
00043 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
00044 
00045 class vtkAxisActor2D;
00046 class vtkTextProperty;
00047 class vtkPolyData;
00048 class vtkPolyDataMapper2D;
00049 class vtkActor2D;
00050 class vtkTextMapper;
00051 class vtkPoints;
00052 class vtkCoordinate;
00053 
00054 class VTK_HYBRID_EXPORT vtkLegendScaleActor : public vtkProp
00055 {
00056 public:
00058   static vtkLegendScaleActor *New();
00059 
00061 
00062   vtkTypeMacro(vtkLegendScaleActor,vtkProp);
00063   void PrintSelf(ostream& os, vtkIndent indent);
00065 
00066 //BTX
00067   enum AttributeLocation
00068   {
00069     DISTANCE=0,
00070     XY_COORDINATES=1
00071   };
00072 //ETX
00073 
00075 
00079   vtkSetClampMacro(LabelMode,int,DISTANCE,XY_COORDINATES);
00080   vtkGetMacro(LabelMode,int);
00081   void SetLabelModeToDistance() {this->SetLabelMode(DISTANCE);}
00082   void SetLabelModeToXYCoordinates() {this->SetLabelMode(XY_COORDINATES);}
00084 
00086 
00089   vtkSetMacro(RightAxisVisibility,int);
00090   vtkGetMacro(RightAxisVisibility,int);
00091   vtkBooleanMacro(RightAxisVisibility,int);
00092   vtkSetMacro(TopAxisVisibility,int);
00093   vtkGetMacro(TopAxisVisibility,int);
00094   vtkBooleanMacro(TopAxisVisibility,int);
00095   vtkSetMacro(LeftAxisVisibility,int);
00096   vtkGetMacro(LeftAxisVisibility,int);
00097   vtkBooleanMacro(LeftAxisVisibility,int);
00098   vtkSetMacro(BottomAxisVisibility,int);
00099   vtkGetMacro(BottomAxisVisibility,int);
00100   vtkBooleanMacro(BottomAxisVisibility,int);
00102 
00104 
00106   vtkSetMacro(LegendVisibility,int);
00107   vtkGetMacro(LegendVisibility,int);
00108   vtkBooleanMacro(LegendVisibility,int);
00110 
00112 
00113   void AllAxesOn();
00114   void AllAxesOff();
00116 
00118 
00119   void AllAnnotationsOn();
00120   void AllAnnotationsOff();
00122 
00124 
00127   vtkSetClampMacro(RightBorderOffset,int,5,VTK_LARGE_INTEGER);
00128   vtkGetMacro(RightBorderOffset,int);
00130 
00132 
00135   vtkSetClampMacro(TopBorderOffset,int,5,VTK_LARGE_INTEGER);
00136   vtkGetMacro(TopBorderOffset,int);
00138 
00140 
00143   vtkSetClampMacro(LeftBorderOffset,int,5,VTK_LARGE_INTEGER);
00144   vtkGetMacro(LeftBorderOffset,int);
00146 
00148 
00151   vtkSetClampMacro(BottomBorderOffset,int,5,VTK_LARGE_INTEGER);
00152   vtkGetMacro(BottomBorderOffset,int);
00154 
00156 
00158   vtkSetClampMacro(CornerOffsetFactor, double, 1.0, 10.0);
00159   vtkGetMacro(CornerOffsetFactor, double);
00161 
00163 
00164   vtkGetObjectMacro(LegendTitleProperty,vtkTextProperty);
00165   vtkGetObjectMacro(LegendLabelProperty,vtkTextProperty);
00167       
00169 
00172   vtkGetObjectMacro(RightAxis,vtkAxisActor2D);
00173   vtkGetObjectMacro(TopAxis,vtkAxisActor2D);
00174   vtkGetObjectMacro(LeftAxis,vtkAxisActor2D);
00175   vtkGetObjectMacro(BottomAxis,vtkAxisActor2D);
00177 
00179 
00180   virtual void BuildRepresentation(vtkViewport *viewport);
00181   virtual void GetActors2D(vtkPropCollection*);
00182   virtual void ReleaseGraphicsResources(vtkWindow*);
00183   virtual int RenderOverlay(vtkViewport*);
00184   virtual int RenderOpaqueGeometry(vtkViewport*);
00186 
00187 protected:
00188   vtkLegendScaleActor();
00189   ~vtkLegendScaleActor();
00190 
00191   int    LabelMode;
00192   int    RightBorderOffset;
00193   int    TopBorderOffset;
00194   int    LeftBorderOffset;
00195   int    BottomBorderOffset;
00196   double CornerOffsetFactor;
00197   
00198   // The four axes around the borders of the renderer
00199   vtkAxisActor2D *RightAxis;
00200   vtkAxisActor2D *TopAxis;
00201   vtkAxisActor2D *LeftAxis;
00202   vtkAxisActor2D *BottomAxis;
00203   
00204   // Control the display of the axes
00205   int RightAxisVisibility;
00206   int TopAxisVisibility;
00207   int LeftAxisVisibility;
00208   int BottomAxisVisibility;
00209   
00210   // Support for the legend.
00211   int                  LegendVisibility;
00212   vtkPolyData         *Legend;
00213   vtkPoints           *LegendPoints;
00214   vtkPolyDataMapper2D *LegendMapper;
00215   vtkActor2D          *LegendActor;
00216   vtkTextMapper       *LabelMappers[6];
00217   vtkActor2D          *LabelActors[6];
00218   vtkTextProperty     *LegendTitleProperty;
00219   vtkTextProperty     *LegendLabelProperty;
00220   vtkCoordinate       *Coordinate;
00221   
00222   vtkTimeStamp         BuildTime;
00223 
00224 private:
00225   vtkLegendScaleActor(const vtkLegendScaleActor&);  //Not implemented
00226   void operator=(const vtkLegendScaleActor&);  //Not implemented
00227 };
00228 
00229 #endif