VTK
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 
29 #ifndef vtkChartMatrix_h
30 #define vtkChartMatrix_h
31 
32 #include "vtkChartsCoreModule.h" // For export macro
33 #include "vtkAbstractContextItem.h"
34 #include "vtkVector.h" // For ivars
35 
36 #include <map> // For specific gutter
37 #include <utility> // For specific gutter
38 
39 class vtkChart;
40 
41 class VTKCHARTSCORE_EXPORT vtkChartMatrix : public vtkAbstractContextItem
42 {
43 public:
45  void PrintSelf(ostream &os, vtkIndent indent) override;
46 
50  static vtkChartMatrix *New();
51 
55  void Update() override;
56 
60  bool Paint(vtkContext2D *painter) override;
61 
67  virtual void SetSize(const vtkVector2i& size);
68 
72  virtual vtkVector2i GetSize() const { return this->Size; }
73 
75 
78  virtual void SetBorders(int left, int bottom, int right, int top);
79  void SetBorderLeft(int value);
80  void SetBorderBottom(int value);
81  void SetBorderRight(int value);
82  void SetBorderTop(int value);
83  virtual void GetBorders(int borders[4])
84  {
85  for(int i=0;i<4;i++)
86  {
87  borders[i]=this->Borders[i];
88  }
89  }
91 
93 
96  virtual void SetGutter(const vtkVector2f& gutter);
97  void SetGutterX(float value);
98  void SetGutterY(float value);
100 
102 
105  virtual void SetSpecificResize(const vtkVector2i& index, const vtkVector2f& resize);
106  virtual void ClearSpecificResizes();
108 
112  virtual vtkVector2f GetGutter() const { return this->Gutter; }
113 
117  virtual void Allocate();
118 
125  virtual bool SetChart(const vtkVector2i& position, vtkChart* chart);
126 
132  virtual vtkChart* GetChart(const vtkVector2i& position);
133 
139  virtual bool SetChartSpan(const vtkVector2i& position,
140  const vtkVector2i& span);
141 
145  virtual vtkVector2i GetChartSpan(const vtkVector2i& position);
146 
151  virtual vtkVector2i GetChartIndex(const vtkVector2f& position);
152 
153 protected:
154  vtkChartMatrix();
155  ~vtkChartMatrix() override;
156 
157  // The number of charts in x and y.
159 
160  // The gutter between each chart.
162  std::map<vtkVector2i, vtkVector2f> SpecificResize;
163  int Borders[4];
165 
166 private:
167  vtkChartMatrix(const vtkChartMatrix &) = delete;
168  void operator=(const vtkChartMatrix &) = delete;
169 
170  class PIMPL;
171  PIMPL *Private;
172 };
173 
174 #endif //vtkChartMatrix_h
vtkVector2i Size
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
virtual vtkVector2i GetSize() const
Get the width and height of the chart matrix.
std::map< vtkVector2i, vtkVector2f > SpecificResize
vtkVector2f Gutter
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
Factory class for drawing 2D charts.
Definition: vtkChart.h:50
a simple class to control print indentation
Definition: vtkIndent.h:39
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:408
virtual void GetBorders(int borders[4])
Set/get the borders of the chart matrix (space in pixels around each chart).
container for a matrix of charts.
base class for items that are part of a vtkContextScene.
virtual vtkVector2f GetGutter() const
Get the gutter that should be left between the charts in the matrix.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void Update()
Perform any updates to the item that may be necessary before rendering.