VTK  9.2.6
vtkColorLegend.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkColorLegend.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
23
24#ifndef vtkColorLegend_h
25#define vtkColorLegend_h
26
27#include "vtkChartLegend.h"
28#include "vtkChartsCoreModule.h" // For export macro
29#include "vtkSmartPointer.h" // For SP ivars
30#include "vtkVector.h" // For vtkRectf
31
32class vtkAxis;
34class vtkImageData;
37
38class VTKCHARTSCORE_EXPORT vtkColorLegend : public vtkChartLegend
39{
40public:
42 void PrintSelf(ostream& os, vtkIndent indent) override;
44
48 enum
49 {
52 };
53
58 virtual void GetBounds(double bounds[4]);
59
65 void Update() override;
66
72 bool Paint(vtkContext2D* painter) override;
73
75
79 virtual void SetTransferFunction(vtkScalarsToColors* transfer);
82
86 void SetPoint(float x, float y) override;
87
91 virtual void SetTextureSize(float w, float h);
92
99 virtual void SetPosition(const vtkRectf& pos);
100
106
114
116
120 virtual void SetOrientation(int orientation);
121 vtkGetMacro(Orientation, int);
123
125
128 virtual void SetTitle(const vtkStdString& title);
131
133
137 vtkSetMacro(DrawBorder, bool);
138 vtkGetMacro(DrawBorder, bool);
139 vtkBooleanMacro(DrawBorder, bool);
141
145 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
146
147protected:
149 ~vtkColorLegend() override;
150
155 virtual void ComputeTexture();
156
158
162 virtual void ScalarsToColorsModified(vtkObject* caller, unsigned long eid, void* calldata);
164 vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
166
171
181
182private:
183 vtkColorLegend(const vtkColorLegend&) = delete;
184 void operator=(const vtkColorLegend&) = delete;
185};
186
187#endif
takes care of drawing 2D axes
Definition vtkAxis.h:69
supports function callbacks
vtkRectf GetBoundingRect(vtkContext2D *painter) override
Request the space the legend requires to be drawn.
virtual void SetOrientation(int orientation)
Set/get the orientation of the legend.
virtual void GetBounds(double bounds[4])
Bounds of the item, by default (0, 1, 0, 1) but it mainly depends on the range of the vtkScalarsToCol...
virtual vtkRectf GetPosition()
Returns the origin, width, and height of the scalar bar drawn by this legend.
void SetPoint(float x, float y) override
Set the point this legend is anchored to.
static vtkColorLegend * New()
void UpdateAxisPosition()
Moves the axis whenever the position of this legend changes.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSmartPointer< vtkCallbackCommand > Callback
vtkSmartPointer< vtkImageData > ImageData
virtual void ComputeTexture()
Need to be reimplemented by subclasses, ComputeTexture() is called at paint time if the texture is no...
virtual vtkScalarsToColors * GetTransferFunction()
Set/Get the transfer function that is used to draw the scalar bar within this legend.
virtual void SetTextureSize(float w, float h)
Set the size of the scalar bar drawn by this legend.
static void OnScalarsToColorsModified(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
Called whenever the ScalarsToColors function(s) is modified.
virtual void SetPosition(const vtkRectf &pos)
Set the origin, width, and height of the scalar bar drawn by this legend.
virtual vtkStdString GetTitle()
Get/set the title text of the legend.
~vtkColorLegend() override
void Update() override
Perform any updates to the item that may be necessary before rendering.
vtkSmartPointer< vtkAxis > Axis
virtual void ScalarsToColorsModified(vtkObject *caller, unsigned long eid, void *calldata)
Called whenever the ScalarsToColors function(s) is modified.
vtkScalarsToColors * TransferFunction
virtual void SetTitle(const vtkStdString &title)
Get/set the title text of the legend.
bool Paint(vtkContext2D *painter) override
Paint the texture into a rectangle defined by the bounds.
virtual void SetTransferFunction(vtkScalarsToColors *transfer)
Set/Get the transfer function that is used to draw the scalar bar within this legend.
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
Class for drawing 2D primitives to a graphical context.
data structure to represent mouse events.
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:34
abstract base class for most VTK objects
Definition vtkObject.h:57
Superclass for mapping scalar values to colors.
Computes the portion of a dataset which is inside a selection.
Hold a reference to a vtkObjectBase instance.
Wrapper around std::string to keep symbols short.