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 
25 #ifndef vtkChartXYZ_h
26 #define vtkChartXYZ_h
27 
28 #include "vtkChartsCoreModule.h" // For export macro
29 #include "vtkContextItem.h"
30 #include "vtkColor.h" // For vtkColor4ub
31 #include "vtkRect.h" // For vtkRectf ivars
32 #include "vtkNew.h" // For ivars
33 #include "vtkSmartPointer.h" // For ivars
34 #include <vector> // For ivars
35 
36 class vtkAnnotationLink;
37 class vtkAxis;
38 class vtkContext3D;
40 class vtkPen;
41 class vtkPlaneCollection;
42 class vtkPlot3D;
43 class vtkTable;
44 class vtkTransform;
46 
48 {
49 public:
50  vtkTypeMacro(vtkChartXYZ, vtkContextItem);
51  virtual void PrintSelf(ostream &os, vtkIndent indent);
52 
53  static vtkChartXYZ * New();
54 
59  void SetGeometry(const vtkRectf &bounds);
60 
62  void SetAngle(double angle);
63 
65  void SetAroundX(bool isX);
66 
68  virtual void SetAnnotationLink(vtkAnnotationLink *link);
69 
71  vtkAxis * GetAxis(int axis);
72 
74 
75  void SetAxisColor(const vtkColor4ub& color);
76  vtkColor4ub GetAxisColor();
78 
81  void SetAutoRotate(bool b);
82 
85  void SetDecorateAxes(bool b);
86 
89  void SetFitToScene(bool b);
90 
93  virtual void Update();
94 
97  virtual bool Paint(vtkContext2D *painter);
98 
100  virtual vtkIdType AddPlot(vtkPlot3D* plot);
101 
103  void ClearPlots();
104 
107  void RecalculateBounds();
108 
112  void RecalculateTransform();
113 
114  //BTX
116  virtual bool Hit(const vtkContextMouseEvent &mouse);
117 
119  virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
120 
123  virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
124 
126  virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta);
127 
129 
132  virtual bool KeyPressEvent(const vtkContextKeyEvent &key);
133  //ETX
135 
136 protected:
137  vtkChartXYZ();
138  ~vtkChartXYZ();
139 
143  virtual void CalculateTransforms();
144 
146 
150  bool CalculatePlotTransform(vtkAxis *x, vtkAxis *y, vtkAxis *z,
151  vtkTransform *transform);
153 
155  bool Rotate(const vtkContextMouseEvent &mouse);
156 
158  bool Pan(const vtkContextMouseEvent &mouse);
159 
161  bool Zoom(const vtkContextMouseEvent &mouse);
162 
164  bool Spin(const vtkContextMouseEvent &mouse);
165 
168  void LookDownX();
169 
172  void LookDownY();
173 
176  void LookDownZ();
177 
180  void LookUpX();
181 
184  void LookUpY();
185 
188  void LookUpZ();
189 
191  bool CheckForSceneResize();
192 
194  void RescaleAxes();
195 
197  void ScaleUpAxes();
198 
200  void ScaleDownAxes();
201 
203  void ZoomAxes(int delta);
204 
208  void InitializeAxesBoundaryPoints();
209 
217  void InitializeFutureBox();
218 
220  void ComputeDataBounds();
221 
223  void DrawAxes(vtkContext3D *context);
224 
227  void DetermineWhichAxesToLabel();
228 
230  void DrawTickMarks(vtkContext2D *painter);
231 
233  void DrawAxesLabels(vtkContext2D *painter);
234 
238  void GetOffsetForAxisLabel(int axis, float *bounds, float *offset);
239 
243  double CalculateNiceMinMax(double &min, double &max, int axis);
244 
246  void GetClippingPlaneEquation(int i, double *planeEquation);
247 
250 
252  std::vector< vtkSmartPointer<vtkAxis> > Axes;
253 
257 
260  bool IsX;
261 
264  double Angle;
265 
269 
273 
277 
282 
286 
289 
293 
297 
301 
306 
309 
312 
315 
318 
320  std::vector<vtkPlot3D *> Plots;
321 
324 
327 
330 
333 
336  float AxesBoundaryPoints[14][3];
337 
340  float TickLabelOffset[3][2];
341 
344 
347 
349 
350  int XAxisToLabel[3];
351  int YAxisToLabel[3];
352  int ZAxisToLabel[3];
354 
356  int DirectionToData[3];
357 
359  double DataBounds[4];
360 
361 private:
362  vtkChartXYZ(const vtkChartXYZ &); // Not implemented.
363  void operator=(const vtkChartXYZ &); // Not implemented.
364 };
365 
366 #endif
std::vector< vtkSmartPointer< vtkAxis > > Axes
Definition: vtkChartXYZ.h:252
bool AutoRotate
Definition: vtkChartXYZ.h:256
data structure to represent key events.
vtkNew< vtkTransform > PlotTransform
Definition: vtkChartXYZ.h:281
base class for items that are part of a vtkContextScene.
virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
vtkNew< vtkTransform > Scale
Definition: vtkChartXYZ.h:296
virtual bool Paint(vtkContext2D *painter)
maintain a list of planes
vtkNew< vtkTransform > Rotation
Definition: vtkChartXYZ.h:288
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
int vtkIdType
Definition: vtkType.h:275
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:56
vtkRectf Geometry
Definition: vtkChartXYZ.h:249
virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta)
takes care of drawing 2D axes
Definition: vtkAxis.h:70
data structure to represent mouse events.
double Angle
Definition: vtkChartXYZ.h:264
a simple class to control print indentation
Definition: vtkIndent.h:38
std::string YAxisLabel
Definition: vtkChartXYZ.h:326
std::string ZAxisLabel
Definition: vtkChartXYZ.h:329
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:38
vtkNew< vtkTransform > Translation
Definition: vtkChartXYZ.h:292
vtkSmartPointer< vtkAnnotationLink > Link
Definition: vtkChartXYZ.h:317
virtual bool KeyPressEvent(const vtkContextKeyEvent &key)
dynamic, self-adjusting array of unsigned char
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:67
vtkNew< vtkPen > AxisPen
Definition: vtkChartXYZ.h:314
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
vtkNew< vtkTransform > ContextTransform
Definition: vtkChartXYZ.h:276
virtual bool Hit(const vtkContextMouseEvent &mouse)
bool FitToScene
Definition: vtkChartXYZ.h:272
std::string XAxisLabel
Definition: vtkChartXYZ.h:323
Abstract class for 3D plots.
Definition: vtkPlot3D.h:43
virtual void PrintSelf(ostream &os, vtkIndent indent)
static vtkObject * New()
vtkNew< vtkPlaneCollection > BoundingCube
Definition: vtkChartXYZ.h:332
vtkNew< vtkTransform > BoxScale
Definition: vtkChartXYZ.h:300
std::vector< vtkPlot3D * > Plots
Definition: vtkChartXYZ.h:320
Factory class for drawing 3D XYZ charts.
Definition: vtkChartXYZ.h:47
vtkNew< vtkTransform > FutureBox
Definition: vtkChartXYZ.h:305
bool DrawAxesDecoration
Definition: vtkChartXYZ.h:268
virtual void Update()
#define max(a, b)
#define VTKCHARTSCORE_EXPORT
vtkNew< vtkTransform > FutureBoxScale
Definition: vtkChartXYZ.h:308
vtkNew< vtkTransform > Box
Definition: vtkChartXYZ.h:285
vtkNew< vtkPen > Pen
Definition: vtkChartXYZ.h:311
Class for drawing 3D primitives to a graphical context.
Definition: vtkContext3D.h:39