VTK
vtkLegendScaleActor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLegendScaleActor.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 =========================================================================*/
37 #ifndef vtkLegendScaleActor_h
38 #define vtkLegendScaleActor_h
39 
40 #include "vtkRenderingAnnotationModule.h" // For export macro
41 #include "vtkProp.h"
42 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
43 
44 class vtkAxisActor2D;
45 class vtkTextProperty;
46 class vtkPolyData;
48 class vtkActor2D;
49 class vtkTextMapper;
50 class vtkPoints;
51 class vtkCoordinate;
52 
53 class VTKRENDERINGANNOTATION_EXPORT vtkLegendScaleActor : public vtkProp
54 {
55 public:
59  static vtkLegendScaleActor *New();
60 
62 
66  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
68 
70  {
71  DISTANCE=0,
72  XY_COORDINATES=1
73  };
74 
76 
82  vtkSetClampMacro(LabelMode,int,DISTANCE,XY_COORDINATES);
83  vtkGetMacro(LabelMode,int);
84  void SetLabelModeToDistance() {this->SetLabelMode(DISTANCE);}
85  void SetLabelModeToXYCoordinates() {this->SetLabelMode(XY_COORDINATES);}
87 
89 
93  vtkSetMacro(RightAxisVisibility,int);
94  vtkGetMacro(RightAxisVisibility,int);
95  vtkBooleanMacro(RightAxisVisibility,int);
96  vtkSetMacro(TopAxisVisibility,int);
97  vtkGetMacro(TopAxisVisibility,int);
98  vtkBooleanMacro(TopAxisVisibility,int);
99  vtkSetMacro(LeftAxisVisibility,int);
100  vtkGetMacro(LeftAxisVisibility,int);
101  vtkBooleanMacro(LeftAxisVisibility,int);
102  vtkSetMacro(BottomAxisVisibility,int);
103  vtkGetMacro(BottomAxisVisibility,int);
104  vtkBooleanMacro(BottomAxisVisibility,int);
106 
108 
112  vtkSetMacro(LegendVisibility,int);
113  vtkGetMacro(LegendVisibility,int);
114  vtkBooleanMacro(LegendVisibility,int);
116 
118 
121  void AllAxesOn();
122  void AllAxesOff();
124 
126 
129  void AllAnnotationsOn();
130  void AllAnnotationsOff();
132 
134 
139  vtkSetClampMacro(RightBorderOffset,int,5,VTK_INT_MAX);
140  vtkGetMacro(RightBorderOffset,int);
142 
144 
149  vtkSetClampMacro(TopBorderOffset,int,5,VTK_INT_MAX);
150  vtkGetMacro(TopBorderOffset,int);
152 
154 
159  vtkSetClampMacro(LeftBorderOffset,int,5,VTK_INT_MAX);
160  vtkGetMacro(LeftBorderOffset,int);
162 
164 
169  vtkSetClampMacro(BottomBorderOffset,int,5,VTK_INT_MAX);
170  vtkGetMacro(BottomBorderOffset,int);
172 
174 
178  vtkSetClampMacro(CornerOffsetFactor, double, 1.0, 10.0);
179  vtkGetMacro(CornerOffsetFactor, double);
181 
183 
186  vtkGetObjectMacro(LegendTitleProperty,vtkTextProperty);
187  vtkGetObjectMacro(LegendLabelProperty,vtkTextProperty);
189 
191 
196  vtkGetObjectMacro(RightAxis,vtkAxisActor2D);
197  vtkGetObjectMacro(TopAxis,vtkAxisActor2D);
198  vtkGetObjectMacro(LeftAxis,vtkAxisActor2D);
199  vtkGetObjectMacro(BottomAxis,vtkAxisActor2D);
201 
203 
206  virtual void BuildRepresentation(vtkViewport *viewport);
207  void GetActors2D(vtkPropCollection*) VTK_OVERRIDE;
208  void ReleaseGraphicsResources(vtkWindow*) VTK_OVERRIDE;
209  int RenderOverlay(vtkViewport*) VTK_OVERRIDE;
210  int RenderOpaqueGeometry(vtkViewport*) VTK_OVERRIDE;
212 
213 protected:
215  ~vtkLegendScaleActor() VTK_OVERRIDE;
216 
217  int LabelMode;
218  int RightBorderOffset;
219  int TopBorderOffset;
220  int LeftBorderOffset;
221  int BottomBorderOffset;
222  double CornerOffsetFactor;
223 
224  // The four axes around the borders of the renderer
225  vtkAxisActor2D *RightAxis;
226  vtkAxisActor2D *TopAxis;
227  vtkAxisActor2D *LeftAxis;
228  vtkAxisActor2D *BottomAxis;
229 
230  // Control the display of the axes
231  int RightAxisVisibility;
232  int TopAxisVisibility;
233  int LeftAxisVisibility;
234  int BottomAxisVisibility;
235 
236  // Support for the legend.
237  int LegendVisibility;
238  vtkPolyData *Legend;
239  vtkPoints *LegendPoints;
240  vtkPolyDataMapper2D *LegendMapper;
241  vtkActor2D *LegendActor;
242  vtkTextMapper *LabelMappers[6];
243  vtkActor2D *LabelActors[6];
244  vtkTextProperty *LegendTitleProperty;
245  vtkTextProperty *LegendLabelProperty;
247 
249 
250 private:
251  vtkLegendScaleActor(const vtkLegendScaleActor&) VTK_DELETE_FUNCTION;
252  void operator=(const vtkLegendScaleActor&) VTK_DELETE_FUNCTION;
253 };
254 
255 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
vtkTimeStamp BuildTime
abstract specification for Viewports
Definition: vtkViewport.h:44
#define VTK_INT_MAX
Definition: vtkType.h:157
a actor that draws 2D data
Definition: vtkActor2D.h:39
record modification and/or execution time
Definition: vtkTimeStamp.h:32
Create an axis with tick marks and labels.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
2D text annotation
Definition: vtkTextMapper.h:47
annotate the render window with scale and distance information
an ordered list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:33
void SetLabelModeToXYCoordinates()
Specify the mode for labeling the scale axes.
represent text properties.
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems ...
Definition: vtkCoordinate.h:72
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void SetLabelModeToDistance()
Specify the mode for labeling the scale axes.
virtual void GetActors2D(vtkPropCollection *)
Definition: vtkProp.h:56
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:33