VTK
vtkScalarBarActor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkScalarBarActor.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 =========================================================================*/
58 #ifndef __vtkScalarBarActor_h
59 #define __vtkScalarBarActor_h
60 
61 #include "vtkActor2D.h"
62 
63 class vtkPolyData;
65 class vtkScalarsToColors;
66 class vtkTextMapper;
67 class vtkTextProperty;
68 class vtkTexture;
69 
70 #define VTK_ORIENT_HORIZONTAL 0
71 #define VTK_ORIENT_VERTICAL 1
72 
74 {
75 public:
77  void PrintSelf(ostream& os, vtkIndent indent);
78 
82  static vtkScalarBarActor *New();
83 
85 
86  int RenderOpaqueGeometry(vtkViewport* viewport);
87  virtual int RenderTranslucentPolygonalGeometry(vtkViewport*) { return 0; };
88  int RenderOverlay(vtkViewport* viewport);
90 
92  virtual int HasTranslucentPolygonalGeometry();
93 
97  virtual void ReleaseGraphicsResources(vtkWindow *);
98 
100 
103  virtual void SetLookupTable(vtkScalarsToColors*);
104  vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
106 
108 
113  vtkSetMacro( UseOpacity, int );
114  vtkGetMacro( UseOpacity, int );
115  vtkBooleanMacro( UseOpacity, int );
117 
119 
122  vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_LARGE_INTEGER);
123  vtkGetMacro(MaximumNumberOfColors, int);
125 
127 
128  vtkSetClampMacro(NumberOfLabels, int, 0, 64);
129  vtkGetMacro(NumberOfLabels, int);
131 
133 
134  vtkSetClampMacro(Orientation,int,VTK_ORIENT_HORIZONTAL, VTK_ORIENT_VERTICAL);
135  vtkGetMacro(Orientation, int);
136  void SetOrientationToHorizontal()
137  {this->SetOrientation(VTK_ORIENT_HORIZONTAL);};
138  void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);};
140 
142 
143  virtual void SetTitleTextProperty(vtkTextProperty *p);
144  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
146 
148 
149  virtual void SetLabelTextProperty(vtkTextProperty *p);
150  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
152 
154 
155  vtkSetStringMacro(LabelFormat);
156  vtkGetStringMacro(LabelFormat);
158 
160 
161  vtkSetStringMacro(Title);
162  vtkGetStringMacro(Title);
164 
166 
167  vtkSetStringMacro(ComponentTitle);
168  vtkGetStringMacro(ComponentTitle);
170 
173  void ShallowCopy(vtkProp *prop);
174 
176 
177  vtkSetMacro( TextureGridWidth, double );
178  vtkGetMacro( TextureGridWidth, double );
180 
182 
183  vtkGetObjectMacro( TextureActor, vtkActor2D );
185 
186 //BTX
187  enum { PrecedeScalarBar = 0, SucceedScalarBar };
188 //ETX
189 
191 
195  vtkSetClampMacro( TextPosition, int, PrecedeScalarBar, SucceedScalarBar);
196  vtkGetMacro( TextPosition, int );
197  virtual void SetTextPositionToPrecedeScalarBar()
198  { this->SetTextPosition( vtkScalarBarActor::PrecedeScalarBar ); }
199  virtual void SetTextPositionToSucceedScalarBar()
200  { this->SetTextPosition( vtkScalarBarActor::SucceedScalarBar ); }
202 
204 
209  vtkSetMacro( MaximumWidthInPixels, int );
210  vtkGetMacro( MaximumWidthInPixels, int );
211  vtkSetMacro( MaximumHeightInPixels, int );
212  vtkGetMacro( MaximumHeightInPixels, int );
214 
215 protected:
218 
222 
227  char *Title;
229  char *LabelFormat;
230  int UseOpacity; // off by default
233 
236  virtual void AllocateAndSizeLabels(int *labelSize, int *size,
237  vtkViewport *viewport, double *range);
238 
241  virtual void SizeTitle(int *titleSize, int *size, vtkViewport *viewport);
242 
246 
250 
252  int LastSize[2];
253  int LastOrigin[2];
254 
257 
258 private:
259  vtkScalarBarActor(const vtkScalarBarActor&); // Not implemented.
260  void operator=(const vtkScalarBarActor&); // Not implemented.
261 };
262 
263 
264 #endif
265