VTK  9.0.1
vtkChartMatrix.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkChartMatrix.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 
26 #ifndef vtkChartMatrix_h
27 #define vtkChartMatrix_h
28 
29 #include "vtkAbstractContextItem.h"
30 #include "vtkChartsCoreModule.h" // For export macro
31 #include "vtkVector.h" // For ivars
32 
33 #include <map> // For specific gutter
34 #include <utility> // For specific gutter
35 
36 class vtkChart;
37 
38 class VTKCHARTSCORE_EXPORT vtkChartMatrix : public vtkAbstractContextItem
39 {
40 public:
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
47  static vtkChartMatrix* New();
48 
52  void Update() override;
53 
57  bool Paint(vtkContext2D* painter) override;
58 
64  virtual void SetSize(const vtkVector2i& size);
65 
69  virtual vtkVector2i GetSize() const { return this->Size; }
70 
72 
75  virtual void SetBorders(int left, int bottom, int right, int top);
76  void SetBorderLeft(int value);
78  void SetBorderRight(int value);
79  void SetBorderTop(int value);
80  virtual void GetBorders(int borders[4])
81  {
82  for (int i = 0; i < 4; i++)
83  {
84  borders[i] = this->Borders[i];
85  }
86  }
88 
90 
93  virtual void SetGutter(const vtkVector2f& gutter);
94  void SetGutterX(float value);
95  void SetGutterY(float value);
97 
99 
102  virtual void SetSpecificResize(const vtkVector2i& index, const vtkVector2f& resize);
103  virtual void ClearSpecificResizes();
105 
109  virtual vtkVector2f GetGutter() const { return this->Gutter; }
110 
114  virtual void Allocate();
115 
122  virtual bool SetChart(const vtkVector2i& position, vtkChart* chart);
123 
130 
136  virtual bool SetChartSpan(const vtkVector2i& position, const vtkVector2i& span);
137 
142 
148 
149 protected:
151  ~vtkChartMatrix() override;
152 
153  // The number of charts in x and y.
155 
156  // The gutter between each chart.
158  std::map<vtkVector2i, vtkVector2f> SpecificResize;
159  int Borders[4];
161 
162 private:
163  vtkChartMatrix(const vtkChartMatrix&) = delete;
164  void operator=(const vtkChartMatrix&) = delete;
165 
166  class PIMPL;
167  PIMPL* Private;
168 };
169 
170 #endif // vtkChartMatrix_h
vtkChart
Factory class for drawing 2D charts.
Definition: vtkChart.h:45
vtkChartMatrix::SetBorderBottom
void SetBorderBottom(int value)
vtkChartMatrix::Gutter
vtkVector2f Gutter
Definition: vtkChartMatrix.h:157
vtkChartMatrix::SpecificResize
std::map< vtkVector2i, vtkVector2f > SpecificResize
Definition: vtkChartMatrix.h:158
vtkX3D::value
@ value
Definition: vtkX3D.h:226
vtkChartMatrix::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractContextItem
base class for items that are part of a vtkContextScene.
Definition: vtkAbstractContextItem.h:41
vtkChartMatrix::GetSize
virtual vtkVector2i GetSize() const
Get the width and height of the chart matrix.
Definition: vtkChartMatrix.h:69
vtkChartMatrix::Paint
bool Paint(vtkContext2D *painter) override
Paint event for the chart matrix.
vtkChartMatrix::Size
vtkVector2i Size
Definition: vtkChartMatrix.h:154
vtkChartMatrix
container for a matrix of charts.
Definition: vtkChartMatrix.h:39
vtkVector.h
vtkChartMatrix::SetBorders
virtual void SetBorders(int left, int bottom, int right, int top)
Set/get the borders of the chart matrix (space in pixels around each chart).
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:53
vtkX3D::top
@ top
Definition: vtkX3D.h:508
vtkChartMatrix::~vtkChartMatrix
~vtkChartMatrix() override
vtkX3D::position
@ position
Definition: vtkX3D.h:267
vtkChartMatrix::GetChartIndex
virtual vtkVector2i GetChartIndex(const vtkVector2f &position)
Get the position of the chart in the matrix at the specified location.
vtkChartMatrix::GetBorders
virtual void GetBorders(int borders[4])
Definition: vtkChartMatrix.h:80
vtkX3D::bottom
@ bottom
Definition: vtkX3D.h:296
vtkChartMatrix::SetSize
virtual void SetSize(const vtkVector2i &size)
Set the width and height of the chart matrix.
vtkChartMatrix::Allocate
virtual void Allocate()
Allocate the charts, this will cause any null chart to be allocated.
vtkChartMatrix::SetSpecificResize
virtual void SetSpecificResize(const vtkVector2i &index, const vtkVector2f &resize)
Set a specific resize that will move the bottom left point of a chart.
vtkChartMatrix::SetBorderRight
void SetBorderRight(int value)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkChartMatrix::GetChartSpan
virtual vtkVector2i GetChartSpan(const vtkVector2i &position)
Get the span of the specified chart.
vtkChartMatrix::vtkChartMatrix
vtkChartMatrix()
vtkChartMatrix::GetGutter
virtual vtkVector2f GetGutter() const
Get the gutter that should be left between the charts in the matrix.
Definition: vtkChartMatrix.h:109
vtkX3D::size
@ size
Definition: vtkX3D.h:259
vtkChartMatrix::New
static vtkChartMatrix * New()
Creates a new object.
vtkChartMatrix::SetChartSpan
virtual bool SetChartSpan(const vtkVector2i &position, const vtkVector2i &span)
Set the span of a chart in the matrix.
vtkChartMatrix::SetBorderLeft
void SetBorderLeft(int value)
vtkAbstractContextItem.h
vtkChartMatrix::Update
void Update() override
Perform any updates to the item that may be necessary before rendering.
vtkChartMatrix::SetGutterX
void SetGutterX(float value)
vtkChartMatrix::LayoutIsDirty
bool LayoutIsDirty
Definition: vtkChartMatrix.h:160
vtkChartMatrix::GetChart
virtual vtkChart * GetChart(const vtkVector2i &position)
Get the specified chart element, if the element does not exist nullptr will be returned.
vtkChartMatrix::SetBorderTop
void SetBorderTop(int value)
vtkVector2i
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:420
vtkChartMatrix::SetGutterY
void SetGutterY(float value)
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkVector2f
Definition: vtkVector.h:433
vtkChartMatrix::SetChart
virtual bool SetChart(const vtkVector2i &position, vtkChart *chart)
Set the chart element, note that the chart matrix must be large enough to accommodate the element bei...
vtkChartMatrix::SetGutter
virtual void SetGutter(const vtkVector2f &gutter)
Set the gutter that should be left between the charts in the matrix.
vtkChartMatrix::ClearSpecificResizes
virtual void ClearSpecificResizes()