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) override;
57 
61  static vtkScatterPlotMatrix *New();
62 
66  void Update() override;
67 
71  bool Paint(vtkContext2D *painter) override;
72 
73  void SetScene(vtkContextScene *scene) override;
74 
80  virtual bool SetActivePlot(const vtkVector2i& position);
81 
85  void SetSize(const vtkVector2i& size) 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) override;
167 
171  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override;
172 
176  bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override;
177 
181  bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) 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() 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 
459  virtual void AddSupplementaryPlot(vtkChart* vtkNotUsed(chart), int vtkNotUsed(plotType),
460  vtkStdString vtkNotUsed(row), vtkStdString vtkNotUsed(column),
461  int vtkNotUsed(plotCorner) = 0){}
462 
463  // The position of the active plot (defaults to 0, 1).
465 
466  // A flag to show if the ActivePlot vector is valid or not
468 
469  // Weakly owned input data for the scatter plot matrix.
471 
472  // Strongly owned internal data for the column visibility.
474 
475  // The number of bins in the histograms.
477 
478  // The title of the scatter plot matrix.
481 
482  // The mode when the chart is doing selection.
484 
485  // How many frames should animations consist of, 0 means no transitions.
487 
488  // A flag to know if we are animating the scatter plot along an animation path
489  bool Animating;
490 
491 private:
492  vtkScatterPlotMatrix(const vtkScatterPlotMatrix &) = delete;
493  void operator=(const vtkScatterPlotMatrix &) = delete;
494 
495  class PIMPL;
496  PIMPL *Private;
497  friend class PIMPL;
498 
499  vtkWeakPointer<vtkContext2D> CurrentPainter;
500  vtkMTimeType LayoutUpdatedTime;
501 
502  // Go through the process of calculating axis ranges, etc...
503  void UpdateAxes();
504  void ApplyAxisSetting(vtkChart *chart, const vtkStdString &x,
505  const vtkStdString &y);
506 };
507 
508 #endif //vtkScatterPlotMatrix_h
vtkChart
Factory class for drawing 2D charts.
Definition: vtkChart.h:44
vtkStdString.h
vtkScatterPlotMatrix::ActivePlotValid
bool ActivePlotValid
Definition: vtkScatterPlotMatrix.h:467
vtkContextMouseEvent
data structure to represent mouse events.
Definition: vtkContextMouseEvent.h:34
vtkScatterPlotMatrix::HISTOGRAM
Definition: vtkScatterPlotMatrix.h:50
vtkChartMatrix::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkScatterPlotMatrix::Title
vtkStdString Title
Definition: vtkScatterPlotMatrix.h:479
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:62
vtkChartMatrix::Paint
bool Paint(vtkContext2D *painter) override
Paint event for the chart matrix.
vtkScatterPlotMatrix::SCATTERPLOT
Definition: vtkScatterPlotMatrix.h:49
vtkX3D::style
Definition: vtkX3D.h:492
vtkChartMatrix
container for a matrix of charts.
Definition: vtkChartMatrix.h:38
vtkSmartPointer< vtkTable >
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkChartMatrix.h
vtkTooltipItem
takes care of drawing 2D axes
Definition: vtkTooltipItem.h:39
vtkScatterPlotMatrix::SelectionMode
int SelectionMode
Definition: vtkScatterPlotMatrix.h:483
vtkScatterPlotMatrix::VisibleColumns
vtkNew< vtkStringArray > VisibleColumns
Definition: vtkScatterPlotMatrix.h:473
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
vtkScatterPlotMatrix::Animating
bool Animating
Definition: vtkScatterPlotMatrix.h:489
vtkScatterPlotMatrix::TitleProperties
vtkSmartPointer< vtkTextProperty > TitleProperties
Definition: vtkScatterPlotMatrix.h:480
vtkX3D::position
Definition: vtkX3D.h:261
vtkX3D::color
Definition: vtkX3D.h:221
vtkX3D::title
Definition: vtkX3D.h:500
vtkContextScene
Provides a 2D scene for vtkContextItem objects.
Definition: vtkContextScene.h:47
vtkChartMatrix::SetSize
virtual void SetSize(const vtkVector2i &size)
Set the width and height of the chart matrix.
vtkScatterPlotMatrix::AddSupplementaryPlot
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.
Definition: vtkScatterPlotMatrix.h:459
vtkScatterPlotMatrix::NumberOfFrames
int NumberOfFrames
Definition: vtkScatterPlotMatrix.h:486
vtkColor.h
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkAbstractContextItem::Hit
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
vtkSmartPointer.h
vtkX3D::size
Definition: vtkX3D.h:253
vtkNew< vtkStringArray >
vtkWeakPointer.h
vtkScatterPlotMatrix
container for a matrix of charts.
Definition: vtkScatterPlotMatrix.h:45
vtkChartMatrix::New
static vtkChartMatrix * New()
Creates a new object.
vtkScatterPlotMatrix::NumberOfBins
int NumberOfBins
Definition: vtkScatterPlotMatrix.h:476
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:72
vtkAbstractContextItem::MouseMoveEvent
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
vtkX3D::name
Definition: vtkX3D.h:219
vtkAbstractContextItem::MouseButtonReleaseEvent
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
vtkScatterPlotMatrix::Input
vtkSmartPointer< vtkTable > Input
Definition: vtkScatterPlotMatrix.h:470
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:33
vtkChartMatrix::Update
void Update() override
Perform any updates to the item that may be necessary before rendering.
vtkNew.h
vtkAbstractContextItem::SetScene
virtual void SetScene(vtkContextScene *scene)
Set the vtkContextScene for the item, always set for an item in a scene.
vtkAxis
takes care of drawing 2D axes
Definition: vtkAxis.h:68
vtkColor4ub
Definition: vtkColor.h:240
vtkScatterPlotMatrix::GetNumberOfBins
virtual int GetNumberOfBins() const
Get the number of bins the histograms along the central diagonal scatter plot matrix.
Definition: vtkScatterPlotMatrix.h:146
vtkScatterPlotMatrix::ACTIVEPLOT
Definition: vtkScatterPlotMatrix.h:51
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:36
vtkAbstractContextItem::MouseButtonPressEvent
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...
vtkVector2i
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:405
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:34
vtkX3D::index
Definition: vtkX3D.h:246
vtkWeakPointer< vtkContext2D >
vtkScatterPlotMatrix::ActivePlot
vtkVector2i ActivePlot
Definition: vtkScatterPlotMatrix.h:464
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302