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 "vtkRenderingAnnotationModule.h" // For export macro
62 #include "vtkActor2D.h"
63 
64 class vtkColor3ub;
65 class vtkPolyData;
67 class vtkProperty2D;
68 class vtkScalarsToColors;
70 class vtkTextActor;
71 class vtkTextMapper;
72 class vtkTextProperty;
73 class vtkTexture;
74 class vtkTexturedActor2D;
75 
76 #define VTK_ORIENT_HORIZONTAL 0
77 #define VTK_ORIENT_VERTICAL 1
78 
80 {
81 public:
83  void PrintSelf(ostream& os, vtkIndent indent);
84 
88  static vtkScalarBarActor* New();
89 
91 
92  int RenderOpaqueGeometry(vtkViewport* viewport);
93  virtual int RenderTranslucentPolygonalGeometry(vtkViewport*) { return 0; };
94  int RenderOverlay(vtkViewport* viewport);
96 
98  virtual int HasTranslucentPolygonalGeometry();
99 
103  virtual void ReleaseGraphicsResources(vtkWindow*);
104 
108  virtual void GetScalarBarRect(int rect[4], vtkViewport* viewport);
109 
111 
115  virtual void SetLookupTable(vtkScalarsToColors*);
116  vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
118 
120 
125  vtkSetMacro( UseOpacity, int );
126  vtkGetMacro( UseOpacity, int );
127  vtkBooleanMacro( UseOpacity, int );
129 
131 
134  vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_INT_MAX);
135  vtkGetMacro(MaximumNumberOfColors, int);
137 
139 
140  vtkSetClampMacro(NumberOfLabels, int, 0, 64);
141  vtkGetMacro(NumberOfLabels, int);
143 
145 
146  vtkSetClampMacro(Orientation,int,VTK_ORIENT_HORIZONTAL, VTK_ORIENT_VERTICAL);
147  vtkGetMacro(Orientation, int);
149  {this->SetOrientation(VTK_ORIENT_HORIZONTAL);}
150  void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);}
152 
154 
155  virtual void SetTitleTextProperty(vtkTextProperty* p);
156  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
158 
160 
161  virtual void SetLabelTextProperty(vtkTextProperty* p);
162  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
164 
166 
167  vtkSetStringMacro(LabelFormat);
168  vtkGetStringMacro(LabelFormat);
170 
172 
173  vtkSetStringMacro(Title);
174  vtkGetStringMacro(Title);
176 
178 
179  vtkSetStringMacro(ComponentTitle);
180  vtkGetStringMacro(ComponentTitle);
182 
185  void ShallowCopy(vtkProp* prop);
186 
188 
189  vtkSetMacro( TextureGridWidth, double );
190  vtkGetMacro( TextureGridWidth, double );
192 
194 
195  vtkGetObjectMacro( TextureActor, vtkTexturedActor2D );
197 
198 //BTX
199  enum { PrecedeScalarBar = 0, SucceedScalarBar };
200 //ETX
201 
203 
209  vtkSetClampMacro( TextPosition, int, PrecedeScalarBar, SucceedScalarBar);
210  vtkGetMacro( TextPosition, int );
212  { this->SetTextPosition( vtkScalarBarActor::PrecedeScalarBar ); }
214  { this->SetTextPosition( vtkScalarBarActor::SucceedScalarBar ); }
216 
218 
223  vtkSetMacro( MaximumWidthInPixels, int );
224  vtkGetMacro( MaximumWidthInPixels, int );
225  vtkSetMacro( MaximumHeightInPixels, int );
226  vtkGetMacro( MaximumHeightInPixels, int );
228 
230 
232  vtkSetMacro(AnnotationLeaderPadding, double);
233  vtkGetMacro(AnnotationLeaderPadding, double);
235 
237 
240  vtkSetMacro(DrawAnnotations, int);
241  vtkGetMacro(DrawAnnotations, int);
242  vtkBooleanMacro(DrawAnnotations, int);
244 
246 
249  vtkSetMacro(DrawNanAnnotation, int);
250  vtkGetMacro(DrawNanAnnotation, int);
251  vtkBooleanMacro(DrawNanAnnotation, int);
253 
255 
260  vtkSetMacro(FixedAnnotationLeaderLineColor, int);
261  vtkGetMacro(FixedAnnotationLeaderLineColor, int);
262  vtkBooleanMacro(FixedAnnotationLeaderLineColor, int);
264 
266 
267  vtkSetStringMacro(NanAnnotation);
268  vtkGetStringMacro(NanAnnotation);
270 
272 
277  vtkSetMacro(AnnotationTextScaling,int);
278  vtkGetMacro(AnnotationTextScaling,int);
280 
282 
284  vtkSetMacro(DrawBackground, int);
285  vtkGetMacro(DrawBackground, int);
286  vtkBooleanMacro(DrawBackground, int);
288 
290 
292  vtkSetMacro(DrawFrame, int);
293  vtkGetMacro(DrawFrame, int);
294  vtkBooleanMacro(DrawFrame, int);
296 
298 
300  vtkSetMacro(DrawColorBar, int);
301  vtkGetMacro(DrawColorBar, int);
302  vtkBooleanMacro(DrawColorBar, int);
304 
306 
307  vtkSetMacro(DrawTickLabels, int);
308  vtkGetMacro(DrawTickLabels, int);
309  vtkBooleanMacro(DrawTickLabels, int);
311 
313 
314  virtual void SetBackgroundProperty(vtkProperty2D* p);
315  vtkGetObjectMacro(BackgroundProperty,vtkProperty2D);
317 
319 
320  virtual void SetFrameProperty(vtkProperty2D* p);
321  vtkGetObjectMacro(FrameProperty,vtkProperty2D);
323 
325 
327  vtkGetMacro(TextPad,int);
328  vtkSetMacro(TextPad,int);
330 
332 
334  vtkGetMacro(VerticalTitleSeparation,int);
335  vtkSetMacro(VerticalTitleSeparation,int);
337 
339 
341  vtkGetMacro(BarRatio,double);
342  vtkSetClampMacro(BarRatio,double,0.,1.);
344 
346 
350  vtkGetMacro(TitleRatio,double);
351  vtkSetClampMacro(TitleRatio,double,0.,1.);
353 
354 protected:
357 
374  virtual void RebuildLayout(vtkViewport* viewport);
375 
377  virtual void FreeLayoutStorage();
378 
384  virtual void ComputeFrame();
385 
391  virtual void ComputeScalarBarThickness();
392 
396  virtual void LayoutNanSwatch();
397 
399  virtual void PrepareTitleText();
400 
407  virtual void LayoutTitle();
408 
414  virtual void ComputeScalarBarLength();
415 
421  virtual void LayoutTicks();
422 
426  virtual void LayoutAnnotations();
427 
429  virtual void ConfigureAnnotations();
430 
433  virtual void ConfigureFrame();
434 
436  virtual void DrawBoxes();
437 
440  virtual void ConfigureScalarBar();
441 
443  virtual void ConfigureTitle();
444 
446  virtual void ConfigureTicks();
447 
451  virtual void ConfigureNanSwatch();
452 
460  virtual void EditAnnotations() { }
461 
464  virtual void SizeTitle(double* titleSize, int* size, vtkViewport* viewport);
465 
467 
469  int MapAnnotationLabels(
470  vtkScalarsToColors* lkup, double start, double delta, const double* range);
472 
474 
476  int PlaceAnnotationsVertically(
477  double barX, double barY, double barWidth, double barHeight,
478  double delta, double pad);
480 
481 
483  int PlaceAnnotationsHorizontally(
484  double barX, double barY, double barWidth, double barHeight,
485  double delta, double pad);
487 
489 
494  int DrawBackground; // off by default
495  int DrawFrame; // off by default
496  int DrawColorBar; // on by default
497  int DrawTickLabels; // on by default
500  int AnnotationTextScaling; // off by default
504  char* Title;
506  char* LabelFormat;
507  int UseOpacity; // off by default
514  int TextPad;
516  double BarRatio;
517  double TitleRatio;
519 
521 
523  int LastSize[2];
524  int LastOrigin[2];
525 
527 
529 
533 
540 
544 
548 
549 
550 private:
551  vtkScalarBarActor(const vtkScalarBarActor&); // Not implemented.
552  void operator=(const vtkScalarBarActor&); // Not implemented.
553 };
554 
555 
556 #endif
557 
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
int TextPad
User-changeable settings.
int DrawNanAnnotation
User-changeable settings.
int MaximumWidthInPixels
User-changeable settings.
int DrawTickLabels
User-changeable settings.
virtual void EditAnnotations()
double TitleRatio
User-changeable settings.
actor that draws 2D data with texture support
vtkPolyDataMapper2D * ScalarBarMapper
Mapper for ScalarBar.
int DrawFrame
User-changeable settings.
virtual void ReleaseGraphicsResources(vtkWindow *)
abstract specification for Viewports
Definition: vtkViewport.h:46
virtual void SetTextPositionToPrecedeScalarBar()
vtkScalarsToColors * LookupTable
The object this actor illustrates.
#define VTK_INT_MAX
Definition: vtkType.h:130
vtkPolyDataMapper2D * BackgroundMapper
Mapper for Background.
a actor that draws 2D data
Definition: vtkActor2D.h:44
record modification and/or execution time
Definition: vtkTimeStamp.h:34
Internal state for the scalar bar actor shared with subclasses.
int NumberOfLabelsBuilt
User-changeable settings.
vtkActor2D * FrameActor
Actor for Frame.
Create a scalar bar with labels.
int UseOpacity
User-changeable settings.
int VerticalTitleSeparation
User-changeable settings.
int DrawColorBar
User-changeable settings.
int AnnotationTextScaling
User-changeable settings.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
double TextureGridWidth
User-changeable settings.
vtkTexture * Texture
Color data for TexturePolyData.
int FixedAnnotationLeaderLineColor
User-changeable settings.
2D text annotation
Definition: vtkTextMapper.h:52
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
#define VTKRENDERINGANNOTATION_EXPORT
char * ComponentTitle
User-changeable settings.
#define VTK_ORIENT_VERTICAL
int MaximumHeightInPixels
User-changeable settings.
char * Title
User-changeable settings.
Superclass for mapping scalar values to colors.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
vtkActor2D * BackgroundActor
Actor for Background.
An actor that displays text. Scaled or unscaled.
Definition: vtkTextActor.h:54
#define VTK_ORIENT_HORIZONTAL
virtual int HasTranslucentPolygonalGeometry()
virtual int RenderOpaqueGeometry(vtkViewport *viewport)
a simple class to control print indentation
Definition: vtkIndent.h:38
char * LabelFormat
User-changeable settings.
void PrintSelf(ostream &os, vtkIndent indent)
vtkScalarBarActorInternal * P
Containers shared with subclasses.
int NumberOfLabels
User-changeable settings.
static vtkActor2D * New()
double AnnotationLeaderPadding
User-changeable settings.
handles properties associated with a texture map
Definition: vtkTexture.h:69
int Orientation
User-changeable settings.
int TextPosition
User-changeable settings.
vtkPolyData * ScalarBar
Polygon(s) colored by LookupTable.
vtkProperty2D * BackgroundProperty
User-changeable settings.
vtkActor2D * ScalarBarActor
Actor for ScalarBar.
represent text properties.
vtkPolyData * Background
Polygon used to fill the background.
vtkTextProperty * LabelTextProperty
Font for tick+annotation labels.
vtkTimeStamp BuildTime
Internal state used for rendering.
vtkTextProperty * TitleTextProperty
Font for the legend title.
int MaximumNumberOfColors
User-changeable settings.
char * NanAnnotation
User-changeable settings.
virtual void ShallowCopy(vtkProp *prop)
double BarRatio
User-changeable settings.
vtkTextActor * TitleActor
The legend title text renderer.
vtkPolyDataMapper2D * FrameMapper
Mapper for Frame.
virtual int RenderOverlay(vtkViewport *viewport)
represent surface properties of a 2D image
Definition: vtkProperty2D.h:39
virtual void SetTextPositionToSucceedScalarBar()
int DrawBackground
User-changeable settings.
vtkProperty2D * FrameProperty
User-changeable settings.
int DrawAnnotations
User-changeable settings.
vtkPolyData * Frame
Polyline used to highlight frame.
draw vtkPolyData onto the image plane
vtkPolyData * TexturePolyData
Polygon colored when UseOpacity is true.
vtkTexturedActor2D * TextureActor
Actor for TexturePolyData.