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 
40 #ifndef vtkContextArea_h
41 #define vtkContextArea_h
42 
43 #include "vtkAbstractContextItem.h"
44 
45 #include "vtkAxis.h" // For enums
46 #include "vtkChartsCoreModule.h" // For export macro
47 #include "vtkRect.h" // For vtkRect/vtkVector/vtkTuple
48 #include "vtkNew.h" // For vtkNew
49 
50 class vtkContextClip;
52 class vtkPlotGrid;
53 
54 class VTKCHARTSCORE_EXPORT vtkContextArea: public vtkAbstractContextItem
55 {
56 public:
59  void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE;
60 
61  static vtkContextArea *New();
62 
66  vtkAxis* GetAxis(vtkAxis::Location location);
67 
72  vtkAbstractContextItem* GetDrawAreaItem();
73 
77  bool Paint(vtkContext2D *painter) VTK_OVERRIDE;
78 
80 
85  vtkGetMacro(Geometry, vtkRecti)
86  vtkSetMacro(Geometry, vtkRecti)
88 
90 
94  vtkGetMacro(DrawAreaBounds, vtkRectd)
95  vtkSetMacro(DrawAreaBounds, vtkRectd)
97 
102  DARB_FixedMargins
103  };
104 
106 
119  vtkGetMacro(DrawAreaResizeBehavior, DrawAreaResizeBehaviorType)
120  vtkSetMacro(DrawAreaResizeBehavior, DrawAreaResizeBehaviorType)
122 
124 
130  vtkGetMacro(FixedAspect, float)
131  virtual void SetFixedAspect(float aspect);
133 
135 
141  vtkGetMacro(FixedRect, vtkRecti)
142  virtual void SetFixedRect(vtkRecti rect);
143  virtual void SetFixedRect(int x, int y, int width, int height);
145 
147 
154  virtual const Margins& GetFixedMargins() { return this->FixedMargins; }
155  virtual void GetFixedMarginsArray(int margins[4]);
156  virtual const int* GetFixedMarginsArray();
157  virtual void SetFixedMargins(Margins margins);
158  virtual void SetFixedMargins(int margins[4]);
159  virtual void SetFixedMargins(int left, int right, int bottom, int top);
161 
163 
168  vtkGetMacro(FillViewport, bool)
169  vtkSetMacro(FillViewport, bool)
170  vtkBooleanMacro(FillViewport, bool)
172 
174 
177  virtual void SetShowGrid(bool show);
178  virtual bool GetShowGrid();
179  virtual void ShowGridOn() { this->SetShowGrid(true); }
180  virtual void ShowGridOff() { this->SetShowGrid(false); }
182 
183 protected:
184  vtkContextArea();
185  ~vtkContextArea() VTK_OVERRIDE;
186 
192  void LayoutAxes(vtkContext2D *painter);
193  virtual void SetAxisRange(vtkRectd const& data);
194  virtual void ComputeViewTransform();
195 
199  vtkRecti ComputeDrawAreaGeometry(vtkContext2D *painter);
200 
202 
205  vtkRecti ComputeExpandedDrawAreaGeometry(vtkContext2D *painter);
206  vtkRecti ComputeFixedAspectDrawAreaGeometry(vtkContext2D *painter);
207  vtkRecti ComputeFixedRectDrawAreaGeometry(vtkContext2D *painter);
208  vtkRecti ComputeFixedMarginsDrawAreaGeometry(vtkContext2D *painter);
210 
215  void UpdateDrawArea();
216 
220  vtkTuple<vtkAxis*, 4> Axes;
221 
226 
231 
236 
241  vtkRecti Geometry;
242 
247  vtkRectd DrawAreaBounds;
248 
253  vtkRecti DrawAreaGeometry;
254 
258  DrawAreaResizeBehaviorType DrawAreaResizeBehavior;
259 
264  float FixedAspect;
265 
270  vtkRecti FixedRect;
271 
277  Margins FixedMargins;
278 
284  bool FillViewport;
285 
289  virtual void InitializeDrawArea();
290 
291  // Smart pointers for axis lifetime management. See this->Axes.
292  vtkNew<vtkAxis> TopAxis;
293  vtkNew<vtkAxis> BottomAxis;
294  vtkNew<vtkAxis> LeftAxis;
295  vtkNew<vtkAxis> RightAxis;
296 
297 private:
298  vtkContextArea(const vtkContextArea &) VTK_DELETE_FUNCTION;
299  void operator=(const vtkContextArea &) VTK_DELETE_FUNCTION;
300 };
301 
302 #endif //vtkContextArea_h
vtkTuple< int, 4 > Margins
virtual void ShowGridOff()
Turn on/off grid visibility.
all children of this item are transformed by the vtkTransform2D of this item.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
takes care of drawing 2D axes
Definition: vtkAxis.h:68
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Clipped, transformed area with axes for context items.
Allocate and hold a VTK object.
Definition: vtkNew.h:61
base class for items that are part of a vtkContextScene.
takes care of drawing the plot grid
Definition: vtkPlotGrid.h:38
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
all children of this item are clipped by the specified area.
Transform
Definition: ADIOSDefs.h:39