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 
29 #ifndef vtkScatterPlotMatrix_h
30 #define vtkScatterPlotMatrix_h
31 
32 #include "vtkChartsCoreModule.h" // For export macro
33 #include "vtkChartMatrix.h"
34 #include "vtkSmartPointer.h" // For ivars
35 #include "vtkNew.h" // For ivars
36 #include "vtkColor.h" // For member function return
37 #include "vtkStdString.h" // For ivars
38 #include "vtkWeakPointer.h" // For currentPainter
39 
40 class vtkStringArray;
41 class vtkTable;
42 class vtkAxis;
43 class vtkAnnotationLink;
44 class vtkTextProperty;
45 class vtkTooltipItem;
47 
48 class VTKCHARTSCORE_EXPORT vtkScatterPlotMatrix : public vtkChartMatrix
49 {
50 public:
51  enum {
55  NOPLOT
56  };
57 
59  void PrintSelf(ostream &os, vtkIndent indent) override;
60 
64  static vtkScatterPlotMatrix *New();
65 
69  void Update() override;
70 
74  bool Paint(vtkContext2D *painter) override;
75 
76  void SetScene(vtkContextScene *scene) override;
77 
83  virtual bool SetActivePlot(const vtkVector2i& position);
84 
88  void SetSize(const vtkVector2i& size) override;
89 
93  virtual vtkVector2i GetActivePlot();
94 
99  vtkAnnotationLink* GetAnnotationLink();
100 
105  virtual void SetInput(vtkTable *table);
106 
110  void SetColumnVisibility(const vtkStdString& name, bool visible);
111 
116  void InsertVisibleColumn(const vtkStdString& name, int index);
117 
121  bool GetColumnVisibility(const vtkStdString& name);
122 
127  void SetColumnVisibilityAll(bool visible);
128 
132  virtual vtkStringArray* GetVisibleColumns();
133 
137  virtual void SetVisibleColumns(vtkStringArray* visColumns);
138 
143  virtual void SetNumberOfBins(int numberOfBins);
144 
149  virtual int GetNumberOfBins() const { return this->NumberOfBins; }
150 
154  void SetPlotColor(int plotType, const vtkColor4ub& color);
155 
159  void SetPlotMarkerStyle(int plotType, int style);
160 
164  void SetPlotMarkerSize(int plotType, float size);
165 
169  bool Hit(const vtkContextMouseEvent &mouse) override;
170 
174  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override;
175 
179  bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override;
180 
184  bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override;
185 
187 
191  int GetPlotType(const vtkVector2i &pos);
192  int GetPlotType(int row, int column);
194 
196 
199  void SetTitle(const vtkStdString& title);
200  vtkStdString GetTitle();
202 
204 
207  void SetTitleProperties(vtkTextProperty *prop);
208  vtkTextProperty* GetTitleProperties();
210 
212 
217  void SetGridVisibility(int plotType, bool visible);
218  bool GetGridVisibility(int plotType);
220 
222 
226  void SetBackgroundColor(int plotType, const vtkColor4ub& color);
227  vtkColor4ub GetBackgroundColor(int plotType);
229 
231 
235  void SetAxisColor(int plotType, const vtkColor4ub& color);
236  vtkColor4ub GetAxisColor(int plotType);
238 
240 
244  void SetGridColor(int plotType, const vtkColor4ub& color);
245  vtkColor4ub GetGridColor(int plotType);
247 
249 
254  void SetAxisLabelVisibility(int plotType, bool visible);
255  bool GetAxisLabelVisibility(int plotType);
257 
259 
263  void SetAxisLabelProperties(int plotType, vtkTextProperty *prop);
264  vtkTextProperty* GetAxisLabelProperties(int plotType);
266 
268 
272  void SetAxisLabelNotation(int plotType, int notation);
273  int GetAxisLabelNotation(int plotType);
275 
277 
281  void SetAxisLabelPrecision(int plotType, int precision);
282  int GetAxisLabelPrecision(int plotType);
284 
286 
290  void SetTooltipNotation(int plotType, int notation);
291  void SetTooltipPrecision(int plotType, int precision);
292  int GetTooltipNotation(int plotType);
293  int GetTooltipPrecision(int plotType);
295 
299  void SetTooltip(vtkTooltipItem *tooltip);
300 
304  vtkTooltipItem* GetTooltip() const;
305 
309  void SetIndexedLabels(vtkStringArray *labels);
310 
314  vtkStringArray* GetIndexedLabels() const;
315 
317 
320  void SetScatterPlotSelectedRowColumnColor(const vtkColor4ub& color);
321  vtkColor4ub GetScatterPlotSelectedRowColumnColor();
323 
325 
328  void SetScatterPlotSelectedActiveColor(const vtkColor4ub& color);
329  vtkColor4ub GetScatterPlotSelectedActiveColor();
331 
335  void UpdateSettings();
336 
340  void UpdateChartSettings(int plotType);
341 
343 
348  virtual void SetSelectionMode(int);
349  vtkGetMacro(SelectionMode, int);
351 
355  vtkStdString GetColumnName(int column);
356 
360  vtkStdString GetRowName(int row);
361 
366  void SetNumberOfFrames(int frames);
367 
372  int GetNumberOfFrames();
373 
377  void ClearAnimationPath();
378 
384  bool AddAnimationPath(const vtkVector2i &move);
385 
389  vtkIdType GetNumberOfAnimationPathElements();
390 
394  vtkVector2i GetAnimationPathElement(vtkIdType i);
395 
399  bool BeginAnimationPath(vtkRenderWindowInteractor* interactor);
400 
405  virtual void AdvanceAnimation();
406 
410  virtual vtkChart * GetMainChart();
411 
412 protected:
414  ~vtkScatterPlotMatrix() override;
415 
419  void UpdateLayout();
420 
424  void ResizeBigChart();
425 
427 
430  void AttachAxisRangeListener(vtkAxis*);
431  void AxisRangeForwarderCallback(vtkObject*, unsigned long, void*);
433 
438  void BigChartSelectionCallback(vtkObject*, unsigned long, void*);
439 
445  virtual void UpdateAnimationPath(const vtkVector2i& newActivePos);
446 
451  virtual void StartAnimation(vtkRenderWindowInteractor* interactor);
452 
456  static void ProcessEvents(vtkObject *caller, unsigned long event,
457  void *clientData, void *callerData);
458 
462  virtual void AddSupplementaryPlot(vtkChart* vtkNotUsed(chart), int vtkNotUsed(plotType),
463  vtkStdString vtkNotUsed(row), vtkStdString vtkNotUsed(column),
464  int vtkNotUsed(plotCorner) = 0){}
465 
466  // The position of the active plot (defaults to 0, 1).
468 
469  // A flag to show if the ActivePlot vector is valid or not
471 
472  // Weakly owned input data for the scatter plot matrix.
474 
475  // Strongly owned internal data for the column visibility.
477 
478  // The number of bins in the histograms.
480 
481  // The title of the scatter plot matrix.
484 
485  // The mode when the chart is doing selection.
487 
488  // How many frames should animations consist of, 0 means no transitions.
490 
491  // A flag to know if we are animating the scatter plot along an animation path
492  bool Animating;
493 
494 private:
495  vtkScatterPlotMatrix(const vtkScatterPlotMatrix &) = delete;
496  void operator=(const vtkScatterPlotMatrix &) = delete;
497 
498  class PIMPL;
499  PIMPL *Private;
500  friend class PIMPL;
501 
502  vtkWeakPointer<vtkContext2D> CurrentPainter;
503  vtkMTimeType LayoutUpdatedTime;
504 
505  // Go through the process of calculating axis ranges, etc...
506  void UpdateAxes();
507  void ApplyAxisSetting(vtkChart *chart, const vtkStdString &x,
508  const vtkStdString &y);
509 };
510 
511 #endif //vtkScatterPlotMatrix_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
bool Paint(vtkContext2D *painter) override
Paint event for the chart matrix.
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
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:347
virtual void AddSupplementaryPlot(vtkChart *vtkNotUsed(chart), int vtkNotUsed(plotType), vtkStdString vtkNotUsed(row), vtkStdString vtkNotUsed(column), int vtkNotUsed(plotCorner)=0)
Called when drawing a chart, does nothing at this level.
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:58
Factory class for drawing 2D charts.
Definition: vtkChart.h:50
virtual void SetScene(vtkContextScene *scene)
Set the vtkContextScene for the item, always set for an item in a scene.
takes care of drawing 2D axes
Definition: vtkAxis.h:71
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:39
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:408
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
virtual void SetSize(const vtkVector2i &size)
Set the width and height of the chart matrix.
represent text properties.
container for a matrix of charts.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:68
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
virtual int GetNumberOfBins() const
Get the number of bins the histograms along the central diagonal scatter plot matrix.