VTK  9.2.6
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
58#ifndef vtkChartLegend_h
59#define vtkChartLegend_h
60
61#include "vtkChartsCoreModule.h" // For export macro
62#include "vtkContextItem.h"
63#include "vtkNew.h" // For vtkNew
64#include "vtkRect.h" // For vtkRectf return value
65
66class vtkChart;
67class vtkPen;
68class vtkBrush;
69class vtkTextProperty;
70
71class VTKCHARTSCORE_EXPORT vtkChartLegend : public vtkContextItem
72{
73public:
75 void PrintSelf(ostream& os, vtkIndent indent) override;
76
81
83
86 vtkSetVector2Macro(Point, float);
88
90
93 vtkGetVector2Macro(Point, float);
95
96 enum
97 {
98 LEFT = 0,
103 CUSTOM
104 };
105
110
115
117
121 vtkSetMacro(HorizontalAlignment, int);
123
125
128 vtkGetMacro(HorizontalAlignment, int);
130
132
136 vtkSetMacro(VerticalAlignment, int);
138
140
143 vtkGetMacro(VerticalAlignment, int);
145
147
150 vtkSetMacro(Padding, int);
152
154
157 vtkGetMacro(Padding, int);
159
161
164 vtkSetMacro(SymbolWidth, int);
166
168
171 vtkGetMacro(SymbolWidth, int);
173
177 virtual void SetLabelSize(int size);
178
182 virtual int GetLabelSize();
183
185
190 vtkSetMacro(Inline, bool);
191 vtkGetMacro(Inline, bool);
193
195
201 vtkSetMacro(DragEnabled, bool);
202 vtkGetMacro(DragEnabled, bool);
204
208 void SetChart(vtkChart* chart);
209
214
219 void Update() override;
220
224 bool Paint(vtkContext2D* painter) override;
225
233
238
243
248
250
258 vtkSetMacro(CacheBounds, bool);
259 vtkGetMacro(CacheBounds, bool);
260 vtkBooleanMacro(CacheBounds, bool);
262
266 bool Hit(const vtkContextMouseEvent& mouse) override;
267
271 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
272
276 bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
277
282
283protected:
285 ~vtkChartLegend() override;
286
287 float* Point; // The point the legend is anchored to.
288 int HorizontalAlignment; // Alignment of the legend to the point it is anchored to.
289 int VerticalAlignment; // Alignment of the legend to the point it is anchored to.
290
295
300
305
310
316
321
324
326
331
336
340 bool Inline;
341
342 // Private storage class
343 class Private;
344 Private* Storage;
345
346private:
347 vtkChartLegend(const vtkChartLegend&) = delete;
348 void operator=(const vtkChartLegend&) = delete;
349};
350
351#endif // vtkChartLegend_h
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:100
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:52
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:77
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:119
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:139
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:55
@ Inline
Definition: vtkX3D.h:119
@ point
Definition: vtkX3D.h:242
@ size
Definition: vtkX3D.h:259