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 
26 #ifndef vtkChartMatrix_h
27 #define vtkChartMatrix_h
28 
29 #include "vtkChartsCoreModule.h" // For export macro
30 #include "vtkAbstractContextItem.h"
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) VTK_OVERRIDE;
43 
47  static vtkChartMatrix *New();
48 
52  void Update() VTK_OVERRIDE;
53 
57  bool Paint(vtkContext2D *painter) VTK_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);
77  void SetBorderBottom(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 
129  virtual vtkChart* GetChart(const vtkVector2i& position);
130 
136  virtual bool SetChartSpan(const vtkVector2i& position,
137  const vtkVector2i& span);
138 
142  virtual vtkVector2i GetChartSpan(const vtkVector2i& position);
143 
148  virtual vtkVector2i GetChartIndex(const vtkVector2f& position);
149 
150 protected:
151  vtkChartMatrix();
152  ~vtkChartMatrix() VTK_OVERRIDE;
153 
154  class PIMPL;
155  PIMPL *Private;
156 
157  // The number of charts in x and y.
159 
160  // The gutter between each chart.
161  vtkVector2f Gutter;
162  std::map<vtkVector2i, vtkVector2f> SpecificResize;
163  int Borders[4];
164  bool LayoutIsDirty;
165 
166 private:
167  vtkChartMatrix(const vtkChartMatrix &) VTK_DELETE_FUNCTION;
168  void operator=(const vtkChartMatrix &) VTK_DELETE_FUNCTION;
169 };
170 
171 #endif //vtkChartMatrix_h
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:52
Factory class for drawing 2D charts.
Definition: vtkChart.h:44
a simple class to control print indentation
Definition: vtkIndent.h:33
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:324
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.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual vtkVector2f GetGutter() const
Get the gutter that should be left between the charts in the matrix.
virtual void Update()
Perform any updates to the item that may be necessary before rendering.