vtkPlotParallelCoordinates.h 4.59 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPlotParallelCoordinates.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/

16 17 18 19 20 21 22 23
/**
 * @class   vtkPlotParallelCoordinates
 * @brief   Class for drawing a parallel coordinate
 * plot given columns from a vtkTable.
 *
 *
 *
*/
24

25 26
#ifndef vtkPlotParallelCoordinates_h
#define vtkPlotParallelCoordinates_h
27

28
#include "vtkChartsCoreModule.h" // For export macro
29
#include "vtkPlot.h"
30
#include "vtkScalarsToColors.h" // For VTK_COLOR_MODE_DEFAULT and _MAP_SCALARS
31
#include "vtkStdString.h"       // For vtkStdString ivars
32 33 34 35

class vtkChartParallelCoordinates;
class vtkTable;
class vtkStdString;
36 37
class vtkScalarsToColors;
class vtkUnsignedCharArray;
38

39
class VTKCHARTSCORE_EXPORT vtkPlotParallelCoordinates : public vtkPlot
40 41
{
public:
42
  vtkTypeMacro(vtkPlotParallelCoordinates, vtkPlot);
43 44
  virtual void PrintSelf(ostream &os, vtkIndent indent);

45 46 47
  /**
   * Creates a parallel coordinates chart
   */
48 49
  static vtkPlotParallelCoordinates* New();

50 51 52 53 54
  /**
   * Perform any updates to the item that may be necessary before rendering.
   * The scene should take care of calling this on all items before their
   * Paint function is invoked.
   */
55 56
  virtual void Update();

57 58 59
  /**
   * Paint event for the XY plot, called whenever the chart needs to be drawn
   */
60 61
  virtual bool Paint(vtkContext2D *painter);

62 63 64 65 66 67
  /**
   * Paint legend event for the XY plot, called whenever the legend needs the
   * plot items symbol/mark/line drawn. A rect is supplied with the lower left
   * corner of the rect (elements 0 and 1) and with width x height (elements 2
   * and 3). The plot can choose how to fill the space supplied.
   */
68 69
  virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
                           int legendIndex);
70

71 72 73
  /**
   * Get the bounds for this mapper as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
   */
74 75
  virtual void GetBounds(double bounds[4]);

76 77 78
  /**
   * Set the selection criteria on the given axis in normalized space (0.0 - 1.0).
   */
79 80
  bool SetSelectionRange(int Axis, float low, float high);

81 82 83
  /**
   * Reset the selection criteria for the chart.
   */
84 85
  bool ResetSelectionRange();

86 87 88 89
  //@{
  /**
   * This is a convenience function to set the input table.
   */
90 91 92
  virtual void SetInputData(vtkTable *table);
  virtual void SetInputData(vtkTable *table, const vtkStdString&,
                            const vtkStdString&)
93
  {
94
    this->SetInputData(table);
95
  }
96
  //@}
97

98 99 100 101
  //@{
  /**
   * Specify a lookup table for the mapper to use.
   */
102 103
  void SetLookupTable(vtkScalarsToColors *lut);
  vtkScalarsToColors *GetLookupTable();
104
  //@}
105

106 107 108 109
  /**
   * Create default lookup table. Generally used to create one when none
   * is available with the scalar data.
   */
110 111
  virtual void CreateDefaultLookupTable();

112 113 114 115
  //@{
  /**
   * Turn on/off flag to control whether scalar data is used to color objects.
   */
116 117 118
  vtkSetMacro(ScalarVisibility,int);
  vtkGetMacro(ScalarVisibility,int);
  vtkBooleanMacro(ScalarVisibility,int);
119 120 121 122 123 124 125 126
  //@}

  //@{
  /**
   * When ScalarMode is set to UsePointFieldData or UseCellFieldData,
   * you can specify which array to use for coloring using these methods.
   * The lookup table will decide how to convert vectors to colors.
   */
127
  void SelectColorArray(vtkIdType arrayNum);
128
  void SelectColorArray(const vtkStdString &arrayName);
129
  //@}
130

131 132 133
  /**
   * Get the array name to color by.
   */
134
  vtkStdString GetColorArrayName();
135

136 137 138 139
protected:
  vtkPlotParallelCoordinates();
  ~vtkPlotParallelCoordinates();

140 141 142
  /**
   * Update the table cache.
   */
143 144
  bool UpdateTableCache(vtkTable *table);

145 146 147 148
  //@{
  /**
   * Store a well packed set of XY coordinates for this data series.
   */
149 150
  class Private;
  Private* Storage;
151
  //@}
152

153 154 155
  /**
   * The point cache is marked dirty until it has been initialized.
   */
156 157
  vtkTimeStamp BuildTime;

158 159 160 161
  //@{
  /**
   * Lookup Table for coloring points by scalar value
   */
162 163 164
  vtkScalarsToColors *LookupTable;
  vtkUnsignedCharArray *Colors;
  int ScalarVisibility;
165
  vtkStdString ColorArrayName;
166
  //@}
167

168
private:
169
  vtkPlotParallelCoordinates(const vtkPlotParallelCoordinates &) VTK_DELETE_FUNCTION;
170
  void operator=(const vtkPlotParallelCoordinates &) VTK_DELETE_FUNCTION;
171 172 173

};

174
#endif //vtkPlotParallelCoordinates_h