vtkPlotParallelCoordinates.h 4.61 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
// .NAME vtkPlotParallelCoordinates - Class for drawing a parallel coordinate
// plot given columns from a vtkTable.
18 19 20 21
//
// .SECTION Description
//

22 23
#ifndef vtkPlotParallelCoordinates_h
#define vtkPlotParallelCoordinates_h
24

25
#include "vtkChartsCoreModule.h" // For export macro
26
#include "vtkPlot.h"
27
#include "vtkScalarsToColors.h" // For VTK_COLOR_MODE_DEFAULT and _MAP_SCALARS
28
#include "vtkStdString.h"       // For vtkStdString ivars
29 30 31 32

class vtkChartParallelCoordinates;
class vtkTable;
class vtkStdString;
33 34
class vtkScalarsToColors;
class vtkUnsignedCharArray;
35

36
class VTKCHARTSCORE_EXPORT vtkPlotParallelCoordinates : public vtkPlot
37 38
{
public:
39
  vtkTypeMacro(vtkPlotParallelCoordinates, vtkPlot);
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
  virtual void PrintSelf(ostream &os, vtkIndent indent);

  // Description:
  // Creates a parallel coordinates chart
  static vtkPlotParallelCoordinates* New();

  // Description:
  // 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.
  virtual void Update();

  // Description:
  // Paint event for the XY plot, called whenever the chart needs to be drawn
  virtual bool Paint(vtkContext2D *painter);

  // Description:
  // 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.
61 62
  virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
                           int legendIndex);
63 64 65 66 67 68 69 70 71 72 73 74 75

  // Description:
  // Get the bounds for this mapper as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
  virtual void GetBounds(double bounds[4]);

  // Description:
  // Set the selection criteria on the given axis in normalized space (0.0 - 1.0).
  bool SetSelectionRange(int Axis, float low, float high);

  // Description:
  // Reset the selection criteria for the chart.
  bool ResetSelectionRange();

76 77
  // Description:
  // This is a convenience function to set the input table.
78 79 80
  virtual void SetInputData(vtkTable *table);
  virtual void SetInputData(vtkTable *table, const vtkStdString&,
                            const vtkStdString&)
81
  {
82
    this->SetInputData(table);
83 84
  }

85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
  // Description:
  // Specify a lookup table for the mapper to use.
  void SetLookupTable(vtkScalarsToColors *lut);
  vtkScalarsToColors *GetLookupTable();

  // Description:
  // Create default lookup table. Generally used to create one when none
  // is available with the scalar data.
  virtual void CreateDefaultLookupTable();

  // Description:
  // Turn on/off flag to control whether scalar data is used to color objects.
  vtkSetMacro(ScalarVisibility,int);
  vtkGetMacro(ScalarVisibility,int);
  vtkBooleanMacro(ScalarVisibility,int);

  // Description:
  // 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.
  void SelectColorArray(vtkIdType arrayNum);
106 107 108 109 110
  void SelectColorArray(const vtkStdString &arrayName);

  // Description:
  // Get the array name to color by.
  vtkStdString GetColorArrayName();
111

112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
protected:
  vtkPlotParallelCoordinates();
  ~vtkPlotParallelCoordinates();

  // Description:
  // Update the table cache.
  bool UpdateTableCache(vtkTable *table);

  // Description:
  // Store a well packed set of XY coordinates for this data series.
  class Private;
  Private* Storage;

  // Description:
  // The point cache is marked dirty until it has been initialized.
  vtkTimeStamp BuildTime;

129 130 131 132 133
  // Description:
  // Lookup Table for coloring points by scalar value
  vtkScalarsToColors *LookupTable;
  vtkUnsignedCharArray *Colors;
  int ScalarVisibility;
134
  vtkStdString ColorArrayName;
135

136
private:
137
  vtkPlotParallelCoordinates(const vtkPlotParallelCoordinates &) VTK_DELETE_FUNCTION;
138
  void operator=(const vtkPlotParallelCoordinates &) VTK_DELETE_FUNCTION;
139 140 141

};

142
#endif //vtkPlotParallelCoordinates_h