VTK
dox/Charts/vtkScatterPlotMatrix.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkScatterPlotMatrix.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 
00028 #ifndef __vtkScatterPlotMatrix_h
00029 #define __vtkScatterPlotMatrix_h
00030 
00031 #include "vtkChartMatrix.h"
00032 #include "vtkSmartPointer.h" // For ivars
00033 #include "vtkNew.h"          // For ivars
00034 #include "vtkColor.h"        // For member function return
00035 #include "vtkStdString.h"    // For ivars
00036 
00037 class vtkStringArray;
00038 class vtkTable;
00039 class vtkAxis;
00040 class vtkAnnotationLink;
00041 class vtkTextProperty;
00042 class vtkRenderWindowInteractor;
00043 
00044 class VTK_CHARTS_EXPORT vtkScatterPlotMatrix : public vtkChartMatrix
00045 {
00046 public:
00047   enum {
00048     SCATTERPLOT,
00049     HISTOGRAM,
00050     ACTIVEPLOT,
00051     NOPLOT
00052   };
00053 
00054   vtkTypeMacro(vtkScatterPlotMatrix, vtkChartMatrix);
00055   virtual void PrintSelf(ostream &os, vtkIndent indent);
00056 
00058   static vtkScatterPlotMatrix *New();
00059 
00062   virtual void Update();
00063 
00065   virtual bool Paint(vtkContext2D *painter);
00066 
00070   virtual bool SetActivePlot(const vtkVector2i& position);
00071 
00073   virtual vtkVector2i GetActivePlot();
00074 
00078   VTK_LEGACY(vtkAnnotationLink* GetActiveAnnotationLink());
00079 
00082   vtkAnnotationLink* GetAnnotationLink();
00083 
00087   virtual void SetInput(vtkTable *table);
00088 
00090   void SetColumnVisibility(const vtkStdString& name, bool visible);
00091 
00094   void InsertVisibleColumn(const vtkStdString& name, int index);
00095 
00097   bool GetColumnVisibility(const vtkStdString& name);
00098 
00101   void SetColumnVisibilityAll(bool visible);
00102 
00104   virtual vtkStringArray* GetVisibleColumns();
00105 
00108   virtual void SetVisibleColumns(vtkStringArray* visColumns);
00109 
00112   virtual void SetNumberOfBins(int numberOfBins);
00113 
00116   virtual int GetNumberOfBins() const { return this->NumberOfBins; }
00117 
00119   void SetPlotColor(int plotType, const vtkColor4ub& color);
00120 
00122   void SetPlotMarkerStyle(int plotType, int style);
00123 
00125   void SetPlotMarkerSize(int plotType, float size);
00126 
00128   bool Hit(const vtkContextMouseEvent &mouse);
00129 
00131   bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
00132 
00134   bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
00135 
00137   bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse);
00138 
00140 
00142   int GetPlotType(const vtkVector2i &pos);
00143   int GetPlotType(int row, int column);
00145 
00147 
00148   void SetTitle(const vtkStdString& title);
00149   vtkStdString GetTitle();
00151 
00153 
00155   void SetTitleProperties(vtkTextProperty *prop);
00156   vtkTextProperty* GetTitleProperties();
00158 
00160 
00163   void SetGridVisibility(int plotType, bool visible);
00164   bool GetGridVisibility(int plotType);
00166 
00168 
00170   void SetBackgroundColor(int plotType, const vtkColor4ub& color);
00171   vtkColor4ub GetBackgroundColor(int plotType);
00173 
00175 
00177   void SetAxisColor(int plotType, const vtkColor4ub& color);
00178   vtkColor4ub GetAxisColor(int plotType);
00180 
00182 
00184   void SetGridColor(int plotType, const vtkColor4ub& color);
00185   vtkColor4ub GetGridColor(int plotType);
00187 
00189 
00192   void SetAxisLabelVisibility(int plotType, bool visible);
00193   bool GetAxisLabelVisibility(int plotType);
00195 
00197 
00200   void SetAxisLabelProperties(int plotType, vtkTextProperty *prop);
00201   vtkTextProperty* GetAxisLabelProperties(int plotType);
00203 
00205 
00207   void SetAxisLabelNotation(int plotType, int notation);
00208   int GetAxisLabelNotation(int plotType);
00210 
00212 
00214   void SetAxisLabelPrecision(int plotType, int precision);
00215   int GetAxisLabelPrecision(int plotType);
00217 
00219 
00221   void SetTooltipNotation(int plotType, int notation);
00222   void SetTooltipPrecision(int plotType, int precision);
00223   int GetTooltipNotation(int plotType);
00224   int GetTooltipPrecision(int plotType);
00226 
00228 
00229   void SetScatterPlotSelectedRowColumnColor(const vtkColor4ub& color);
00230   vtkColor4ub GetScatterPlotSelectedRowColumnColor();
00232 
00234 
00235   void SetScatterPlotSelectedActiveColor(const vtkColor4ub& color);
00236   vtkColor4ub GetScatterPlotSelectedActiveColor();
00238 
00240   void UpdateSettings();
00241 
00243   void UpdateChartSettings(int plotType);
00244 
00246 
00250   virtual void SetSelectionMode(int);
00251   vtkGetMacro(SelectionMode, int);
00253 
00254 protected:
00255   vtkScatterPlotMatrix();
00256   ~vtkScatterPlotMatrix();
00257 
00260   void UpdateLayout();
00261 
00263 
00265   void AttachAxisRangeListener(vtkAxis*);
00266   void AxisRangeForwarderCallback(vtkObject*, unsigned long, void*);
00268 
00271   void BigChartSelectionCallback(vtkObject*, unsigned long, void*);
00272 
00275   virtual void UpdateAnimationPath(const vtkVector2i& newActivePos);
00276 
00279   virtual void StartAnimation(vtkRenderWindowInteractor* interactor);
00280 
00281   class PIMPL;
00282   PIMPL *Private;
00283 
00284   // The position of the active plot (defaults to 0, 1).
00285   vtkVector2i ActivePlot;
00286 
00287   // Weakly owned input data for the scatter plot matrix.
00288   vtkSmartPointer<vtkTable> Input;
00289 
00290   // Strongly owned internal data for the column visibility.
00291   vtkNew<vtkStringArray> VisibleColumns;
00292 
00293   // The number of bins in the histograms.
00294   int NumberOfBins;
00295 
00296   // The title of the scatter plot matrix.
00297   vtkStdString Title;
00298   vtkSmartPointer<vtkTextProperty> TitleProperties;
00299 
00300   // The mode when the chart is doing selection.
00301   int SelectionMode;
00302 
00303 private:
00304   vtkScatterPlotMatrix(const vtkScatterPlotMatrix &); // Not implemented.
00305   void operator=(const vtkScatterPlotMatrix &); // Not implemented.
00306 };
00307 
00308 #endif //__vtkScatterPlotMatrix_h