VTK
vtkContextArea.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkContextArea.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 
42 #ifndef vtkContextArea_h
43 #define vtkContextArea_h
44 
45 #include "vtkAbstractContextItem.h"
46 
47 #include "vtkAxis.h" // For enums
48 #include "vtkChartsCoreModule.h" // For export macro
49 #include "vtkRect.h" // For vtkRect/vtkVector/vtkTuple
50 #include "vtkNew.h" // For vtkNew
51 
52 class vtkContextClip;
54 class vtkPlotGrid;
55 
57 {
58 public:
61  virtual void PrintSelf(ostream &os, vtkIndent indent);
62 
63  static vtkContextArea *New();
64 
66  vtkAxis* GetAxis(vtkAxis::Location location);
67 
70  vtkAbstractContextItem* GetDrawAreaItem();
71 
73  virtual bool Paint(vtkContext2D *painter);
74 
76 
79  vtkGetMacro(Geometry, vtkRecti)
80  vtkSetMacro(Geometry, vtkRecti)
82 
84 
87  vtkGetMacro(DrawAreaBounds, vtkRectd)
88  vtkSetMacro(DrawAreaBounds, vtkRectd)
90 
95  DARB_FixedMargins
96  };
97 
99 
108  vtkGetMacro(DrawAreaResizeBehavior, DrawAreaResizeBehaviorType)
109  vtkSetMacro(DrawAreaResizeBehavior, DrawAreaResizeBehaviorType)
111 
113 
116  vtkGetMacro(FixedAspect, float)
117  virtual void SetFixedAspect(float aspect);
119 
121 
124  vtkGetMacro(FixedRect, vtkRecti)
125  virtual void SetFixedRect(vtkRecti rect);
126  virtual void SetFixedRect(int x, int y, int width, int height);
128 
130 
134  virtual const Margins& GetFixedMargins() { return this->FixedMargins; }
135  virtual void GetFixedMarginsArray(int margins[4]);
136  virtual const int* GetFixedMarginsArray();
137  virtual void SetFixedMargins(Margins margins);
138  virtual void SetFixedMargins(int margins[4]);
139  virtual void SetFixedMargins(int left, int right, int bottom, int top);
141 
143 
146  vtkGetMacro(FillViewport, bool)
147  vtkSetMacro(FillViewport, bool)
148  vtkBooleanMacro(FillViewport, bool)
150 
152 
153  virtual void SetShowGrid(bool show);
154  virtual bool GetShowGrid();
155  virtual void ShowGridOn() { this->SetShowGrid(true); }
156  virtual void ShowGridOff() { this->SetShowGrid(false); }
158 
159 protected:
160  vtkContextArea();
161  ~vtkContextArea();
162 
166  void LayoutAxes(vtkContext2D *painter);
167 
169  vtkRecti ComputeDrawAreaGeometry(vtkContext2D *painter);
170 
172 
173  vtkRecti ComputeExpandedDrawAreaGeometry(vtkContext2D *painter);
174  vtkRecti ComputeFixedAspectDrawAreaGeometry(vtkContext2D *painter);
175  vtkRecti ComputeFixedRectDrawAreaGeometry(vtkContext2D *painter);
176  vtkRecti ComputeFixedMarginsDrawAreaGeometry(vtkContext2D *painter);
178 
182  void UpdateDrawArea();
183 
187 
190 
193 
196 
200 
205 
209 
212 
215  float FixedAspect;
216 
220 
224  Margins FixedMargins;
225 
230 
231 private:
232  vtkContextArea(const vtkContextArea &); // Not implemented.
233  void operator=(const vtkContextArea &); // Not implemented.
234 
235  // Smart pointers for axis lifetime management. See this->Axes.
236  vtkNew<vtkAxis> TopAxis;
237  vtkNew<vtkAxis> BottomAxis;
238  vtkNew<vtkAxis> LeftAxis;
239  vtkNew<vtkAxis> RightAxis;
240 };
241 
242 #endif //vtkContextArea_h
vtkTuple< int, 4 > Margins
virtual void ShowGridOff()
Margins FixedMargins
vtkNew< vtkContextClip > Clip
all children of this item are transformed by the vtkTransform2D of this item.
vtkRecti DrawAreaGeometry
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:56
takes care of drawing 2D axes
Definition: vtkAxis.h:70
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkNew< vtkContextTransform > Transform
Clipped, transformed area with axes for context items.
vtkRecti FixedRect
base class for items that are part of a vtkContextScene.
takes care of drawing the plot grid
Definition: vtkPlotGrid.h:37
vtkNew< vtkPlotGrid > Grid
vtkRectd DrawAreaBounds
vtkTuple< vtkAxis *, 4 > Axes
all children of this item are clipped by the specified area.
#define VTKCHARTSCORE_EXPORT
DrawAreaResizeBehaviorType DrawAreaResizeBehavior