VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
75 #define VTK_ORIENT_HORIZONTAL 0
76 #define VTK_ORIENT_VERTICAL 1
77 
79 {
80 public:
82  void PrintSelf(ostream& os, vtkIndent indent);
83 
87  static vtkScalarBarActor* New();
88 
90 
91  int RenderOpaqueGeometry(vtkViewport* viewport);
92  virtual int RenderTranslucentPolygonalGeometry(vtkViewport*) { return 0; };
93  int RenderOverlay(vtkViewport* viewport);
95 
97  virtual int HasTranslucentPolygonalGeometry();
98 
102  virtual void ReleaseGraphicsResources(vtkWindow*);
103 
107  virtual void GetScalarBarRect(int rect[4], vtkViewport* viewport);
108 
110 
114  virtual void SetLookupTable(vtkScalarsToColors*);
117 
119 
124  vtkSetMacro( UseOpacity, int );
125  vtkGetMacro( UseOpacity, int );
126  vtkBooleanMacro( UseOpacity, int );
128 
130 
133  vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_INT_MAX);
134  vtkGetMacro(MaximumNumberOfColors, int);
136 
138 
139  vtkSetClampMacro(NumberOfLabels, int, 0, 64);
140  vtkGetMacro(NumberOfLabels, int);
142 
144 
146  vtkGetMacro(Orientation, int);
148  {this->SetOrientation(VTK_ORIENT_HORIZONTAL);}
149  void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);}
151 
153 
154  virtual void SetTitleTextProperty(vtkTextProperty* p);
155  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
157 
159 
160  virtual void SetLabelTextProperty(vtkTextProperty* p);
161  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
163 
165 
166  vtkSetStringMacro(LabelFormat);
167  vtkGetStringMacro(LabelFormat);
169 
171 
172  vtkSetStringMacro(Title);
173  vtkGetStringMacro(Title);
175 
177 
178  vtkSetStringMacro(ComponentTitle);
179  vtkGetStringMacro(ComponentTitle);
181 
184  void ShallowCopy(vtkProp* prop);
185 
187 
188  vtkSetMacro( TextureGridWidth, double );
189  vtkGetMacro( TextureGridWidth, double );
191 
193 
194  vtkGetObjectMacro( TextureActor, vtkActor2D );
196 
197 //BTX
198  enum { PrecedeScalarBar = 0, SucceedScalarBar };
199 //ETX
200 
202 
208  vtkSetClampMacro( TextPosition, int, PrecedeScalarBar, SucceedScalarBar);
209  vtkGetMacro( TextPosition, int );
211  { this->SetTextPosition( vtkScalarBarActor::PrecedeScalarBar ); }
213  { this->SetTextPosition( vtkScalarBarActor::SucceedScalarBar ); }
215 
217 
222  vtkSetMacro( MaximumWidthInPixels, int );
223  vtkGetMacro( MaximumWidthInPixels, int );
224  vtkSetMacro( MaximumHeightInPixels, int );
225  vtkGetMacro( MaximumHeightInPixels, int );
227 
229 
231  vtkSetMacro(AnnotationLeaderPadding, double);
232  vtkGetMacro(AnnotationLeaderPadding, double);
234 
236 
239  vtkSetMacro(DrawAnnotations, int);
240  vtkGetMacro(DrawAnnotations, int);
241  vtkBooleanMacro(DrawAnnotations, int);
243 
245 
248  vtkSetMacro(DrawNanAnnotation, int);
249  vtkGetMacro(DrawNanAnnotation, int);
250  vtkBooleanMacro(DrawNanAnnotation, int);
252 
254 
259  vtkSetMacro(FixedAnnotationLeaderLineColor, int);
260  vtkGetMacro(FixedAnnotationLeaderLineColor, int);
261  vtkBooleanMacro(FixedAnnotationLeaderLineColor, int);
263 
265 
266  vtkSetStringMacro(NanAnnotation);
267  vtkGetStringMacro(NanAnnotation);
269 
271 
276  vtkSetMacro(AnnotationTextScaling,int);
277  vtkGetMacro(AnnotationTextScaling,int);
279 
281 
283  vtkSetMacro(DrawBackground, int);
284  vtkGetMacro(DrawBackground, int);
285  vtkBooleanMacro(DrawBackground, int);
287 
289 
291  vtkSetMacro(DrawFrame, int);
292  vtkGetMacro(DrawFrame, int);
293  vtkBooleanMacro(DrawFrame, int);
295 
297 
299  vtkSetMacro(DrawColorBar, int);
300  vtkGetMacro(DrawColorBar, int);
301  vtkBooleanMacro(DrawColorBar, int);
303 
305 
306  vtkSetMacro(DrawTickLabels, int);
307  vtkGetMacro(DrawTickLabels, int);
308  vtkBooleanMacro(DrawTickLabels, int);
310 
312 
313  virtual void SetBackgroundProperty(vtkProperty2D* p);
314  vtkGetObjectMacro(BackgroundProperty,vtkProperty2D);
316 
318 
319  virtual void SetFrameProperty(vtkProperty2D* p);
320  vtkGetObjectMacro(FrameProperty,vtkProperty2D);
322 
324 
326  vtkGetMacro(TextPad,int);
327  vtkSetMacro(TextPad,int);
329 
331 
333  vtkGetMacro(VerticalTitleSeparation,int);
334  vtkSetMacro(VerticalTitleSeparation,int);
336 
338 
340  vtkGetMacro(BarRatio,double);
341  vtkSetClampMacro(BarRatio,double,0.,1.);
343 
345 
349  vtkGetMacro(TitleRatio,double);
350  vtkSetClampMacro(TitleRatio,double,0.,1.);
352 
353 protected:
356 
373  virtual void RebuildLayout(vtkViewport* viewport);
374 
376  virtual void FreeLayoutStorage();
377 
383  virtual void ComputeFrame();
384 
390  virtual void ComputeScalarBarThickness();
391 
395  virtual void LayoutNanSwatch();
396 
398  virtual void PrepareTitleText();
399 
406  virtual void LayoutTitle();
407 
413  virtual void ComputeScalarBarLength();
414 
420  virtual void LayoutTicks();
421 
425  virtual void LayoutAnnotations();
426 
428  virtual void ConfigureAnnotations();
429 
432  virtual void ConfigureFrame();
433 
435  virtual void DrawBoxes();
436 
439  virtual void ConfigureScalarBar();
440 
442  virtual void ConfigureTitle();
443 
445  virtual void ConfigureTicks();
446 
450  virtual void ConfigureNanSwatch();
451 
459  virtual void EditAnnotations() { }
460 
463  virtual void SizeTitle(double* titleSize, int* size, vtkViewport* viewport);
464 
466 
468  int MapAnnotationLabels(
469  vtkScalarsToColors* lkup, double start, double delta, double* range);
471 
473 
475  int PlaceAnnotationsVertically(
476  double barX, double barY, double barWidth, double barHeight,
477  double delta, double pad);
479 
480 
482  int PlaceAnnotationsHorizontally(
483  double barX, double barY, double barWidth, double barHeight,
484  double delta, double pad);
486 
488 
493  int DrawBackground; // off by default
494  int DrawFrame; // off by default
495  int DrawColorBar; // on by default
496  int DrawTickLabels; // on by default
499  int AnnotationTextScaling; // off by default
503  char* Title;
505  char* LabelFormat;
506  int UseOpacity; // off by default
513  int TextPad;
515  double BarRatio;
516  double TitleRatio;
518 
520 
522  int LastSize[2];
523  int LastOrigin[2];
524 
526 
528 
532 
539 
543 
547 
548 
549 private:
550  vtkScalarBarActor(const vtkScalarBarActor&); // Not implemented.
551  void operator=(const vtkScalarBarActor&); // Not implemented.
552 };
553 
554 
555 #endif
556 
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:47
int TextPad
User-changeable settings.
int DrawNanAnnotation
User-changeable settings.
int MaximumWidthInPixels
User-changeable settings.
GLsizeiptr size
Definition: vtkgl.h:11843
int DrawTickLabels
User-changeable settings.
virtual void EditAnnotations()
double TitleRatio
User-changeable settings.
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:131
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
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.
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:133
int AnnotationTextScaling
User-changeable settings.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
double TextureGridWidth
User-changeable settings.
#define vtkSetStringMacro(name)
Definition: vtkSetGet.h:94
vtkTexture * Texture
Color data for TexturePolyData.
int FixedAnnotationLeaderLineColor
User-changeable settings.
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
2D text annotation
Definition: vtkTextMapper.h:59
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:33
vtkActor2D * BackgroundActor
Actor for Background.
An actor that displays text. Scaled or unscaled.
Definition: vtkTextActor.h:55
#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.
GLuint start
Definition: vtkgl.h:11315
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
vtkActor2D * TextureActor
Actor for TexturePolyData.
int Orientation
User-changeable settings.
int TextPosition
User-changeable settings.
vtkPolyData * ScalarBar
Polygon(s) colored by LookupTable.
#define vtkGetStringMacro(name)
Definition: vtkSetGet.h:120
vtkProperty2D * BackgroundProperty
User-changeable settings.
vtkActor2D * ScalarBarActor
Actor for ScalarBar.
represent text properties.
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
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)
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
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.
GLenum GLint * range
Definition: vtkgl.h:14180
vtkPolyData * Frame
Polyline used to highlight frame.
draw vtkPolyData onto the image plane
vtkPolyData * TexturePolyData
Polygon colored when UseOpacity is true.
GLfloat GLfloat p
Definition: vtkgl.h:15717
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69