VTK  9.1.0
vtkChartLegend.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkChartLegend.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=========================================================================*/
15
26#ifndef vtkChartLegend_h
27#define vtkChartLegend_h
28
29#include "vtkChartsCoreModule.h" // For export macro
30#include "vtkContextItem.h"
31#include "vtkNew.h" // For vtkNew
32#include "vtkRect.h" // For vtkRectf return value
33
34class vtkChart;
35class vtkPen;
36class vtkBrush;
37class vtkTextProperty;
38
39class VTKCHARTSCORE_EXPORT vtkChartLegend : public vtkContextItem
40{
41public:
43 void PrintSelf(ostream& os, vtkIndent indent) override;
44
49
51
54 vtkSetVector2Macro(Point, float);
56
58
61 vtkGetVector2Macro(Point, float);
63
64 enum
65 {
66 LEFT = 0,
71 CUSTOM
72 };
73
78
83
85
89 vtkSetMacro(HorizontalAlignment, int);
91
93
96 vtkGetMacro(HorizontalAlignment, int);
98
100
104 vtkSetMacro(VerticalAlignment, int);
106
108
111 vtkGetMacro(VerticalAlignment, int);
113
115
118 vtkSetMacro(Padding, int);
120
122
125 vtkGetMacro(Padding, int);
127
129
132 vtkSetMacro(SymbolWidth, int);
134
136
139 vtkGetMacro(SymbolWidth, int);
141
145 virtual void SetLabelSize(int size);
146
150 virtual int GetLabelSize();
151
153
158 vtkSetMacro(Inline, bool);
159 vtkGetMacro(Inline, bool);
161
163
169 vtkSetMacro(DragEnabled, bool);
170 vtkGetMacro(DragEnabled, bool);
172
176 void SetChart(vtkChart* chart);
177
182
187 void Update() override;
188
192 bool Paint(vtkContext2D* painter) override;
193
201
206
211
216
218
226 vtkSetMacro(CacheBounds, bool);
227 vtkGetMacro(CacheBounds, bool);
228 vtkBooleanMacro(CacheBounds, bool);
230
234 bool Hit(const vtkContextMouseEvent& mouse) override;
235
239 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
240
244 bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
245
250
251protected:
253 ~vtkChartLegend() override;
254
255 float* Point; // The point the legend is anchored to.
256 int HorizontalAlignment; // Alignment of the legend to the point it is anchored to.
257 int VerticalAlignment; // Alignment of the legend to the point it is anchored to.
258
263
268
273
278
284
289
292
294
299
304
308 bool Inline;
309
310 // Private storage class
311 class Private;
312 Private* Storage;
313
314private:
315 vtkChartLegend(const vtkChartLegend&) = delete;
316 void operator=(const vtkChartLegend&) = delete;
317};
318
319#endif // vtkChartLegend_h
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:38
draw the chart legend
vtkBrush * GetBrush()
Get the brush used to draw the legend background.
Private * Storage
const vtkVector2f & GetPointVector()
Get point the legend box is anchored to.
bool DragEnabled
Should we move the legend box around in response to the mouse drag?
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse button down event.
int SymbolWidth
Width of the symbols in pixels in the legend.
int Button
Last button to be pressed.
vtkNew< vtkBrush > Brush
The brush used to render the background of the legend.
~vtkChartLegend() override
bool CacheBounds
Should the legend attempt to avoid recalculating its position & bounds unnecessarily?
bool Inline
Should the legend be drawn inline in its chart?
bool Paint(vtkContext2D *painter) override
Paint event for the axis, called whenever the axis needs to be drawn.
vtkNew< vtkTextProperty > LabelProperties
The text properties of the labels used in the legend.
int Padding
Padding between symbol and text.
bool Hit(const vtkContextMouseEvent &mouse) override
Return true if the supplied x, y coordinate is inside the item.
vtkNew< vtkPen > Pen
The pen used to draw the legend box.
vtkTimeStamp PlotTime
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override
Mouse button release event.
vtkTimeStamp RectTime
void SetChart(vtkChart *chart)
Set the chart that the legend belongs to and will draw the legend for.
vtkPen * GetPen()
Get the pen used to draw the legend outline.
virtual int GetLabelSize()
Get the point size of the label text.
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
virtual vtkRectf GetBoundingRect(vtkContext2D *painter)
Request the space the legend requires to be drawn.
void Update() override
Update the geometry of the axis.
static vtkChartLegend * New()
Creates a 2D Chart object.
vtkTextProperty * GetLabelProperties()
Get the vtkTextProperty for the legend's labels.
vtkChart * GetChart()
Get the chart that the legend belongs to and will draw the legend for.
virtual void SetLabelSize(int size)
Set the point size of the label text.
void SetPoint(const vtkVector2f &point)
Set point the legend box is anchored to.
Factory class for drawing 2D charts.
Definition: vtkChart.h:45
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:54
base class for items that are part of a vtkContextScene.
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:34
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:37
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:33
@ Inline
Definition: vtkX3D.h:119
@ point
Definition: vtkX3D.h:242
@ size
Definition: vtkX3D.h:259