VTK  9.1.0
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
33#ifndef vtkColorLegend_h
34#define vtkColorLegend_h
35
36#include "vtkChartLegend.h"
37#include "vtkChartsCoreModule.h" // For export macro
38#include "vtkSmartPointer.h" // For SP ivars
39#include "vtkVector.h" // For vtkRectf
40
41class vtkAxis;
43class vtkImageData;
46
47class VTKCHARTSCORE_EXPORT vtkColorLegend : public vtkChartLegend
48{
49public:
51 void PrintSelf(ostream& os, vtkIndent indent) override;
53
57 enum
58 {
59 VERTICAL = 0,
60 HORIZONTAL
61 };
62
67 virtual void GetBounds(double bounds[4]);
68
74 void Update() override;
75
81 bool Paint(vtkContext2D* painter) override;
82
84
88 virtual void SetTransferFunction(vtkScalarsToColors* transfer);
91
95 void SetPoint(float x, float y) override;
96
100 virtual void SetTextureSize(float w, float h);
101
108 virtual void SetPosition(const vtkRectf& pos);
109
115
123
125
129 virtual void SetOrientation(int orientation);
130 vtkGetMacro(Orientation, int);
132
134
137 virtual void SetTitle(const vtkStdString& title);
140
142
146 vtkSetMacro(DrawBorder, bool);
147 vtkGetMacro(DrawBorder, bool);
148 vtkBooleanMacro(DrawBorder, bool);
150
154 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
155
156protected:
158 ~vtkColorLegend() override;
159
164 virtual void ComputeTexture();
165
167
171 virtual void ScalarsToColorsModified(vtkObject* caller, unsigned long eid, void* calldata);
173 vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
175
180
190
191private:
192 vtkColorLegend(const vtkColorLegend&) = delete;
193 void operator=(const vtkColorLegend&) = delete;
194};
195
196#endif
takes care of drawing 2D axes
Definition: vtkAxis.h:78
supports function callbacks
draw the chart legend
Legend item to display vtkScalarsToColors.
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.
Definition: vtkContext2D.h:63
data structure to represent mouse events.
vtkFrustumSelector is a vtkSelector that selects elements based on whether they are inside or interse...
topologically and geometrically regular array of data
Definition: vtkImageData.h:57
a simple class to control print indentation
Definition: vtkIndent.h:43
abstract base class for most VTK objects
Definition: vtkObject.h:63
Superclass for mapping scalar values to colors.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:45
@ orientation
Definition: vtkX3D.h:268
@ title
Definition: vtkX3D.h:506