VTK  9.0.1
vtkPlotBox.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPlotBox.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 
25 #ifndef vtkPlotBox_h
26 #define vtkPlotBox_h
27 
28 #include "vtkChartsCoreModule.h" // For export macro
29 #include "vtkPlot.h"
30 #include "vtkStdString.h" // For vtkStdString ivars
31 
32 class vtkBrush;
33 class vtkTextProperty;
34 class vtkTable;
35 class vtkStdString;
36 class vtkScalarsToColors;
37 
38 class VTKCHARTSCORE_EXPORT vtkPlotBox : public vtkPlot
39 {
40 public:
41  vtkTypeMacro(vtkPlotBox, vtkPlot);
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
47  static vtkPlotBox* New();
48 
54  void Update() override;
55 
59  bool Paint(vtkContext2D* painter) override;
60 
67  bool PaintLegend(vtkContext2D* painter, const vtkRectf& rect, int legendIndex) override;
68 
70 
73  void SetInputData(vtkTable* table) override;
74  void SetInputData(vtkTable* table, const vtkStdString&, const vtkStdString&) override
75  {
76  this->SetInputData(table);
77  }
79 
84  vtkStringArray* GetLabels() override;
85 
91  vtkIdType GetNearestPoint(const vtkVector2f& point, const vtkVector2f& tolerance,
93 #ifndef VTK_LEGACY_REMOVE
94  vtkIdType* segmentId) override;
95 #else
96  vtkIdType* segmentId = nullptr) override;
97 #endif // VTK_LEGACY_REMOVE
98 
99 #ifndef VTK_LEGACY_REMOVE
101 #endif // VTK_LEGACY_REMOVE
102 
104 
107  void SetLookupTable(vtkScalarsToColors* lut);
108  vtkScalarsToColors* GetLookupTable();
110 
114  void SetColumnColor(const vtkStdString& colName, double* rgb);
115 
120  virtual void CreateDefaultLookupTable();
121 
123 
126  vtkGetMacro(BoxWidth, float);
127  vtkSetMacro(BoxWidth, float);
129 
131 
134  vtkGetObjectMacro(TitleProperties, vtkTextProperty);
136 
137 protected:
138  vtkPlotBox();
139  ~vtkPlotBox() override;
140 
141  void DrawBoxPlot(int, unsigned char*, double, vtkContext2D*);
142 
146  bool UpdateTableCache(vtkTable* table);
147 
149 
152  class Private;
153  Private* Storage;
155 
160 
164  float BoxWidth;
165 
170 
175 
176 private:
177  vtkPlotBox(const vtkPlotBox&) = delete;
178  void operator=(const vtkPlotBox&) = delete;
179 };
180 
181 #endif // vtkPlotBox_h
vtkBrush
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:37
vtkStdString.h
vtkPlotBox::TitleProperties
vtkTextProperty * TitleProperties
Text properties for the plot title.
Definition: vtkPlotBox.h:174
vtkPlot.h
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:62
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkPlot::SetInputData
virtual void SetInputData(vtkTable *table)
This is a convenience function to set the input table and the x, y column for the plot.
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
vtkPlot
Abstract class for 2D plots.
Definition: vtkPlot.h:46
vtkPlotBox::BuildTime
vtkTimeStamp BuildTime
The point cache is marked dirty until it has been initialized.
Definition: vtkPlotBox.h:159
vtkPlotBox::Storage
Private * Storage
Definition: vtkPlotBox.h:152
vtkPlotBox::LookupTable
vtkScalarsToColors * LookupTable
Lookup Table for coloring points by scalar value.
Definition: vtkPlotBox.h:169
vtkPlot::GetNearestPoint
virtual vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location, vtkIdType *segmentId)
Function to query a plot for the nearest point to the specified coordinate.
vtkPlotBox
Class for drawing box plots.
Definition: vtkPlotBox.h:38
vtkX3D::point
@ point
Definition: vtkX3D.h:242
vtkPlotBox::BoxWidth
float BoxWidth
Width of boxes.
Definition: vtkPlotBox.h:164
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkPlotBox::SetInputData
void SetInputData(vtkTable *table, const vtkStdString &, const vtkStdString &) override
Definition: vtkPlotBox.h:74
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:59
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...
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:33
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.
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:36
vtkX3D::location
@ location
Definition: vtkX3D.h:412
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:34
vtkPlot::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkRectf
Definition: vtkRect.h:326
vtkVector2f
Definition: vtkVector.h:432
vtkAbstractContextItem::Update
virtual void Update()
Perform any updates to the item that may be necessary before rendering.