00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00058 #ifndef __vtkScalarBarActor_h
00059 #define __vtkScalarBarActor_h
00060
00061 #include "vtkActor2D.h"
00062
00063 class vtkPolyData;
00064 class vtkPolyDataMapper2D;
00065 class vtkScalarsToColors;
00066 class vtkTextMapper;
00067 class vtkTextProperty;
00068 class vtkTexture;
00069
00070 #define VTK_ORIENT_HORIZONTAL 0
00071 #define VTK_ORIENT_VERTICAL 1
00072
00073 class VTK_RENDERING_EXPORT vtkScalarBarActor : public vtkActor2D
00074 {
00075 public:
00076 vtkTypeMacro(vtkScalarBarActor,vtkActor2D);
00077 void PrintSelf(ostream& os, vtkIndent indent);
00078
00082 static vtkScalarBarActor *New();
00083
00085
00086 int RenderOpaqueGeometry(vtkViewport* viewport);
00087 virtual int RenderTranslucentPolygonalGeometry(vtkViewport*) { return 0; };
00088 int RenderOverlay(vtkViewport* viewport);
00090
00092 virtual int HasTranslucentPolygonalGeometry();
00093
00097 virtual void ReleaseGraphicsResources(vtkWindow *);
00098
00100
00103 virtual void SetLookupTable(vtkScalarsToColors*);
00104 vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
00106
00108
00113 vtkSetMacro( UseOpacity, int );
00114 vtkGetMacro( UseOpacity, int );
00115 vtkBooleanMacro( UseOpacity, int );
00117
00119
00122 vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_LARGE_INTEGER);
00123 vtkGetMacro(MaximumNumberOfColors, int);
00125
00127
00128 vtkSetClampMacro(NumberOfLabels, int, 0, 64);
00129 vtkGetMacro(NumberOfLabels, int);
00131
00133
00134 vtkSetClampMacro(Orientation,int,VTK_ORIENT_HORIZONTAL, VTK_ORIENT_VERTICAL);
00135 vtkGetMacro(Orientation, int);
00136 void SetOrientationToHorizontal()
00137 {this->SetOrientation(VTK_ORIENT_HORIZONTAL);};
00138 void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);};
00140
00142
00143 virtual void SetTitleTextProperty(vtkTextProperty *p);
00144 vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
00146
00148
00149 virtual void SetLabelTextProperty(vtkTextProperty *p);
00150 vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
00152
00154
00155 vtkSetStringMacro(LabelFormat);
00156 vtkGetStringMacro(LabelFormat);
00158
00160
00161 vtkSetStringMacro(Title);
00162 vtkGetStringMacro(Title);
00164
00167 void ShallowCopy(vtkProp *prop);
00168
00170
00171 vtkSetMacro( TextureGridWidth, double );
00172 vtkGetMacro( TextureGridWidth, double );
00174
00176
00177 vtkGetObjectMacro( TextureActor, vtkActor2D );
00179
00180
00181 enum { PrecedeScalarBar = 0, SucceedScalarBar };
00182
00183
00185
00189 vtkSetClampMacro( TextPosition, int, PrecedeScalarBar, SucceedScalarBar);
00190 vtkGetMacro( TextPosition, int );
00191 virtual void SetTextPositionToPrecedeScalarBar()
00192 { this->SetTextPosition( vtkScalarBarActor::PrecedeScalarBar ); }
00193 virtual void SetTextPositionToSucceedScalarBar()
00194 { this->SetTextPosition( vtkScalarBarActor::SucceedScalarBar ); }
00196
00198
00203 vtkSetMacro( MaximumWidthInPixels, int );
00204 vtkGetMacro( MaximumWidthInPixels, int );
00205 vtkSetMacro( MaximumHeightInPixels, int );
00206 vtkGetMacro( MaximumHeightInPixels, int );
00208
00209 protected:
00210 vtkScalarBarActor();
00211 ~vtkScalarBarActor();
00212
00213 vtkScalarsToColors *LookupTable;
00214 vtkTextProperty *TitleTextProperty;
00215 vtkTextProperty *LabelTextProperty;
00216
00217 int MaximumNumberOfColors;
00218 int NumberOfLabels;
00219 int NumberOfLabelsBuilt;
00220 int Orientation;
00221 char *Title;
00222 char *LabelFormat;
00223 int UseOpacity;
00224 double TextureGridWidth;
00225 int TextPosition;
00226
00227 vtkTextMapper **TextMappers;
00228 vtkActor2D **TextActors;
00229 virtual void AllocateAndSizeLabels(int *labelSize, int *size,
00230 vtkViewport *viewport, double *range);
00231
00232 vtkTextMapper *TitleMapper;
00233 vtkActor2D *TitleActor;
00234 virtual void SizeTitle(int *titleSize, int *size, vtkViewport *viewport);
00235
00236 vtkPolyData *ScalarBar;
00237 vtkPolyDataMapper2D *ScalarBarMapper;
00238 vtkActor2D *ScalarBarActor;
00239
00240 vtkPolyData *TexturePolyData;
00241 vtkTexture *Texture;
00242 vtkActor2D *TextureActor;
00243
00244 vtkTimeStamp BuildTime;
00245 int LastSize[2];
00246 int LastOrigin[2];
00247
00248 int MaximumWidthInPixels;
00249 int MaximumHeightInPixels;
00250
00251 private:
00252 vtkScalarBarActor(const vtkScalarBarActor&);
00253 void operator=(const vtkScalarBarActor&);
00254 };
00255
00256
00257 #endif
00258