VTK  9.3.1
vtkScatterPlotMatrix.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
17 #ifndef vtkScatterPlotMatrix_h
18 #define vtkScatterPlotMatrix_h
19 
20 #include "vtkChartMatrix.h"
21 #include "vtkChartsCoreModule.h" // For export macro
22 #include "vtkColor.h" // For member function return
23 #include "vtkNew.h" // For ivars
24 #include "vtkSmartPointer.h" // For ivars
25 #include "vtkStdString.h" // For ivars
26 #include "vtkWeakPointer.h" // For currentPainter
27 
28 VTK_ABI_NAMESPACE_BEGIN
29 class vtkStringArray;
30 class vtkTable;
31 class vtkAxis;
32 class vtkAnnotationLink;
33 class vtkTextProperty;
34 class vtkTooltipItem;
36 
37 class VTKCHARTSCORE_EXPORT vtkScatterPlotMatrix : public vtkChartMatrix
38 {
39 public:
40  enum
41  {
45  NOPLOT
46  };
47 
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
54  static vtkScatterPlotMatrix* New();
55 
59  void Update() override;
60 
64  bool Paint(vtkContext2D* painter) override;
65 
66  void SetScene(vtkContextScene* scene) override;
67 
73  virtual bool SetActivePlot(const vtkVector2i& position);
74 
78  void SetSize(const vtkVector2i& size) override;
79 
83  virtual vtkVector2i GetActivePlot();
84 
89  vtkAnnotationLink* GetAnnotationLink();
90 
95  virtual void SetInput(vtkTable* table);
96 
100  void SetColumnVisibility(const vtkStdString& name, bool visible);
101 
106  void InsertVisibleColumn(const vtkStdString& name, int index);
107 
111  bool GetColumnVisibility(const vtkStdString& name);
112 
117  void SetColumnVisibilityAll(bool visible);
118 
122  virtual vtkStringArray* GetVisibleColumns();
123 
127  virtual void SetVisibleColumns(vtkStringArray* visColumns);
128 
133  virtual void SetNumberOfBins(int numberOfBins);
134 
139  virtual int GetNumberOfBins() const { return this->NumberOfBins; }
140 
144  void SetPlotColor(int plotType, const vtkColor4ub& color);
145 
149  void SetPlotMarkerStyle(int plotType, int style);
150 
154  void SetPlotMarkerSize(int plotType, float size);
155 
159  bool Hit(const vtkContextMouseEvent& mouse) override;
160 
164  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
165 
169  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
170 
174  bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse) override;
175 
177 
181  int GetPlotType(const vtkVector2i& pos);
182  int GetPlotType(int row, int column);
184 
186 
189  void SetTitle(const vtkStdString& title);
190  vtkStdString GetTitle();
192 
194 
197  void SetTitleProperties(vtkTextProperty* prop);
198  vtkTextProperty* GetTitleProperties();
200 
202 
207  void SetGridVisibility(int plotType, bool visible);
208  bool GetGridVisibility(int plotType);
210 
212 
216  void SetBackgroundColor(int plotType, const vtkColor4ub& color);
217  vtkColor4ub GetBackgroundColor(int plotType);
219 
221 
225  void SetAxisColor(int plotType, const vtkColor4ub& color);
226  vtkColor4ub GetAxisColor(int plotType);
228 
230 
234  void SetGridColor(int plotType, const vtkColor4ub& color);
235  vtkColor4ub GetGridColor(int plotType);
237 
239 
244  void SetAxisLabelVisibility(int plotType, bool visible);
245  bool GetAxisLabelVisibility(int plotType);
247 
249 
253  void SetAxisLabelProperties(int plotType, vtkTextProperty* prop);
254  vtkTextProperty* GetAxisLabelProperties(int plotType);
256 
258 
262  void SetAxisLabelNotation(int plotType, int notation);
263  int GetAxisLabelNotation(int plotType);
265 
267 
271  void SetAxisLabelPrecision(int plotType, int precision);
272  int GetAxisLabelPrecision(int plotType);
274 
276 
280  void SetTooltipNotation(int plotType, int notation);
281  void SetTooltipPrecision(int plotType, int precision);
282  int GetTooltipNotation(int plotType);
283  int GetTooltipPrecision(int plotType);
285 
289  void SetTooltip(vtkTooltipItem* tooltip);
290 
294  vtkTooltipItem* GetTooltip() const;
295 
299  void SetIndexedLabels(vtkStringArray* labels);
300 
304  vtkStringArray* GetIndexedLabels() const;
305 
307 
310  void SetScatterPlotSelectedRowColumnColor(const vtkColor4ub& color);
311  vtkColor4ub GetScatterPlotSelectedRowColumnColor();
313 
315 
318  void SetScatterPlotSelectedActiveColor(const vtkColor4ub& color);
319  vtkColor4ub GetScatterPlotSelectedActiveColor();
321 
325  void UpdateSettings();
326 
330  void UpdateChartSettings(int plotType);
331 
333 
338  virtual void SetSelectionMode(int);
339  vtkGetMacro(SelectionMode, int);
341 
345  vtkStdString GetColumnName(int column);
346 
350  vtkStdString GetRowName(int row);
351 
356  void SetNumberOfFrames(int frames);
357 
362  int GetNumberOfFrames();
363 
367  void ClearAnimationPath();
368 
374  bool AddAnimationPath(const vtkVector2i& move);
375 
379  vtkIdType GetNumberOfAnimationPathElements();
380 
384  vtkVector2i GetAnimationPathElement(vtkIdType i);
385 
389  bool BeginAnimationPath(vtkRenderWindowInteractor* interactor);
390 
395  virtual void AdvanceAnimation();
396 
400  virtual vtkChart* GetMainChart();
401 
402 protected:
404  ~vtkScatterPlotMatrix() override;
405 
409  void UpdateLayout();
410 
414  void ResizeBigChart();
415 
417 
420  void AttachAxisRangeListener(vtkAxis*);
421  void AxisRangeForwarderCallback(vtkObject*, unsigned long, void*);
423 
428  void BigChartSelectionCallback(vtkObject*, unsigned long, void*);
429 
435  virtual void UpdateAnimationPath(const vtkVector2i& newActivePos);
436 
441  virtual void StartAnimation(vtkRenderWindowInteractor* interactor);
442 
446  static void ProcessEvents(
447  vtkObject* caller, unsigned long event, void* clientData, void* callerData);
448 
452  virtual void AddSupplementaryPlot(vtkChart* vtkNotUsed(chart), int vtkNotUsed(plotType),
453  vtkStdString vtkNotUsed(row), vtkStdString vtkNotUsed(column), int vtkNotUsed(plotCorner) = 0)
454  {
455  }
456 
457  // The position of the active plot (defaults to 0, 1).
459 
460  // A flag to show if the ActivePlot vector is valid or not
462 
463  // Weakly owned input data for the scatter plot matrix.
465 
466  // Strongly owned internal data for the column visibility.
468 
469  // The number of bins in the histograms.
471 
472  // The title of the scatter plot matrix.
475 
476  // The mode when the chart is doing selection.
478 
479  // How many frames should animations consist of, 0 means no transitions.
481 
482  // A flag to know if we are animating the scatter plot along an animation path
483  bool Animating;
484 
485 private:
487  void operator=(const vtkScatterPlotMatrix&) = delete;
488 
489  class PIMPL;
490  PIMPL* Private;
491  friend class PIMPL;
492 
493  vtkWeakPointer<vtkContext2D> CurrentPainter;
494  vtkMTimeType LayoutUpdatedTime;
495 
496  // Go through the process of calculating axis ranges, etc...
497  void UpdateAxes();
498  void ApplyAxisSetting(vtkChart* chart, const vtkStdString& x, const vtkStdString& y);
499 };
500 
501 VTK_ABI_NAMESPACE_END
502 #endif // vtkScatterPlotMatrix_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:28
bool Paint(vtkContext2D *painter) override
Paint event for the chart matrix.
abstract base class for most VTK objects
Definition: vtkObject.h:51
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
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:315
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:49
Factory class for drawing 2D charts.
Definition: vtkChart.h:40
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:60
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:28
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:440
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:58
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.