VTK  9.0.1
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 "vtkChartMatrix.h"
30 #include "vtkChartsCoreModule.h" // For export macro
31 #include "vtkColor.h" // For member function return
32 #include "vtkNew.h" // For ivars
33 #include "vtkSmartPointer.h" // For ivars
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
49  {
53  NOPLOT
54  };
55 
57  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
62  static vtkScatterPlotMatrix* New();
63 
67  void Update() override;
68 
72  bool Paint(vtkContext2D* painter) override;
73 
74  void SetScene(vtkContextScene* scene) override;
75 
81  virtual bool SetActivePlot(const vtkVector2i& position);
82 
86  void SetSize(const vtkVector2i& size) override;
87 
91  virtual vtkVector2i GetActivePlot();
92 
97  vtkAnnotationLink* GetAnnotationLink();
98 
103  virtual void SetInput(vtkTable* table);
104 
108  void SetColumnVisibility(const vtkStdString& name, bool visible);
109 
114  void InsertVisibleColumn(const vtkStdString& name, int index);
115 
119  bool GetColumnVisibility(const vtkStdString& name);
120 
125  void SetColumnVisibilityAll(bool visible);
126 
130  virtual vtkStringArray* GetVisibleColumns();
131 
135  virtual void SetVisibleColumns(vtkStringArray* visColumns);
136 
141  virtual void SetNumberOfBins(int numberOfBins);
142 
147  virtual int GetNumberOfBins() const { return this->NumberOfBins; }
148 
152  void SetPlotColor(int plotType, const vtkColor4ub& color);
153 
157  void SetPlotMarkerStyle(int plotType, int style);
158 
162  void SetPlotMarkerSize(int plotType, float size);
163 
167  bool Hit(const vtkContextMouseEvent& mouse) override;
168 
172  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
173 
177  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
178 
182  bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse) override;
183 
185 
189  int GetPlotType(const vtkVector2i& pos);
190  int GetPlotType(int row, int column);
192 
194 
197  void SetTitle(const vtkStdString& title);
198  vtkStdString GetTitle();
200 
202 
205  void SetTitleProperties(vtkTextProperty* prop);
206  vtkTextProperty* GetTitleProperties();
208 
210 
215  void SetGridVisibility(int plotType, bool visible);
216  bool GetGridVisibility(int plotType);
218 
220 
224  void SetBackgroundColor(int plotType, const vtkColor4ub& color);
225  vtkColor4ub GetBackgroundColor(int plotType);
227 
229 
233  void SetAxisColor(int plotType, const vtkColor4ub& color);
234  vtkColor4ub GetAxisColor(int plotType);
236 
238 
242  void SetGridColor(int plotType, const vtkColor4ub& color);
243  vtkColor4ub GetGridColor(int plotType);
245 
247 
252  void SetAxisLabelVisibility(int plotType, bool visible);
253  bool GetAxisLabelVisibility(int plotType);
255 
257 
261  void SetAxisLabelProperties(int plotType, vtkTextProperty* prop);
262  vtkTextProperty* GetAxisLabelProperties(int plotType);
264 
266 
270  void SetAxisLabelNotation(int plotType, int notation);
271  int GetAxisLabelNotation(int plotType);
273 
275 
279  void SetAxisLabelPrecision(int plotType, int precision);
280  int GetAxisLabelPrecision(int plotType);
282 
284 
288  void SetTooltipNotation(int plotType, int notation);
289  void SetTooltipPrecision(int plotType, int precision);
290  int GetTooltipNotation(int plotType);
291  int GetTooltipPrecision(int plotType);
293 
297  void SetTooltip(vtkTooltipItem* tooltip);
298 
302  vtkTooltipItem* GetTooltip() const;
303 
307  void SetIndexedLabels(vtkStringArray* labels);
308 
312  vtkStringArray* GetIndexedLabels() const;
313 
315 
318  void SetScatterPlotSelectedRowColumnColor(const vtkColor4ub& color);
319  vtkColor4ub GetScatterPlotSelectedRowColumnColor();
321 
323 
326  void SetScatterPlotSelectedActiveColor(const vtkColor4ub& color);
327  vtkColor4ub GetScatterPlotSelectedActiveColor();
329 
333  void UpdateSettings();
334 
338  void UpdateChartSettings(int plotType);
339 
341 
346  virtual void SetSelectionMode(int);
347  vtkGetMacro(SelectionMode, int);
349 
353  vtkStdString GetColumnName(int column);
354 
358  vtkStdString GetRowName(int row);
359 
364  void SetNumberOfFrames(int frames);
365 
370  int GetNumberOfFrames();
371 
375  void ClearAnimationPath();
376 
382  bool AddAnimationPath(const vtkVector2i& move);
383 
387  vtkIdType GetNumberOfAnimationPathElements();
388 
392  vtkVector2i GetAnimationPathElement(vtkIdType i);
393 
397  bool BeginAnimationPath(vtkRenderWindowInteractor* interactor);
398 
403  virtual void AdvanceAnimation();
404 
408  virtual vtkChart* GetMainChart();
409 
410 protected:
412  ~vtkScatterPlotMatrix() override;
413 
417  void UpdateLayout();
418 
422  void ResizeBigChart();
423 
425 
428  void AttachAxisRangeListener(vtkAxis*);
429  void AxisRangeForwarderCallback(vtkObject*, unsigned long, void*);
431 
436  void BigChartSelectionCallback(vtkObject*, unsigned long, void*);
437 
443  virtual void UpdateAnimationPath(const vtkVector2i& newActivePos);
444 
449  virtual void StartAnimation(vtkRenderWindowInteractor* interactor);
450 
454  static void ProcessEvents(
455  vtkObject* caller, unsigned long event, void* clientData, void* callerData);
456 
460  virtual void AddSupplementaryPlot(vtkChart* vtkNotUsed(chart), int vtkNotUsed(plotType),
461  vtkStdString vtkNotUsed(row), vtkStdString vtkNotUsed(column), int vtkNotUsed(plotCorner) = 0)
462  {
463  }
464 
465  // The position of the active plot (defaults to 0, 1).
467 
468  // A flag to show if the ActivePlot vector is valid or not
470 
471  // Weakly owned input data for the scatter plot matrix.
473 
474  // Strongly owned internal data for the column visibility.
476 
477  // The number of bins in the histograms.
479 
480  // The title of the scatter plot matrix.
483 
484  // The mode when the chart is doing selection.
486 
487  // How many frames should animations consist of, 0 means no transitions.
489 
490  // A flag to know if we are animating the scatter plot along an animation path
491  bool Animating;
492 
493 private:
495  void operator=(const vtkScatterPlotMatrix&) = delete;
496 
497  class PIMPL;
498  PIMPL* Private;
499  friend class PIMPL;
500 
501  vtkWeakPointer<vtkContext2D> CurrentPainter;
502  vtkMTimeType LayoutUpdatedTime;
503 
504  // Go through the process of calculating axis ranges, etc...
505  void UpdateAxes();
506  void ApplyAxisSetting(vtkChart* chart, const vtkStdString& x, const vtkStdString& y);
507 };
508 
509 #endif // vtkScatterPlotMatrix_h
vtkChart
Factory class for drawing 2D charts.
Definition: vtkChart.h:44
vtkStdString.h
vtkScatterPlotMatrix::ActivePlotValid
bool ActivePlotValid
Definition: vtkScatterPlotMatrix.h:469
vtkContextMouseEvent
data structure to represent mouse events.
Definition: vtkContextMouseEvent.h:34
vtkScatterPlotMatrix::HISTOGRAM
@ HISTOGRAM
Definition: vtkScatterPlotMatrix.h:51
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:338
vtkScatterPlotMatrix::Title
vtkStdString Title
Definition: vtkScatterPlotMatrix.h:481
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
@ SCATTERPLOT
Definition: vtkScatterPlotMatrix.h:50
vtkX3D::style
@ style
Definition: vtkX3D.h:498
vtkChartMatrix
container for a matrix of charts.
Definition: vtkChartMatrix.h:38
vtkSmartPointer< vtkTable >
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkChartMatrix.h
vtkTooltipItem
takes care of drawing 2D axes
Definition: vtkTooltipItem.h:39
vtkScatterPlotMatrix::SelectionMode
int SelectionMode
Definition: vtkScatterPlotMatrix.h:485
vtkScatterPlotMatrix::VisibleColumns
vtkNew< vtkStringArray > VisibleColumns
Definition: vtkScatterPlotMatrix.h:475
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
vtkScatterPlotMatrix::Animating
bool Animating
Definition: vtkScatterPlotMatrix.h:491
vtkScatterPlotMatrix::TitleProperties
vtkSmartPointer< vtkTextProperty > TitleProperties
Definition: vtkScatterPlotMatrix.h:482
vtkX3D::position
@ position
Definition: vtkX3D.h:267
vtkX3D::color
@ color
Definition: vtkX3D.h:227
vtkX3D::title
@ title
Definition: vtkX3D.h:506
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:460
vtkScatterPlotMatrix::NumberOfFrames
int NumberOfFrames
Definition: vtkScatterPlotMatrix.h:488
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
@ size
Definition: vtkX3D.h:259
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:478
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:82
vtkAbstractContextItem::MouseMoveEvent
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
vtkX3D::name
@ name
Definition: vtkX3D.h:225
vtkAbstractContextItem::MouseButtonReleaseEvent
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
vtkScatterPlotMatrix::Input
vtkSmartPointer< vtkTable > Input
Definition: vtkScatterPlotMatrix.h:472
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:264
vtkScatterPlotMatrix::GetNumberOfBins
virtual int GetNumberOfBins() const
Get the number of bins the histograms along the central diagonal scatter plot matrix.
Definition: vtkScatterPlotMatrix.h:147
vtkScatterPlotMatrix::ACTIVEPLOT
@ ACTIVEPLOT
Definition: vtkScatterPlotMatrix.h:52
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:419
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:34
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkWeakPointer< vtkContext2D >
vtkScatterPlotMatrix::ActivePlot
vtkVector2i ActivePlot
Definition: vtkScatterPlotMatrix.h:466
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293