VTK  9.7.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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkStringArray;
31 class vtkTable;
32 class vtkAxis;
33 class vtkAnnotationLink;
34 class vtkTextProperty;
35 class vtkTooltipItem;
37 
38 class VTKCHARTSCORE_EXPORT VTK_MARSHALAUTO vtkScatterPlotMatrix : public vtkChartMatrix
39 {
40 public:
41  enum
42  {
46  NOPLOT
47  };
48 
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
55  static vtkScatterPlotMatrix* New();
56 
60  void Update() override;
61 
65  bool Paint(vtkContext2D* painter) override;
66 
67  void SetScene(vtkContextScene* scene) override;
68 
74  virtual bool SetActivePlot(const vtkVector2i& position);
75 
79  void SetSize(const vtkVector2i& size) override;
80 
84  virtual vtkVector2i GetActivePlot();
85 
90  vtkAnnotationLink* GetAnnotationLink();
91 
96  virtual void SetInput(vtkTable* table);
97 
101  void SetColumnVisibility(const vtkStdString& name, bool visible);
102 
107  void InsertVisibleColumn(const vtkStdString& name, int index);
108 
112  bool GetColumnVisibility(const vtkStdString& name);
113 
118  void SetColumnVisibilityAll(bool visible);
119 
123  virtual vtkStringArray* GetVisibleColumns();
124 
128  virtual void SetVisibleColumns(vtkStringArray* visColumns);
129 
134  virtual void SetNumberOfBins(int numberOfBins);
135 
140  virtual int GetNumberOfBins() const { return this->NumberOfBins; }
141 
145  void SetPlotColor(int plotType, const vtkColor4ub& color);
146 
150  void SetPlotMarkerStyle(int plotType, int style);
151 
155  void SetPlotMarkerSize(int plotType, float size);
156 
160  bool Hit(const vtkContextMouseEvent& mouse) override;
161 
165  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
166 
170  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
171 
175  bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse) override;
176 
178 
182  int GetPlotType(const vtkVector2i& pos);
183  int GetPlotType(int row, int column);
185 
187 
190  void SetTitle(const vtkStdString& title);
191  vtkStdString GetTitle();
193 
195 
198  void SetTitleProperties(vtkTextProperty* prop);
199  vtkTextProperty* GetTitleProperties();
201 
203 
208  void SetGridVisibility(int plotType, bool visible);
209  bool GetGridVisibility(int plotType);
211 
213 
217  void SetBackgroundColor(int plotType, const vtkColor4ub& color);
218  vtkColor4ub GetBackgroundColor(int plotType);
220 
222 
226  void SetAxisColor(int plotType, const vtkColor4ub& color);
227  vtkColor4ub GetAxisColor(int plotType);
229 
231 
235  void SetGridColor(int plotType, const vtkColor4ub& color);
236  vtkColor4ub GetGridColor(int plotType);
238 
240 
245  void SetAxisLabelVisibility(int plotType, bool visible);
246  bool GetAxisLabelVisibility(int plotType);
248 
250 
254  void SetAxisLabelProperties(int plotType, vtkTextProperty* prop);
255  vtkTextProperty* GetAxisLabelProperties(int plotType);
257 
259 
263  void SetAxisLabelNotation(int plotType, int notation);
264  int GetAxisLabelNotation(int plotType);
266 
268 
272  void SetAxisLabelPrecision(int plotType, int precision);
273  int GetAxisLabelPrecision(int plotType);
275 
277 
281  void SetTooltipNotation(int plotType, int notation);
282  void SetTooltipPrecision(int plotType, int precision);
283  int GetTooltipNotation(int plotType);
284  int GetTooltipPrecision(int plotType);
286 
290  void SetTooltip(vtkTooltipItem* tooltip);
291 
295  vtkTooltipItem* GetTooltip() const;
296 
300  void SetIndexedLabels(vtkStringArray* labels);
301 
305  vtkStringArray* GetIndexedLabels() const;
306 
308 
311  void SetScatterPlotSelectedRowColumnColor(const vtkColor4ub& color);
312  vtkColor4ub GetScatterPlotSelectedRowColumnColor();
314 
316 
319  void SetScatterPlotSelectedActiveColor(const vtkColor4ub& color);
320  vtkColor4ub GetScatterPlotSelectedActiveColor();
322 
326  void UpdateSettings();
327 
331  void UpdateChartSettings(int plotType);
332 
334 
339  virtual void SetSelectionMode(int);
340  vtkGetMacro(SelectionMode, int);
342 
346  vtkStdString GetColumnName(int column);
347 
351  vtkStdString GetRowName(int row);
352 
357  void SetNumberOfFrames(int frames);
358 
363  int GetNumberOfFrames();
364 
368  void ClearAnimationPath();
369 
375  bool AddAnimationPath(const vtkVector2i& move);
376 
380  vtkIdType GetNumberOfAnimationPathElements();
381 
385  vtkVector2i GetAnimationPathElement(vtkIdType i);
386 
390  bool BeginAnimationPath(vtkRenderWindowInteractor* interactor);
391 
396  virtual void AdvanceAnimation();
397 
401  virtual vtkChart* GetMainChart();
402 
403 protected:
405  ~vtkScatterPlotMatrix() override;
406 
410  void UpdateLayout();
411 
415  void ResizeBigChart();
416 
418 
421  void AttachAxisRangeListener(vtkAxis*);
422  void AxisRangeForwarderCallback(vtkObject*, unsigned long, void*);
424 
429  void BigChartSelectionCallback(vtkObject*, unsigned long, void*);
430 
436  virtual void UpdateAnimationPath(const vtkVector2i& newActivePos);
437 
442  virtual void StartAnimation(vtkRenderWindowInteractor* interactor);
443 
447  static void ProcessEvents(
448  vtkObject* caller, unsigned long event, void* clientData, void* callerData);
449 
453  virtual void AddSupplementaryPlot(vtkChart* vtkNotUsed(chart), int vtkNotUsed(plotType),
454  vtkStdString vtkNotUsed(row), vtkStdString vtkNotUsed(column), int vtkNotUsed(plotCorner) = 0)
455  {
456  }
457 
458  // The position of the active plot (defaults to 0, 1).
460 
461  // A flag to show if the ActivePlot vector is valid or not
463 
464  // Weakly owned input data for the scatter plot matrix.
466 
467  // Strongly owned internal data for the column visibility.
469 
470  // The number of bins in the histograms.
472 
473  // The title of the scatter plot matrix.
476 
477  // The mode when the chart is doing selection.
479 
480  // How many frames should animations consist of, 0 means no transitions.
482 
483  // A flag to know if we are animating the scatter plot along an animation path
484  bool Animating;
485 
486 private:
488  void operator=(const vtkScatterPlotMatrix&) = delete;
489 
490  class PIMPL;
491  PIMPL* Private;
492  friend class PIMPL;
493 
494  vtkWeakPointer<vtkContext2D> CurrentPainter;
495  vtkMTimeType LayoutUpdatedTime;
496 
497  // Go through the process of calculating axis ranges, etc...
498  void UpdateAxes();
499  void ApplyAxisSetting(vtkChart* chart, const vtkStdString& x, const vtkStdString& y);
500 };
501 
502 VTK_ABI_NAMESPACE_END
503 #endif // vtkScatterPlotMatrix_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:27
bool Paint(vtkContext2D *painter) override
Paint event for the chart matrix.
abstract base class for most VTK objects
Definition: vtkObject.h:52
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
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:363
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:41
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:61
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:410
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
virtual void AddSupplementaryPlot(vtkChart *chart, int plotType, vtkStdString row, vtkStdString column, int plotCorner=0)
Called when drawing a chart, does nothing at this level.
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:59
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
#define VTK_MARSHALAUTO
takes care of drawing 2D axes
virtual int GetNumberOfBins() const
Get the number of bins the histograms along the central diagonal scatter plot matrix.