VTK
vtkPlotBar.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPlotBar.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 
28 #ifndef vtkPlotBar_h
29 #define vtkPlotBar_h
30 
31 #include "vtkChartsCoreModule.h" // For export macro
32 #include "vtkPlot.h"
33 #include "vtkSmartPointer.h" // Needed to hold ColorSeries
34 
35 class vtkContext2D;
36 class vtkTable;
37 class vtkPoints2D;
38 class vtkStdString;
39 class vtkColorSeries;
41 class vtkScalarsToColors;
42 
43 class vtkPlotBarPrivate;
44 
45 class VTKCHARTSCORE_EXPORT vtkPlotBar : public vtkPlot
46 {
47 public:
48  vtkTypeMacro(vtkPlotBar, vtkPlot);
49  virtual void PrintSelf(ostream &os, vtkIndent indent);
50 
54  enum {
55  VERTICAL = 0,
56  HORIZONTAL
57  };
58 
62  static vtkPlotBar *New();
63 
67  virtual void Update();
68 
72  virtual bool Paint(vtkContext2D *painter);
73 
80  virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
81  int legendIndex);
82 
84 
87  virtual void SetColor(unsigned char r, unsigned char g, unsigned char b,
88  unsigned char a);
89  virtual void SetColor(double r, double g, double b);
90  virtual void GetColor(double rgb[3]);
92 
94 
97  vtkSetMacro(Width, float);
99 
101 
104  vtkGetMacro(Width, float);
106 
108 
114  vtkSetMacro(Offset, float);
115  vtkGetMacro(Offset, float);
117 
119 
123  virtual void SetOrientation(int orientation);
124  vtkGetMacro(Orientation, int);
126 
130  virtual void GetBounds(double bounds[4], bool unscaled);
131 
135  virtual void GetBounds(double bounds[4]);
136 
140  virtual void GetUnscaledInputBounds(double bounds[4]);
141 
145  virtual void SetInputArray(int index, const vtkStdString &name);
146 
150  void SetColorSeries(vtkColorSeries *colorSeries);
151 
155  vtkColorSeries *GetColorSeries();
156 
158 
161  virtual void SetLookupTable(vtkScalarsToColors *lut);
162  virtual vtkScalarsToColors *GetLookupTable();
164 
169  virtual void CreateDefaultLookupTable();
170 
172 
175  vtkSetMacro(ScalarVisibility, bool);
176  vtkGetMacro(ScalarVisibility, bool);
177  vtkBooleanMacro(ScalarVisibility, bool);
179 
181 
186  void SelectColorArray(vtkIdType arrayNum);
187  void SelectColorArray(const vtkStdString& arrayName);
189 
193  vtkStdString GetColorArrayName();
194 
198  virtual vtkStringArray *GetLabels();
199 
203  virtual void SetGroupName(const vtkStdString& name);
204 
208  virtual vtkStdString GetGroupName();
209 
214  virtual vtkStdString GetTooltipLabel(const vtkVector2d &plotPos,
215  vtkIdType seriesIndex,
216  vtkIdType segmentIndex);
217 
221  virtual bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max);
222 
229  const vtkVector2f& tolerance,
231 
240  const vtkVector2f&,
242  vtkIdType* segmentIndex);
243 
247  int GetBarsCount();
248 
252  void GetDataBounds(double bounds[2]);
253 
254 protected:
255  vtkPlotBar();
256  ~vtkPlotBar();
257 
261  bool UpdateTableCache(vtkTable *table);
262 
267 
268  float Width;
269  float Offset;
270 
272 
277 
282 
284 
292 
293  bool LogX;
294  bool LogY;
295 
296 private:
297  vtkPlotBar(const vtkPlotBar &) VTK_DELETE_FUNCTION;
298  void operator=(const vtkPlotBar &) VTK_DELETE_FUNCTION;
299 
300  vtkPlotBarPrivate *Private;
301 
302 };
303 
304 #endif //vtkPlotBar_h
vtkPoints2D
represent and manipulate 2D points
Definition: vtkPoints2D.h:36
vtkPlot::GetTooltipLabel
virtual vtkStdString GetTooltipLabel(const vtkVector2d &plotPos, vtkIdType seriesIndex, vtkIdType segmentIndex)
Generate and return the tooltip label string for this plot The segmentIndex parameter is ignored,...
vtkPlot.h
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkPlotBar::ScalarVisibility
bool ScalarVisibility
Definition: vtkPlotBar.h:289
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:68
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkColorSeries
stores a list of colors.
Definition: vtkColorSeries.h:54
vtkPlotBar::ColorArrayName
vtkStdString ColorArrayName
Definition: vtkPlotBar.h:290
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkPlotBar::Offset
float Offset
Definition: vtkPlotBar.h:269
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:41
vtkSmartPointer< vtkColorSeries >
vtkPlot::SetColor
virtual void SetColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Set the plot color.
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:57
vtkPlot
Abstract class for 2D plots.
Definition: vtkPlot.h:52
vtkPlotBar::LogX
bool LogX
Definition: vtkPlotBar.h:293
vtkPlotBar::Points
vtkPoints2D * Points
Store a well packed set of XY coordinates for this data series.
Definition: vtkPlotBar.h:266
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkVector2d
Definition: vtkVector.h:346
vtkPlotBar::ColorSeries
vtkSmartPointer< vtkColorSeries > ColorSeries
The color series to use if this becomes a stacked bar.
Definition: vtkPlotBar.h:281
vtkPlotBar::LookupTable
vtkSmartPointer< vtkScalarsToColors > LookupTable
Lookup Table for coloring bars by scalar value.
Definition: vtkPlotBar.h:287
vtkPlotBar
Class for drawing an XY plot given two columns from a vtkTable.
Definition: vtkPlotBar.h:45
vtkX3D::point
Definition: vtkX3D.h:236
vtkPlot::SelectPoints
virtual bool SelectPoints(const vtkVector2f &min, const vtkVector2f &max)
Select all points in the specified rectangle.
vtkPlotBar::Colors
vtkSmartPointer< vtkUnsignedCharArray > Colors
Definition: vtkPlotBar.h:288
vtkPlotBar::BuildTime
vtkTimeStamp BuildTime
The point cache is marked dirty until it has been initialized.
Definition: vtkPlotBar.h:276
vtkPlotBar::LogY
bool LogY
Definition: vtkPlotBar.h:294
vtkPlotBar::Width
float Width
Definition: vtkPlotBar.h:268
vtkPlot::GetNearestPoint
virtual vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location)
Function to query a plot for the nearest point to the specified coordinate.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSmartPointer.h
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:66
vtkPlot::PaintLegend
virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf &rect, int legendIndex)
Paint legend event for the plot, called whenever the legend needs the plot items symbol/mark/line dra...
vtkX3D::name
Definition: vtkX3D.h:219
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkPlot::SetInputArray
virtual void SetInputArray(int index, const vtkStdString &name)
Convenience function to set the input arrays.
vtkX3D::orientation
Definition: vtkX3D.h:262
vtkPlot::GetLabels
virtual vtkStringArray * GetLabels()
Get the plot labels.
vtkAbstractContextItem::Paint
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
vtkPlot::GetUnscaledInputBounds
virtual void GetUnscaledInputBounds(double bounds[4])
Provide un-log-scaled bounds for the plot inputs.
Definition: vtkPlot.h:363
vtkPlot::PrintSelf
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:42
vtkX3D::location
Definition: vtkX3D.h:406
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:47
vtkPlotBar::Orientation
int Orientation
Definition: vtkPlotBar.h:271
vtkPlot::GetBounds
virtual void GetBounds(double bounds[4])
Get the bounds for this plot as (Xmin, Xmax, Ymin, Ymax).
Definition: vtkPlot.h:336
vtkPlot::GetColor
virtual void GetColor(double rgb[3])
vtkX3D::index
Definition: vtkX3D.h:246
vtkRectf
Definition: vtkRect.h:296
vtkVector2f
Definition: vtkVector.h:337
vtkAbstractContextItem::Update
virtual void Update()
Perform any updates to the item that may be necessary before rendering.