VTK  9.2.6
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 "vtkChartMatrix.h"
33 #include "vtkChartsCoreModule.h" // For export macro
34 #include "vtkColor.h" // For member function return
35 #include "vtkNew.h" // For ivars
36 #include "vtkSmartPointer.h" // For ivars
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
52  {
56  NOPLOT
57  };
58 
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
65  static vtkScatterPlotMatrix* New();
66 
70  void Update() override;
71 
75  bool Paint(vtkContext2D* painter) override;
76 
77  void SetScene(vtkContextScene* scene) override;
78 
84  virtual bool SetActivePlot(const vtkVector2i& position);
85 
89  void SetSize(const vtkVector2i& size) override;
90 
94  virtual vtkVector2i GetActivePlot();
95 
100  vtkAnnotationLink* GetAnnotationLink();
101 
106  virtual void SetInput(vtkTable* table);
107 
111  void SetColumnVisibility(const vtkStdString& name, bool visible);
112 
117  void InsertVisibleColumn(const vtkStdString& name, int index);
118 
122  bool GetColumnVisibility(const vtkStdString& name);
123 
128  void SetColumnVisibilityAll(bool visible);
129 
133  virtual vtkStringArray* GetVisibleColumns();
134 
138  virtual void SetVisibleColumns(vtkStringArray* visColumns);
139 
144  virtual void SetNumberOfBins(int numberOfBins);
145 
150  virtual int GetNumberOfBins() const { return this->NumberOfBins; }
151 
155  void SetPlotColor(int plotType, const vtkColor4ub& color);
156 
160  void SetPlotMarkerStyle(int plotType, int style);
161 
165  void SetPlotMarkerSize(int plotType, float size);
166 
170  bool Hit(const vtkContextMouseEvent& mouse) override;
171 
175  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
176 
180  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
181 
185  bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse) override;
186 
188 
192  int GetPlotType(const vtkVector2i& pos);
193  int GetPlotType(int row, int column);
195 
197 
200  void SetTitle(const vtkStdString& title);
201  vtkStdString GetTitle();
203 
205 
208  void SetTitleProperties(vtkTextProperty* prop);
209  vtkTextProperty* GetTitleProperties();
211 
213 
218  void SetGridVisibility(int plotType, bool visible);
219  bool GetGridVisibility(int plotType);
221 
223 
227  void SetBackgroundColor(int plotType, const vtkColor4ub& color);
228  vtkColor4ub GetBackgroundColor(int plotType);
230 
232 
236  void SetAxisColor(int plotType, const vtkColor4ub& color);
237  vtkColor4ub GetAxisColor(int plotType);
239 
241 
245  void SetGridColor(int plotType, const vtkColor4ub& color);
246  vtkColor4ub GetGridColor(int plotType);
248 
250 
255  void SetAxisLabelVisibility(int plotType, bool visible);
256  bool GetAxisLabelVisibility(int plotType);
258 
260 
264  void SetAxisLabelProperties(int plotType, vtkTextProperty* prop);
265  vtkTextProperty* GetAxisLabelProperties(int plotType);
267 
269 
273  void SetAxisLabelNotation(int plotType, int notation);
274  int GetAxisLabelNotation(int plotType);
276 
278 
282  void SetAxisLabelPrecision(int plotType, int precision);
283  int GetAxisLabelPrecision(int plotType);
285 
287 
291  void SetTooltipNotation(int plotType, int notation);
292  void SetTooltipPrecision(int plotType, int precision);
293  int GetTooltipNotation(int plotType);
294  int GetTooltipPrecision(int plotType);
296 
300  void SetTooltip(vtkTooltipItem* tooltip);
301 
305  vtkTooltipItem* GetTooltip() const;
306 
310  void SetIndexedLabels(vtkStringArray* labels);
311 
315  vtkStringArray* GetIndexedLabels() const;
316 
318 
321  void SetScatterPlotSelectedRowColumnColor(const vtkColor4ub& color);
322  vtkColor4ub GetScatterPlotSelectedRowColumnColor();
324 
326 
329  void SetScatterPlotSelectedActiveColor(const vtkColor4ub& color);
330  vtkColor4ub GetScatterPlotSelectedActiveColor();
332 
336  void UpdateSettings();
337 
341  void UpdateChartSettings(int plotType);
342 
344 
349  virtual void SetSelectionMode(int);
350  vtkGetMacro(SelectionMode, int);
352 
356  vtkStdString GetColumnName(int column);
357 
361  vtkStdString GetRowName(int row);
362 
367  void SetNumberOfFrames(int frames);
368 
373  int GetNumberOfFrames();
374 
378  void ClearAnimationPath();
379 
385  bool AddAnimationPath(const vtkVector2i& move);
386 
390  vtkIdType GetNumberOfAnimationPathElements();
391 
395  vtkVector2i GetAnimationPathElement(vtkIdType i);
396 
400  bool BeginAnimationPath(vtkRenderWindowInteractor* interactor);
401 
406  virtual void AdvanceAnimation();
407 
411  virtual vtkChart* GetMainChart();
412 
413 protected:
415  ~vtkScatterPlotMatrix() override;
416 
420  void UpdateLayout();
421 
425  void ResizeBigChart();
426 
428 
431  void AttachAxisRangeListener(vtkAxis*);
432  void AxisRangeForwarderCallback(vtkObject*, unsigned long, void*);
434 
439  void BigChartSelectionCallback(vtkObject*, unsigned long, void*);
440 
446  virtual void UpdateAnimationPath(const vtkVector2i& newActivePos);
447 
452  virtual void StartAnimation(vtkRenderWindowInteractor* interactor);
453 
457  static void ProcessEvents(
458  vtkObject* caller, unsigned long event, void* clientData, void* callerData);
459 
463  virtual void AddSupplementaryPlot(vtkChart* vtkNotUsed(chart), int vtkNotUsed(plotType),
464  vtkStdString vtkNotUsed(row), vtkStdString vtkNotUsed(column), int vtkNotUsed(plotCorner) = 0)
465  {
466  }
467 
468  // The position of the active plot (defaults to 0, 1).
470 
471  // A flag to show if the ActivePlot vector is valid or not
473 
474  // Weakly owned input data for the scatter plot matrix.
476 
477  // Strongly owned internal data for the column visibility.
479 
480  // The number of bins in the histograms.
482 
483  // The title of the scatter plot matrix.
486 
487  // The mode when the chart is doing selection.
489 
490  // How many frames should animations consist of, 0 means no transitions.
492 
493  // A flag to know if we are animating the scatter plot along an animation path
494  bool Animating;
495 
496 private:
498  void operator=(const vtkScatterPlotMatrix&) = delete;
499 
500  class PIMPL;
501  PIMPL* Private;
502  friend class PIMPL;
503 
504  vtkWeakPointer<vtkContext2D> CurrentPainter;
505  vtkMTimeType LayoutUpdatedTime;
506 
507  // Go through the process of calculating axis ranges, etc...
508  void UpdateAxes();
509  void ApplyAxisSetting(vtkChart* chart, const vtkStdString& x, const vtkStdString& y);
510 };
511 
512 #endif // vtkScatterPlotMatrix_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
bool Paint(vtkContext2D *painter) override
Paint event for the chart matrix.
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
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:332
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:57
Factory class for drawing 2D charts.
Definition: vtkChart.h:51
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:421
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:73
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.