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 
29 #ifndef vtkScatterPlotMatrix_h
30 #define vtkScatterPlotMatrix_h
31 
32 #include "vtkChartsCoreModule.h" // For export macro
33 #include "vtkChartMatrix.h"
34 #include "vtkSmartPointer.h" // For ivars
35 #include "vtkNew.h" // For ivars
36 #include "vtkColor.h" // For member function return
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 {
55  NOPLOT
56  };
57 
59  void PrintSelf(ostream &os, vtkIndent indent) override;
60 
65 
69  void Update() override;
70 
74  bool Paint(vtkContext2D *painter) override;
75 
76  void SetScene(vtkContextScene *scene) override;
77 
83  virtual bool SetActivePlot(const vtkVector2i& position);
84 
88  void SetSize(const vtkVector2i& size) override;
89 
94 
100 
105  virtual void SetInput(vtkTable *table);
106 
110  void SetColumnVisibility(const vtkStdString& name, bool visible);
111 
117 
122 
127  void SetColumnVisibilityAll(bool visible);
128 
133 
137  virtual void SetVisibleColumns(vtkStringArray* visColumns);
138 
143  virtual void SetNumberOfBins(int numberOfBins);
144 
149  virtual int GetNumberOfBins() const { return this->NumberOfBins; }
150 
154  void SetPlotColor(int plotType, const vtkColor4ub& color);
155 
159  void SetPlotMarkerStyle(int plotType, int style);
160 
164  void SetPlotMarkerSize(int plotType, float size);
165 
169  bool Hit(const vtkContextMouseEvent &mouse) override;
170 
174  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override;
175 
179  bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override;
180 
184  bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override;
185 
187 
191  int GetPlotType(const vtkVector2i &pos);
192  int GetPlotType(int row, int column);
194 
196 
202 
204 
210 
212 
217  void SetGridVisibility(int plotType, bool visible);
218  bool GetGridVisibility(int plotType);
220 
222 
226  void SetBackgroundColor(int plotType, const vtkColor4ub& color);
229 
231 
235  void SetAxisColor(int plotType, const vtkColor4ub& color);
236  vtkColor4ub GetAxisColor(int plotType);
238 
240 
244  void SetGridColor(int plotType, const vtkColor4ub& color);
245  vtkColor4ub GetGridColor(int plotType);
247 
249 
254  void SetAxisLabelVisibility(int plotType, bool visible);
255  bool GetAxisLabelVisibility(int plotType);
257 
259 
263  void SetAxisLabelProperties(int plotType, vtkTextProperty *prop);
266 
268 
272  void SetAxisLabelNotation(int plotType, int notation);
273  int GetAxisLabelNotation(int plotType);
275 
277 
281  void SetAxisLabelPrecision(int plotType, int precision);
282  int GetAxisLabelPrecision(int plotType);
284 
286 
290  void SetTooltipNotation(int plotType, int notation);
291  void SetTooltipPrecision(int plotType, int precision);
292  int GetTooltipNotation(int plotType);
293  int GetTooltipPrecision(int plotType);
295 
299  void SetTooltip(vtkTooltipItem *tooltip);
300 
305 
310 
315 
317 
323 
325 
331 
336 
340  void UpdateChartSettings(int plotType);
341 
343 
348  virtual void SetSelectionMode(int);
349  vtkGetMacro(SelectionMode, int);
351 
356 
361 
366  void SetNumberOfFrames(int frames);
367 
373 
378 
384  bool AddAnimationPath(const vtkVector2i &move);
385 
390 
395 
400 
405  virtual void AdvanceAnimation();
406 
410  virtual vtkChart * GetMainChart();
411 
412 protected:
415 
419  void UpdateLayout();
420 
425 
427 
431  void AxisRangeForwarderCallback(vtkObject*, unsigned long, void*);
433 
438  void BigChartSelectionCallback(vtkObject*, unsigned long, void*);
439 
445  virtual void UpdateAnimationPath(const vtkVector2i& newActivePos);
446 
451  virtual void StartAnimation(vtkRenderWindowInteractor* interactor);
452 
456  static void ProcessEvents(vtkObject *caller, unsigned long event,
457  void *clientData, void *callerData);
458 
462  virtual void AddSupplementaryPlot(vtkChart* vtkNotUsed(chart), int vtkNotUsed(plotType),
463  vtkStdString vtkNotUsed(row), vtkStdString vtkNotUsed(column),
464  int vtkNotUsed(plotCorner) = 0){}
465 
466  // The position of the active plot (defaults to 0, 1).
468 
469  // A flag to show if the ActivePlot vector is valid or not
471 
472  // Weakly owned input data for the scatter plot matrix.
474 
475  // Strongly owned internal data for the column visibility.
477 
478  // The number of bins in the histograms.
480 
481  // The title of the scatter plot matrix.
484 
485  // The mode when the chart is doing selection.
487 
488  // How many frames should animations consist of, 0 means no transitions.
490 
491  // A flag to know if we are animating the scatter plot along an animation path
492  bool Animating;
493 
494 private:
495  vtkScatterPlotMatrix(const vtkScatterPlotMatrix &) = delete;
496  void operator=(const vtkScatterPlotMatrix &) = delete;
497 
498  class PIMPL;
499  PIMPL *Private;
500  friend class PIMPL;
501 
502  vtkWeakPointer<vtkContext2D> CurrentPainter;
503  vtkMTimeType LayoutUpdatedTime;
504 
505  // Go through the process of calculating axis ranges, etc...
506  void UpdateAxes();
507  void ApplyAxisSetting(vtkChart *chart, const vtkStdString &x,
508  const vtkStdString &y);
509 };
510 
511 #endif //vtkScatterPlotMatrix_h
vtkChart
Factory class for drawing 2D charts.
Definition: vtkChart.h:51
vtkStdString.h
vtkScatterPlotMatrix::SetIndexedLabels
void SetIndexedLabels(vtkStringArray *labels)
Set indexed labels array.
vtkScatterPlotMatrix::SetInput
virtual void SetInput(vtkTable *table)
Set the input table for the scatter plot matrix.
vtkScatterPlotMatrix::ActivePlotValid
bool ActivePlotValid
Definition: vtkScatterPlotMatrix.h:470
vtkContextMouseEvent
data structure to represent mouse events.
Definition: vtkContextMouseEvent.h:41
vtkScatterPlotMatrix::GetActivePlot
virtual vtkVector2i GetActivePlot()
Get the position of the active plot.
vtkScatterPlotMatrix::GetColumnVisibility
bool GetColumnVisibility(const vtkStdString &name)
Get the visibility of the specified column.
vtkScatterPlotMatrix::GetTooltip
vtkTooltipItem * GetTooltip() const
Get the vtkTooltipItem object that will be displayed by the active chart.
vtkScatterPlotMatrix::UpdateChartSettings
void UpdateChartSettings(int plotType)
Update charts based on settings given the plot type.
vtkScatterPlotMatrix::GetGridVisibility
bool GetGridVisibility(int plotType)
vtkScatterPlotMatrix::ResizeBigChart
void ResizeBigChart()
Compute and set big chart resize.
vtkScatterPlotMatrix::GetAxisLabelVisibility
bool GetAxisLabelVisibility(int plotType)
vtkScatterPlotMatrix::New
static vtkScatterPlotMatrix * New()
Creates a new object.
vtkScatterPlotMatrix::SetSelectionMode
virtual void SetSelectionMode(int)
Set/get the Selection Mode that will be used by the chart while doing selection.
vtkScatterPlotMatrix::SetScatterPlotSelectedRowColumnColor
void SetScatterPlotSelectedRowColumnColor(const vtkColor4ub &color)
Set the scatter plot selected row/column charts' background color.
vtkScatterPlotMatrix::Paint
bool Paint(vtkContext2D *painter) override
Paint event for the chart matrix.
vtkScatterPlotMatrix::SetTitleProperties
void SetTitleProperties(vtkTextProperty *prop)
Set/get the text properties for the chart title, i.e.
vtkScatterPlotMatrix::MouseButtonPressEvent
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse button down event.
vtkScatterPlotMatrix::SetColumnVisibility
void SetColumnVisibility(const vtkStdString &name, bool visible)
Set the visibility of the specified column.
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkScatterPlotMatrix::Title
vtkStdString Title
Definition: vtkScatterPlotMatrix.h:482
vtkScatterPlotMatrix::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkScatterPlotMatrix::MouseButtonReleaseEvent
bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override
Mouse button release event.
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:69
vtkScatterPlotMatrix::ClearAnimationPath
void ClearAnimationPath()
Clear the animation path.
vtkScatterPlotMatrix::SetAxisLabelVisibility
void SetAxisLabelVisibility(int plotType, bool visible)
Sets whether or not the labels for the axes are visible, given a plot type, which refers to vtkScatte...
vtkX3D::style
@ style
Definition: vtkX3D.h:492
vtkChartMatrix
container for a matrix of charts.
Definition: vtkChartMatrix.h:42
vtkScatterPlotMatrix::UpdateLayout
void UpdateLayout()
Internal helper to do the layout of the charts in the scatter plot matrix.
vtkSmartPointer< vtkTable >
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkChartMatrix.h
vtkScatterPlotMatrix::SetBackgroundColor
void SetBackgroundColor(int plotType, const vtkColor4ub &color)
Sets the background color for the chart given a plot type, which refers to vtkScatterPlotMatrix::{SCA...
vtkScatterPlotMatrix::GetScatterPlotSelectedActiveColor
vtkColor4ub GetScatterPlotSelectedActiveColor()
vtkTooltipItem
takes care of drawing 2D axes
Definition: vtkTooltipItem.h:40
vtkScatterPlotMatrix::GetNumberOfFrames
int GetNumberOfFrames()
Get the number of animation frames in each transition.
vtkScatterPlotMatrix::UpdateSettings
void UpdateSettings()
Convenient method to update all the chart settings.
vtkScatterPlotMatrix::SelectionMode
int SelectionMode
Definition: vtkScatterPlotMatrix.h:486
vtkScatterPlotMatrix::VisibleColumns
vtkNew< vtkStringArray > VisibleColumns
Definition: vtkScatterPlotMatrix.h:476
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:59
vtkScatterPlotMatrix::AddAnimationPath
bool AddAnimationPath(const vtkVector2i &move)
Add a move to the animation path.
vtkScatterPlotMatrix::SetGridColor
void SetGridColor(int plotType, const vtkColor4ub &color)
Sets the color for the axes given a plot type, which refers to vtkScatterPlotMatrix::{SCATTERPLOT,...
vtkScatterPlotMatrix::GetScatterPlotSelectedRowColumnColor
vtkColor4ub GetScatterPlotSelectedRowColumnColor()
vtkScatterPlotMatrix::GetIndexedLabels
vtkStringArray * GetIndexedLabels() const
Get the indexed labels array.
vtkScatterPlotMatrix::GetMainChart
virtual vtkChart * GetMainChart()
Get the main plot (the one in the top-right of the matrix.
vtkScatterPlotMatrix::AdvanceAnimation
virtual void AdvanceAnimation()
Advance the animation in response to the timer events.
vtkScatterPlotMatrix::SetPlotColor
void SetPlotColor(int plotType, const vtkColor4ub &color)
Set the color for the specified plotType.
vtkScatterPlotMatrix::vtkScatterPlotMatrix
vtkScatterPlotMatrix()
vtkScatterPlotMatrix::Animating
bool Animating
Definition: vtkScatterPlotMatrix.h:492
vtkScatterPlotMatrix::SetNumberOfFrames
void SetNumberOfFrames(int frames)
Set the number of animation frames in each transition.
vtkScatterPlotMatrix::GetVisibleColumns
virtual vtkStringArray * GetVisibleColumns()
Get a list of the columns, and the order in which they are displayed.
vtkScatterPlotMatrix::GetNumberOfAnimationPathElements
vtkIdType GetNumberOfAnimationPathElements()
Get the number of elements (transitions) in the animation path.
vtkScatterPlotMatrix::SetTooltipNotation
void SetTooltipNotation(int plotType, int notation)
Set chart's tooltip notation and precision, given a plot type, which refers to vtkScatterPlotMatrix::...
vtkScatterPlotMatrix::TitleProperties
vtkSmartPointer< vtkTextProperty > TitleProperties
Definition: vtkScatterPlotMatrix.h:483
vtkScatterPlotMatrix::SetAxisColor
void SetAxisColor(int plotType, const vtkColor4ub &color)
Sets the color for the axes given a plot type, which refers to vtkScatterPlotMatrix::{SCATTERPLOT,...
vtkScatterPlotMatrix::GetAxisColor
vtkColor4ub GetAxisColor(int plotType)
vtkX3D::position
@ position
Definition: vtkX3D.h:261
vtkScatterPlotMatrix::BigChartSelectionCallback
void BigChartSelectionCallback(vtkObject *, unsigned long, void *)
The callback function when SelectionChangedEvent is invoked from the Big chart.
vtkX3D::color
@ color
Definition: vtkX3D.h:221
vtkScatterPlotMatrix::SetTooltip
void SetTooltip(vtkTooltipItem *tooltip)
Set the vtkTooltipItem object that will be displayed by the active chart.
vtkX3D::title
@ title
Definition: vtkX3D.h:500
vtkScatterPlotMatrix::~vtkScatterPlotMatrix
~vtkScatterPlotMatrix() override
vtkContextScene
Provides a 2D scene for vtkContextItem objects.
Definition: vtkContextScene.h:51
vtkScatterPlotMatrix::GetAxisLabelNotation
int GetAxisLabelNotation(int plotType)
vtkScatterPlotMatrix::ProcessEvents
static void ProcessEvents(vtkObject *caller, unsigned long event, void *clientData, void *callerData)
Process events and dispatch to the appropriate member functions.
vtkScatterPlotMatrix::GetTooltipPrecision
int GetTooltipPrecision(int plotType)
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:462
vtkScatterPlotMatrix::NumberOfFrames
int NumberOfFrames
Definition: vtkScatterPlotMatrix.h:489
vtkScatterPlotMatrix::SetPlotMarkerStyle
void SetPlotMarkerStyle(int plotType, int style)
Sets the marker style for the specified plotType.
vtkColor.h
vtkScatterPlotMatrix::BeginAnimationPath
bool BeginAnimationPath(vtkRenderWindowInteractor *interactor)
Trigger the animation of the scatter plot matrix to begin.
vtkScatterPlotMatrix::ACTIVEPLOT
@ ACTIVEPLOT
Definition: vtkScatterPlotMatrix.h:54
vtkScatterPlotMatrix::SetColumnVisibilityAll
void SetColumnVisibilityAll(bool visible)
Set the visibility of all columns (true will make them all visible, false will remove all visible col...
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkScatterPlotMatrix::SetAxisLabelPrecision
void SetAxisLabelPrecision(int plotType, int precision)
Sets the axis label precision for the axes given a plot type, which refers to vtkScatterPlotMatrix::{...
vtkScatterPlotMatrix::GetPlotType
int GetPlotType(int row, int column)
vtkScatterPlotMatrix::GetTitle
vtkStdString GetTitle()
vtkScatterPlotMatrix::SetScatterPlotSelectedActiveColor
void SetScatterPlotSelectedActiveColor(const vtkColor4ub &color)
Set the scatter plot selected active chart background color.
vtkScatterPlotMatrix::SetGridVisibility
void SetGridVisibility(int plotType, bool visible)
Sets whether or not the grid for the given axis is visible given a plot type, which refers to vtkScat...
vtkScatterPlotMatrix::SetNumberOfBins
virtual void SetNumberOfBins(int numberOfBins)
Set the number of bins in the histograms along the central diagonal of the scatter plot matrix.
vtkScatterPlotMatrix::SetActivePlot
virtual bool SetActivePlot(const vtkVector2i &position)
Set the active plot, the one that will be displayed in the top-right.
vtkScatterPlotMatrix::HISTOGRAM
@ HISTOGRAM
Definition: vtkScatterPlotMatrix.h:53
vtkSmartPointer.h
vtkScatterPlotMatrix::MouseMoveEvent
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkNew< vtkStringArray >
vtkScatterPlotMatrix::AxisRangeForwarderCallback
void AxisRangeForwarderCallback(vtkObject *, unsigned long, void *)
vtkScatterPlotMatrix::GetGridColor
vtkColor4ub GetGridColor(int plotType)
vtkWeakPointer.h
vtkScatterPlotMatrix
container for a matrix of charts.
Definition: vtkScatterPlotMatrix.h:49
vtkScatterPlotMatrix::SetSize
void SetSize(const vtkVector2i &size) override
Reset ActivePlotSet flag and call superclass method.
vtkScatterPlotMatrix::GetColumnName
vtkStdString GetColumnName(int column)
Get the column name for the supplied index.
vtkScatterPlotMatrix::SetTooltipPrecision
void SetTooltipPrecision(int plotType, int precision)
vtkScatterPlotMatrix::NumberOfBins
int NumberOfBins
Definition: vtkScatterPlotMatrix.h:479
vtkScatterPlotMatrix::Update
void Update() override
Perform any updates to the item that may be necessary before rendering.
vtkScatterPlotMatrix::StartAnimation
virtual void StartAnimation(vtkRenderWindowInteractor *interactor)
Given the render window interactor, start animation of the animation path calculated above.
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:79
vtkScatterPlotMatrix::SetTitle
void SetTitle(const vtkStdString &title)
Set/get the scatter plot title.
vtkScatterPlotMatrix::GetAxisLabelProperties
vtkTextProperty * GetAxisLabelProperties(int plotType)
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkScatterPlotMatrix::Input
vtkSmartPointer< vtkTable > Input
Definition: vtkScatterPlotMatrix.h:473
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:40
vtkScatterPlotMatrix::GetAnnotationLink
vtkAnnotationLink * GetAnnotationLink()
Get the AnnotationLink for the scatter plot matrix, this gives you access to the currently selected p...
vtkScatterPlotMatrix::GetTitleProperties
vtkTextProperty * GetTitleProperties()
vtkScatterPlotMatrix::GetTooltipNotation
int GetTooltipNotation(int plotType)
vtkNew.h
vtkAxis
takes care of drawing 2D axes
Definition: vtkAxis.h:72
vtkScatterPlotMatrix::GetBackgroundColor
vtkColor4ub GetBackgroundColor(int plotType)
vtkColor4ub
Definition: vtkColor.h:241
vtkScatterPlotMatrix::GetNumberOfBins
virtual int GetNumberOfBins() const
Get the number of bins the histograms along the central diagonal scatter plot matrix.
Definition: vtkScatterPlotMatrix.h:149
vtkScatterPlotMatrix::Hit
bool Hit(const vtkContextMouseEvent &mouse) override
Return true if the supplied x, y coordinate is inside the item.
vtkScatterPlotMatrix::SetVisibleColumns
virtual void SetVisibleColumns(vtkStringArray *visColumns)
Set the list of visible columns, and the order in which they will be displayed.
vtkScatterPlotMatrix::GetPlotType
int GetPlotType(const vtkVector2i &pos)
Returns the type of the plot at the given position.
vtkScatterPlotMatrix::GetRowName
vtkStdString GetRowName(int row)
Get the column name for the supplied index.
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:43
vtkScatterPlotMatrix::SetPlotMarkerSize
void SetPlotMarkerSize(int plotType, float size)
Sets the marker size for the specified plotType.
vtkScatterPlotMatrix::UpdateAnimationPath
virtual void UpdateAnimationPath(const vtkVector2i &newActivePos)
Given a new position for the active plot, calculate a an animation path from the old active plot to t...
vtkScatterPlotMatrix::SetAxisLabelNotation
void SetAxisLabelNotation(int plotType, int notation)
Sets the axis label notation for the axes given a plot type, which refers to vtkScatterPlotMatrix::{S...
vtkVector2i
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:409
vtkScatterPlotMatrix::GetAnimationPathElement
vtkVector2i GetAnimationPathElement(vtkIdType i)
Get the element specified from the animation path.
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:41
vtkX3D::index
@ index
Definition: vtkX3D.h:246
vtkScatterPlotMatrix::AttachAxisRangeListener
void AttachAxisRangeListener(vtkAxis *)
Attach axis range listener so we can forward to dependent axes in matrix.
vtkScatterPlotMatrix::GetAxisLabelPrecision
int GetAxisLabelPrecision(int plotType)
vtkScatterPlotMatrix::SetScene
void SetScene(vtkContextScene *scene) override
Set the vtkContextScene for the item, always set for an item in a scene.
vtkWeakPointer< vtkContext2D >
vtkScatterPlotMatrix::ActivePlot
vtkVector2i ActivePlot
Definition: vtkScatterPlotMatrix.h:467
vtkScatterPlotMatrix::InsertVisibleColumn
void InsertVisibleColumn(const vtkStdString &name, int index)
Insert the specified column at the index position of the visible columns.
vtkScatterPlotMatrix::SCATTERPLOT
@ SCATTERPLOT
Definition: vtkScatterPlotMatrix.h:52
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
vtkScatterPlotMatrix::SetAxisLabelProperties
void SetAxisLabelProperties(int plotType, vtkTextProperty *prop)
Set/get the text property for the axis labels of the given plot type, possible types are vtkScatterPl...