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  virtual void PrintSelf(ostream &os, vtkIndent indent);
60 
65 
69  virtual void Update();
70 
74  virtual bool Paint(vtkContext2D *painter);
75 
76  virtual void SetScene(vtkContextScene *scene);
77 
83  virtual bool SetActivePlot(const vtkVector2i& position);
84 
89 
95 
100  virtual void SetInput(vtkTable *table);
101 
105  void SetColumnVisibility(const vtkStdString& name, bool visible);
106 
112 
117 
122  void SetColumnVisibilityAll(bool visible);
123 
128 
132  virtual void SetVisibleColumns(vtkStringArray* visColumns);
133 
138  virtual void SetNumberOfBins(int numberOfBins);
139 
144  virtual int GetNumberOfBins() const { return this->NumberOfBins; }
145 
149  void SetPlotColor(int plotType, const vtkColor4ub& color);
150 
154  void SetPlotMarkerStyle(int plotType, int style);
155 
159  void SetPlotMarkerSize(int plotType, float size);
160 
164  bool Hit(const vtkContextMouseEvent &mouse);
165 
170 
175 
180 
182 
186  int GetPlotType(const vtkVector2i &pos);
187  int GetPlotType(int row, int column);
189 
191 
197 
199 
205 
207 
212  void SetGridVisibility(int plotType, bool visible);
213  bool GetGridVisibility(int plotType);
215 
217 
221  void SetBackgroundColor(int plotType, const vtkColor4ub& color);
224 
226 
230  void SetAxisColor(int plotType, const vtkColor4ub& color);
231  vtkColor4ub GetAxisColor(int plotType);
233 
235 
239  void SetGridColor(int plotType, const vtkColor4ub& color);
240  vtkColor4ub GetGridColor(int plotType);
242 
244 
249  void SetAxisLabelVisibility(int plotType, bool visible);
250  bool GetAxisLabelVisibility(int plotType);
252 
254 
258  void SetAxisLabelProperties(int plotType, vtkTextProperty *prop);
261 
263 
267  void SetAxisLabelNotation(int plotType, int notation);
268  int GetAxisLabelNotation(int plotType);
270 
272 
276  void SetAxisLabelPrecision(int plotType, int precision);
277  int GetAxisLabelPrecision(int plotType);
279 
281 
285  void SetTooltipNotation(int plotType, int notation);
286  void SetTooltipPrecision(int plotType, int precision);
287  int GetTooltipNotation(int plotType);
288  int GetTooltipPrecision(int plotType);
290 
294  void SetTooltip(vtkTooltipItem *tooltip);
295 
300 
305 
310 
312 
318 
320 
326 
331 
335  void UpdateChartSettings(int plotType);
336 
338 
343  virtual void SetSelectionMode(int);
344  vtkGetMacro(SelectionMode, int);
346 
351 
356 
361  void SetNumberOfFrames(int frames);
362 
368 
373 
379  bool AddAnimationPath(const vtkVector2i &move);
380 
385 
390 
395 
400  virtual void AdvanceAnimation();
401 
405  virtual vtkChart * GetMainChart();
406 
407 protected:
410 
414  void UpdateLayout();
415 
420 
422 
426  void AxisRangeForwarderCallback(vtkObject*, unsigned long, void*);
428 
433  void BigChartSelectionCallback(vtkObject*, unsigned long, void*);
434 
440  virtual void UpdateAnimationPath(const vtkVector2i& newActivePos);
441 
446  virtual void StartAnimation(vtkRenderWindowInteractor* interactor);
447 
451  static void ProcessEvents(vtkObject *caller, unsigned long event,
452  void *clientData, void *callerData);
453 
454  // The position of the active plot (defaults to 0, 1).
456 
457  // Weakly owned input data for the scatter plot matrix.
459 
460  // Strongly owned internal data for the column visibility.
462 
463  // The number of bins in the histograms.
465 
466  // The title of the scatter plot matrix.
469 
470  // The mode when the chart is doing selection.
472 
473  // How many frames should animations consist of, 0 means no transitions.
475 
476 private:
477  vtkScatterPlotMatrix(const vtkScatterPlotMatrix &) VTK_DELETE_FUNCTION;
478  void operator=(const vtkScatterPlotMatrix &) VTK_DELETE_FUNCTION;
479 
480  class PIMPL;
481  PIMPL *Private;
482  friend class PIMPL;
483 
484  vtkWeakPointer<vtkContext2D> CurrentPainter;
485  vtkMTimeType LayoutUpdatedTime;
486 
487  // Go through the process of calculating axis ranges, etc...
488  void UpdateAxes();
489  void ApplyAxisSetting(vtkChart *chart, const vtkStdString &x,
490  const vtkStdString &y);
491 };
492 
493 #endif //vtkScatterPlotMatrix_h
takes care of drawing 2D axes
Definition: vtkAxis.h:72
container for a matrix of charts.
Factory class for drawing 2D charts.
Definition: vtkChart.h:51
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
data structure to represent mouse events.
Provides a 2D scene for vtkContextItem objects.
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract base class for most VTK objects
Definition: vtkObject.h:60
platform-independent render window interaction including picking and frame rate control.
container for a matrix of charts.
void AxisRangeForwarderCallback(vtkObject *, unsigned long, void *)
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...
void UpdateChartSettings(int plotType)
Update charts based on settings given the plot type.
int GetAxisLabelNotation(int plotType)
vtkColor4ub GetScatterPlotSelectedActiveColor()
virtual void SetInput(vtkTable *table)
Set the input table for the scatter plot matrix.
virtual void Update()
Perform any updates to the item that may be necessary before rendering.
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
Mouse button down event.
virtual bool SetActivePlot(const vtkVector2i &position)
Set the active plot, the one that will be displayed in the top-right.
virtual void SetScene(vtkContextScene *scene)
Set the vtkContextScene for the item, always set for an item in a scene.
void UpdateLayout()
Internal helper to do the layout of the charts in the scatter plot matrix.
void SetAxisLabelProperties(int plotType, vtkTextProperty *prop)
Set/get the text property for the axis labels of the given plot type, possible types are vtkScatterPl...
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
bool GetColumnVisibility(const vtkStdString &name)
Get the visibility of the specified column.
int GetAxisLabelPrecision(int plotType)
virtual bool Paint(vtkContext2D *painter)
Paint event for the chart matrix.
void SetPlotMarkerStyle(int plotType, int style)
Sets the marker style for the specified plotType.
vtkTextProperty * GetAxisLabelProperties(int plotType)
virtual void AdvanceAnimation()
Advance the animation in response to the timer events.
void SetTitleProperties(vtkTextProperty *prop)
Set/get the text properties for the chart title, i.e.
vtkTooltipItem * GetTooltip() const
Get the vtkTooltipItem object that will be displayed by the active chart.
bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
virtual vtkChart * GetMainChart()
Get the main plot (the one in the top-right of the matrix.
void SetScatterPlotSelectedRowColumnColor(const vtkColor4ub &color)
Set the scatter plot selected row/column charts' background color.
vtkColor4ub GetBackgroundColor(int plotType)
virtual void SetNumberOfBins(int numberOfBins)
Set the number of bins in the histograms along the central diagonal of the scatter plot matrix.
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...
static void ProcessEvents(vtkObject *caller, unsigned long event, void *clientData, void *callerData)
Process events and dispatch to the appropriate member functions.
static vtkScatterPlotMatrix * New()
Creates a new object.
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...
vtkStdString GetColumnName(int column)
Get the column name for the supplied index.
void InsertVisibleColumn(const vtkStdString &name, int index)
Insert the specified column at the index position of the visible columns.
void SetBackgroundColor(int plotType, const vtkColor4ub &color)
Sets the background color for the chart given a plot type, which refers to vtkScatterPlotMatrix::{SCA...
virtual vtkStringArray * GetVisibleColumns()
Get a list of the columns, and the order in which they are displayed.
void SetAxisColor(int plotType, const vtkColor4ub &color)
Sets the color for the axes given a plot type, which refers to vtkScatterPlotMatrix::{SCATTERPLOT,...
bool GetGridVisibility(int plotType)
void SetAxisLabelPrecision(int plotType, int precision)
Sets the axis label precision for the axes given a plot type, which refers to vtkScatterPlotMatrix::{...
vtkTextProperty * GetTitleProperties()
void ClearAnimationPath()
Clear the animation path.
int GetNumberOfFrames()
Get the number of animation frames in each transition.
bool BeginAnimationPath(vtkRenderWindowInteractor *interactor)
Trigger the animation of the scatter plot matrix to begin.
virtual void SetVisibleColumns(vtkStringArray *visColumns)
Set the list of visible columns, and the order in which they will be displayed.
void UpdateSettings()
Convenient method to update all the chart settings.
void SetPlotMarkerSize(int plotType, float size)
Sets the marker size for the specified plotType.
virtual void StartAnimation(vtkRenderWindowInteractor *interactor)
Given the render window interactor, start animation of the animation path calculated above.
vtkIdType GetNumberOfAnimationPathElements()
Get the number of elements (transitions) in the animation path.
void SetScatterPlotSelectedActiveColor(const vtkColor4ub &color)
Set the scatter plot selected active chart background color.
vtkSmartPointer< vtkTable > Input
void ResizeBigChart()
Compute and set big chart resize.
void SetTooltipNotation(int plotType, int notation)
Set chart's tooltip notation and precision, given a plot type, which refers to vtkScatterPlotMatrix::...
bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
int GetPlotType(int row, int column)
void SetIndexedLabels(vtkStringArray *labels)
Set indexed labels array.
vtkStdString GetTitle()
void SetPlotColor(int plotType, const vtkColor4ub &color)
Set the color for the specified plotType.
vtkColor4ub GetScatterPlotSelectedRowColumnColor()
vtkStringArray * GetIndexedLabels() const
Get the indexed labels array.
virtual int GetNumberOfBins() const
Get the number of bins the histograms along the central diagonal scatter plot matrix.
void SetTooltip(vtkTooltipItem *tooltip)
Set the vtkTooltipItem object that will be displayed by the active chart.
void BigChartSelectionCallback(vtkObject *, unsigned long, void *)
The callback function when SelectionChangedEvent is invoked from the Big chart.
void SetColumnVisibility(const vtkStdString &name, bool visible)
Set the visibility of the specified column.
vtkColor4ub GetAxisColor(int plotType)
int GetPlotType(const vtkVector2i &pos)
Returns the type of the plot at the given position.
void SetGridColor(int plotType, const vtkColor4ub &color)
Sets the color for the axes given a plot type, which refers to vtkScatterPlotMatrix::{SCATTERPLOT,...
void SetColumnVisibilityAll(bool visible)
Set the visibility of all columns (true will make them all visible, false will remove all visible col...
bool AddAnimationPath(const vtkVector2i &move)
Add a move to the animation path.
void SetTitle(const vtkStdString &title)
Set/get the scatter plot title.
vtkVector2i GetAnimationPathElement(vtkIdType i)
Get the element specified from the animation path.
virtual vtkVector2i GetActivePlot()
Get the position of the active plot.
void AttachAxisRangeListener(vtkAxis *)
Attach axis range listener so we can forward to dependent axes in matrix.
void SetNumberOfFrames(int frames)
Set the number of animation frames in each transition.
void SetAxisLabelNotation(int plotType, int notation)
Sets the axis label notation for the axes given a plot type, which refers to vtkScatterPlotMatrix::{S...
vtkSmartPointer< vtkTextProperty > TitleProperties
void SetTooltipPrecision(int plotType, int precision)
bool GetAxisLabelVisibility(int plotType)
int GetTooltipNotation(int plotType)
vtkAnnotationLink * GetAnnotationLink()
Get the AnnotationLink for the scatter plot matrix, this gives you access to the currently selected p...
vtkStdString GetRowName(int row)
Get the column name for the supplied index.
int GetTooltipPrecision(int plotType)
bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
vtkNew< vtkStringArray > VisibleColumns
virtual void SetSelectionMode(int)
Set/get the Selection Mode that will be used by the chart while doing selection.
vtkColor4ub GetGridColor(int plotType)
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:49
a vtkAbstractArray subclass for strings
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:69
represent text properties.
takes care of drawing 2D axes
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:328
@ color
Definition: vtkX3D.h:221
@ style
Definition: vtkX3D.h:492
@ name
Definition: vtkX3D.h:219
@ position
Definition: vtkX3D.h:261
@ size
Definition: vtkX3D.h:253
@ index
Definition: vtkX3D.h:246
@ title
Definition: vtkX3D.h:500
int vtkIdType
Definition: vtkType.h:287
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248