VTK
vtkChartXYZ.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkChartXYZ.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 
23 #ifndef vtkChartXYZ_h
24 #define vtkChartXYZ_h
25 
26 #include "vtkChartsCoreModule.h" // For export macro
27 #include "vtkContextItem.h"
28 #include "vtkColor.h" // For vtkColor4ub
29 #include "vtkRect.h" // For vtkRectf ivars
30 #include "vtkNew.h" // For ivars
31 #include "vtkSmartPointer.h" // For ivars
32 #include <vector> // For ivars
33 
34 class vtkAnnotationLink;
35 class vtkAxis;
36 class vtkContext3D;
38 class vtkPen;
39 class vtkPlaneCollection;
40 class vtkPlot3D;
41 class vtkTable;
42 class vtkTransform;
44 
45 class VTKCHARTSCORE_EXPORT vtkChartXYZ : public vtkContextItem
46 {
47 public:
48  vtkTypeMacro(vtkChartXYZ, vtkContextItem);
49  void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE;
50 
51  static vtkChartXYZ * New();
52 
59  void SetGeometry(const vtkRectf &bounds);
60 
64  void SetAngle(double angle);
65 
69  void SetAroundX(bool isX);
70 
74  virtual void SetAnnotationLink(vtkAnnotationLink *link);
75 
79  vtkAxis * GetAxis(int axis);
80 
82 
85  void SetAxisColor(const vtkColor4ub& color);
86  vtkColor4ub GetAxisColor();
88 
93  void SetAutoRotate(bool b);
94 
99  void SetDecorateAxes(bool b);
100 
105  void SetFitToScene(bool b);
106 
110  void Update() VTK_OVERRIDE;
111 
115  bool Paint(vtkContext2D *painter) VTK_OVERRIDE;
116 
120  virtual vtkIdType AddPlot(vtkPlot3D* plot);
121 
125  void ClearPlots();
126 
131  void RecalculateBounds();
132 
138  void RecalculateTransform();
139 
143  bool Hit(const vtkContextMouseEvent &mouse) VTK_OVERRIDE;
144 
148  bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) VTK_OVERRIDE;
149 
153  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) VTK_OVERRIDE;
154 
158  bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta) VTK_OVERRIDE;
159 
165  bool KeyPressEvent(const vtkContextKeyEvent &key) VTK_OVERRIDE;
166 
167 protected:
168  vtkChartXYZ();
169  ~vtkChartXYZ() VTK_OVERRIDE;
170 
176  virtual void CalculateTransforms();
177 
184  bool CalculatePlotTransform(vtkAxis *x, vtkAxis *y, vtkAxis *z,
185  vtkTransform *transform);
186 
190  bool Rotate(const vtkContextMouseEvent &mouse);
191 
195  bool Pan(const vtkContextMouseEvent &mouse);
196 
200  bool Zoom(const vtkContextMouseEvent &mouse);
201 
205  bool Spin(const vtkContextMouseEvent &mouse);
206 
210  void LookDownX();
211 
215  void LookDownY();
216 
220  void LookDownZ();
221 
225  void LookUpX();
226 
230  void LookUpY();
231 
235  void LookUpZ();
236 
240  bool CheckForSceneResize();
241 
245  void RescaleAxes();
246 
250  void ScaleUpAxes();
251 
255  void ScaleDownAxes();
256 
260  void ZoomAxes(int delta);
261 
266  void InitializeAxesBoundaryPoints();
267 
277  void InitializeFutureBox();
278 
282  void ComputeDataBounds();
283 
287  void DrawAxes(vtkContext3D *context);
288 
293  void DetermineWhichAxesToLabel();
294 
298  void DrawTickMarks(vtkContext2D *painter);
299 
303  void DrawAxesLabels(vtkContext2D *painter);
304 
310  void GetOffsetForAxisLabel(int axis, float *bounds, float *offset);
311 
317  double CalculateNiceMinMax(double &min, double &max, int axis);
318 
322  void GetClippingPlaneEquation(int i, double *planeEquation);
323 
327  vtkRectf Geometry;
328 
333 
338  bool AutoRotate;
339 
344  bool IsX;
345 
350  double Angle;
351 
356  bool DrawAxesDecoration;
357 
362  bool FitToScene;
363 
367  vtkNew<vtkTransform> ContextTransform;
368 
374  vtkNew<vtkTransform> PlotTransform;
375 
380 
384  vtkNew<vtkTransform> Rotation;
385 
390  vtkNew<vtkTransform> Translation;
391 
397 
402  vtkNew<vtkTransform> BoxScale;
403 
409  vtkNew<vtkTransform> FutureBox;
410 
414  vtkNew<vtkTransform> FutureBoxScale;
415 
420 
424  vtkNew<vtkPen> AxisPen;
425 
430 
434  std::vector<vtkPlot3D *> Plots;
435 
439  std::string XAxisLabel;
440 
444  std::string YAxisLabel;
445 
449  std::string ZAxisLabel;
450 
454  vtkNew<vtkPlaneCollection> BoundingCube;
455 
460  float AxesBoundaryPoints[14][3];
461 
466  float TickLabelOffset[3][2];
467 
471  int SceneHeight;
472 
476  int SceneWidth;
477 
479 
482  int XAxisToLabel[3];
483  int YAxisToLabel[3];
484  int ZAxisToLabel[3];
486 
490  int DirectionToData[3];
491 
495  double DataBounds[4];
496 
497 private:
498  vtkChartXYZ(const vtkChartXYZ &) VTK_DELETE_FUNCTION;
499  void operator=(const vtkChartXYZ &) VTK_DELETE_FUNCTION;
500 };
501 
502 #endif
data structure to represent key events.
base class for items that are part of a vtkContextScene.
maintain a list of planes
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
Hold a reference to a vtkObjectBase instance.
int vtkIdType
Definition: vtkType.h:345
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
takes care of drawing 2D axes
Definition: vtkAxis.h:68
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:33
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:36
dynamic, self-adjusting array of unsigned char
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:62
Allocate and hold a VTK object.
Definition: vtkNew.h:61
Abstract class for 3D plots.
Definition: vtkPlot3D.h:44
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Factory class for drawing 3D XYZ charts.
Definition: vtkChartXYZ.h:45
virtual void Update()
Perform any updates to the item that may be necessary before rendering.
#define max(a, b)
Class for drawing 3D primitives to a graphical context.
Definition: vtkContext3D.h:40