VTK
vtkScatterPlotMatrix.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkScatterPlotMatrix.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 vtkScatterPlotMatrix_h
27 #define vtkScatterPlotMatrix_h
28 
29 #include "vtkChartsCoreModule.h" // For export macro
30 #include "vtkChartMatrix.h"
31 #include "vtkSmartPointer.h" // For ivars
32 #include "vtkNew.h" // For ivars
33 #include "vtkColor.h" // For member function return
34 #include "vtkStdString.h" // For ivars
35 #include "vtkWeakPointer.h" // For currentPainter
36 
37 class vtkStringArray;
38 class vtkTable;
39 class vtkAxis;
40 class vtkAnnotationLink;
41 class vtkTextProperty;
42 class vtkTooltipItem;
44 
45 class VTKCHARTSCORE_EXPORT vtkScatterPlotMatrix : public vtkChartMatrix
46 {
47 public:
48  enum {
52  NOPLOT
53  };
54 
56  void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE;
57 
61  static vtkScatterPlotMatrix *New();
62 
66  void Update() VTK_OVERRIDE;
67 
71  bool Paint(vtkContext2D *painter) VTK_OVERRIDE;
72 
73  void SetScene(vtkContextScene *scene) VTK_OVERRIDE;
74 
80  virtual bool SetActivePlot(const vtkVector2i& position);
81 
85  virtual void SetSize(const vtkVector2i& size) VTK_OVERRIDE;
86 
90  virtual vtkVector2i GetActivePlot();
91 
96  vtkAnnotationLink* GetAnnotationLink();
97 
102  virtual void SetInput(vtkTable *table);
103 
107  void SetColumnVisibility(const vtkStdString& name, bool visible);
108 
113  void InsertVisibleColumn(const vtkStdString& name, int index);
114 
118  bool GetColumnVisibility(const vtkStdString& name);
119 
124  void SetColumnVisibilityAll(bool visible);
125 
129  virtual vtkStringArray* GetVisibleColumns();
130 
134  virtual void SetVisibleColumns(vtkStringArray* visColumns);
135 
140  virtual void SetNumberOfBins(int numberOfBins);
141 
146  virtual int GetNumberOfBins() const { return this->NumberOfBins; }
147 
151  void SetPlotColor(int plotType, const vtkColor4ub& color);
152 
156  void SetPlotMarkerStyle(int plotType, int style);
157 
161  void SetPlotMarkerSize(int plotType, float size);
162 
166  bool Hit(const vtkContextMouseEvent &mouse) VTK_OVERRIDE;
167 
171  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) VTK_OVERRIDE;
172 
176  bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) VTK_OVERRIDE;
177 
181  bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) VTK_OVERRIDE;
182 
184 
188  int GetPlotType(const vtkVector2i &pos);
189  int GetPlotType(int row, int column);
191 
193 
196  void SetTitle(const vtkStdString& title);
197  vtkStdString GetTitle();
199 
201 
204  void SetTitleProperties(vtkTextProperty *prop);
205  vtkTextProperty* GetTitleProperties();
207 
209 
214  void SetGridVisibility(int plotType, bool visible);
215  bool GetGridVisibility(int plotType);
217 
219 
223  void SetBackgroundColor(int plotType, const vtkColor4ub& color);
224  vtkColor4ub GetBackgroundColor(int plotType);
226 
228 
232  void SetAxisColor(int plotType, const vtkColor4ub& color);
233  vtkColor4ub GetAxisColor(int plotType);
235 
237 
241  void SetGridColor(int plotType, const vtkColor4ub& color);
242  vtkColor4ub GetGridColor(int plotType);
244 
246 
251  void SetAxisLabelVisibility(int plotType, bool visible);
252  bool GetAxisLabelVisibility(int plotType);
254 
256 
260  void SetAxisLabelProperties(int plotType, vtkTextProperty *prop);
261  vtkTextProperty* GetAxisLabelProperties(int plotType);
263 
265 
269  void SetAxisLabelNotation(int plotType, int notation);
270  int GetAxisLabelNotation(int plotType);
272 
274 
278  void SetAxisLabelPrecision(int plotType, int precision);
279  int GetAxisLabelPrecision(int plotType);
281 
283 
287  void SetTooltipNotation(int plotType, int notation);
288  void SetTooltipPrecision(int plotType, int precision);
289  int GetTooltipNotation(int plotType);
290  int GetTooltipPrecision(int plotType);
292 
296  void SetTooltip(vtkTooltipItem *tooltip);
297 
301  vtkTooltipItem* GetTooltip() const;
302 
306  void SetIndexedLabels(vtkStringArray *labels);
307 
311  vtkStringArray* GetIndexedLabels() const;
312 
314 
317  void SetScatterPlotSelectedRowColumnColor(const vtkColor4ub& color);
318  vtkColor4ub GetScatterPlotSelectedRowColumnColor();
320 
322 
325  void SetScatterPlotSelectedActiveColor(const vtkColor4ub& color);
326  vtkColor4ub GetScatterPlotSelectedActiveColor();
328 
332  void UpdateSettings();
333 
337  void UpdateChartSettings(int plotType);
338 
340 
345  virtual void SetSelectionMode(int);
346  vtkGetMacro(SelectionMode, int);
348 
352  vtkStdString GetColumnName(int column);
353 
357  vtkStdString GetRowName(int row);
358 
363  void SetNumberOfFrames(int frames);
364 
369  int GetNumberOfFrames();
370 
374  void ClearAnimationPath();
375 
381  bool AddAnimationPath(const vtkVector2i &move);
382 
386  vtkIdType GetNumberOfAnimationPathElements();
387 
391  vtkVector2i GetAnimationPathElement(vtkIdType i);
392 
396  bool BeginAnimationPath(vtkRenderWindowInteractor* interactor);
397 
402  virtual void AdvanceAnimation();
403 
407  virtual vtkChart * GetMainChart();
408 
409 protected:
411  ~vtkScatterPlotMatrix() VTK_OVERRIDE;
412 
416  void UpdateLayout();
417 
421  void ResizeBigChart();
422 
424 
427  void AttachAxisRangeListener(vtkAxis*);
428  void AxisRangeForwarderCallback(vtkObject*, unsigned long, void*);
430 
435  void BigChartSelectionCallback(vtkObject*, unsigned long, void*);
436 
442  virtual void UpdateAnimationPath(const vtkVector2i& newActivePos);
443 
448  virtual void StartAnimation(vtkRenderWindowInteractor* interactor);
449 
453  static void ProcessEvents(vtkObject *caller, unsigned long event,
454  void *clientData, void *callerData);
455 
456  // The position of the active plot (defaults to 0, 1).
458 
459  // A flag to show if the ActivePlot vector is valid or not
461 
462  // Weakly owned input data for the scatter plot matrix.
464 
465  // Strongly owned internal data for the column visibility.
467 
468  // The number of bins in the histograms.
470 
471  // The title of the scatter plot matrix.
474 
475  // The mode when the chart is doing selection.
477 
478  // How many frames should animations consist of, 0 means no transitions.
480 
481 private:
482  vtkScatterPlotMatrix(const vtkScatterPlotMatrix &) VTK_DELETE_FUNCTION;
483  void operator=(const vtkScatterPlotMatrix &) VTK_DELETE_FUNCTION;
484 
485  class PIMPL;
486  PIMPL *Private;
487  friend class PIMPL;
488 
489  vtkWeakPointer<vtkContext2D> CurrentPainter;
490  vtkMTimeType LayoutUpdatedTime;
491 
492  // Go through the process of calculating axis ranges, etc...
493  void UpdateAxes();
494  void ApplyAxisSetting(vtkChart *chart, const vtkStdString &x,
495  const vtkStdString &y);
496 };
497 
498 #endif //vtkScatterPlotMatrix_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:41
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
container for a matrix of charts.
virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
Mouse button down event Return true if the item holds the event, false if the event can be propagated...
a vtkAbstractArray subclass for strings
vtkSmartPointer< vtkTextProperty > TitleProperties
int vtkIdType
Definition: vtkType.h:345
void Update() override
Perform any updates to the item that may be necessary before rendering.
platform-independent render window interaction including picking and frame rate control.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
Factory class for drawing 2D charts.
Definition: vtkChart.h:44
takes care of drawing 2D axes
Definition: vtkAxis.h:68
Provides a 2D scene for vtkContextItem objects.
data structure to represent mouse events.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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 bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
represent text properties.
container for a matrix of charts.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:62
static vtkChartMatrix * New()
Creates a new object.
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
vtkSmartPointer< vtkTable > Input
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
vtkNew< vtkStringArray > VisibleColumns
takes care of drawing 2D axes