VTK
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 
24 #ifndef vtkColorLegend_h
25 #define vtkColorLegend_h
26 
27 #include "vtkChartsCoreModule.h" // For export macro
28 #include "vtkChartLegend.h"
29 #include "vtkSmartPointer.h" // For SP ivars
30 #include "vtkVector.h" // For vtkRectf
31 
32 class vtkAxis;
34 class vtkImageData;
35 class vtkScalarsToColors;
36 class vtkCallbackCommand;
37 
38 class VTKCHARTSCORE_EXPORT vtkColorLegend: public vtkChartLegend
39 {
40 public:
42  virtual void PrintSelf(ostream &os, vtkIndent indent);
43  static vtkColorLegend* New();
44 
48  enum {
49  VERTICAL = 0,
50  HORIZONTAL
51  };
52 
57  virtual void GetBounds(double bounds[4]);
58 
64  virtual void Update();
65 
71  virtual bool Paint(vtkContext2D *painter);
72 
74 
78  virtual void SetTransferFunction(vtkScalarsToColors* transfer);
81 
85  virtual void SetPoint(float x, float y);
86 
90  virtual void SetTextureSize(float w, float h);
91 
98  virtual void SetPosition(const vtkRectf& pos);
99 
105 
113 
115 
119  virtual void SetOrientation(int orientation);
120  vtkGetMacro(Orientation, int);
122 
124 
127  virtual void SetTitle(const vtkStdString &title);
130 
132 
136  vtkSetMacro(DrawBorder, bool);
137  vtkGetMacro(DrawBorder, bool);
138  vtkBooleanMacro(DrawBorder, bool);
140 
144  virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
145 
146 protected:
148  virtual ~vtkColorLegend();
149 
154  virtual void ComputeTexture();
155 
157 
161  virtual void ScalarsToColorsModified(vtkObject* caller, unsigned long eid,
162  void* calldata);
163  static void OnScalarsToColorsModified(vtkObject* caller, unsigned long eid,
164  void *clientdata, void* calldata);
166 
171 
181 
182 private:
183  vtkColorLegend(const vtkColorLegend &) VTK_DELETE_FUNCTION;
184  void operator=(const vtkColorLegend &) VTK_DELETE_FUNCTION;
185 };
186 
187 #endif
vtkColorLegend::GetTransferFunction
virtual vtkScalarsToColors * GetTransferFunction()
vtkContextMouseEvent
data structure to represent mouse events.
Definition: vtkContextMouseEvent.h:41
vtkColorLegend::MouseMoveEvent
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
vtkColorLegend::ComputeTexture
virtual void ComputeTexture()
Need to be reimplemented by subclasses, ComputeTexture() is called at paint time if the texture is no...
vtkColorLegend::SetPoint
virtual void SetPoint(float x, float y)
Set the point this legend is anchored to.
vtkColorLegend::Orientation
int Orientation
Definition: vtkColorLegend.h:180
vtkChartLegend
draw the chart legend
Definition: vtkChartLegend.h:43
vtkColorLegend::GetPosition
virtual vtkRectf GetPosition()
Returns the origin, width, and height of the scalar bar drawn by this legend.
vtkSmartPointer< vtkImageData >
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkVector.h
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
vtkColorLegend::GetBounds
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...
vtkColorLegend::Callback
vtkSmartPointer< vtkCallbackCommand > Callback
Definition: vtkColorLegend.h:175
vtkColorLegend::TransferFunction
vtkScalarsToColors * TransferFunction
Definition: vtkColorLegend.h:172
vtkColorLegend::GetTitle
virtual vtkStdString GetTitle()
vtkX3D::title
@ title
Definition: vtkX3D.h:500
vtkColorLegend::PrintSelf
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkColorLegend::ImageData
vtkSmartPointer< vtkImageData > ImageData
Definition: vtkColorLegend.h:173
vtkColorLegend::SetTitle
virtual void SetTitle(const vtkStdString &title)
Get/set the title text of the legend.
vtkColorLegend::Update
virtual void Update()
Perform any updates to the item that may be necessary before rendering.
vtkColorLegend::Paint
virtual bool Paint(vtkContext2D *painter)
Paint the texture into a rectangle defined by the bounds.
vtkColorLegend::OnScalarsToColorsModified
static void OnScalarsToColorsModified(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkSmartPointer.h
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:67
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkColorLegend::UpdateAxisPosition
void UpdateAxisPosition()
Moves the axis whenever the position of this legend changes.
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkColorLegend::~vtkColorLegend
virtual ~vtkColorLegend()
vtkColorLegend::vtkColorLegend
vtkColorLegend()
vtkColorLegend
Legend item to display vtkScalarsToColors.
Definition: vtkColorLegend.h:39
vtkX3D::orientation
@ orientation
Definition: vtkX3D.h:262
vtkAxis
takes care of drawing 2D axes
Definition: vtkAxis.h:72
vtkChartLegend.h
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:51
vtkColorLegend::DrawBorder
bool DrawBorder
Definition: vtkColorLegend.h:178
vtkColorLegend::ScalarsToColorsModified
virtual void ScalarsToColorsModified(vtkObject *caller, unsigned long eid, void *calldata)
Called whenever the ScalarsToColors function(s) is modified.
vtkColorLegend::New
static vtkColorLegend * New()
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:49
vtkColorLegend::Axis
vtkSmartPointer< vtkAxis > Axis
Definition: vtkColorLegend.h:174
vtkColorLegend::SetTransferFunction
virtual void SetTransferFunction(vtkScalarsToColors *transfer)
Set/Get the transfer function that is used to draw the scalar bar within this legend.
vtkColorLegend::SetPosition
virtual void SetPosition(const vtkRectf &pos)
Set the origin, width, and height of the scalar bar drawn by this legend.
vtkRectf
Definition: vtkRect.h:297
vtkColorLegend::SetTextureSize
virtual void SetTextureSize(float w, float h)
Set the size of the scalar bar drawn by this legend.
vtkColorLegend::GetBoundingRect
vtkRectf GetBoundingRect(vtkContext2D *painter)
Request the space the legend requires to be drawn.
vtkColorLegend::SetOrientation
virtual void SetOrientation(int orientation)
Set/get the orientation of the legend.
vtkColorLegend::Position
vtkRectf Position
Definition: vtkColorLegend.h:179
vtkColorLegend::CustomPositionSet
bool CustomPositionSet
Definition: vtkColorLegend.h:177
vtkColorLegend::Interpolate
bool Interpolate
Definition: vtkColorLegend.h:176