vtkPlot3D.h 4.92 KB
Newer Older
Zack Galbreath's avatar
Zack Galbreath committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPlot3D.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 24 25
/**
 * @class   vtkPlot3D
 * @brief   Abstract class for 3D plots.
 *
 *
 * The base class for all plot types used in vtkChart derived charts.
 *
 * @sa
 * vtkPlot3DPoints vtkPlot3DLine vtkPlot3DBar vtkChart vtkChartXY
*/
Zack Galbreath's avatar
Zack Galbreath committed
26

27 28
#ifndef vtkPlot3D_h
#define vtkPlot3D_h
Zack Galbreath's avatar
Zack Galbreath committed
29 30 31 32 33 34 35 36 37

#include "vtkChartsCoreModule.h" // For export macro
#include "vtkContextItem.h"
#include "vtkNew.h"              // Needed to hold vtkNew ivars
#include "vtkSmartPointer.h"     // Needed to hold SP ivars
#include "vtkVector.h"           // For Points ivar
#include <vector>                // For ivars

class vtkChartXYZ;
38
class vtkDataArray;
39
class vtkIdTypeArray;
Zack Galbreath's avatar
Zack Galbreath committed
40 41 42 43 44 45 46 47
class vtkTable;
class vtkUnsignedCharArray;
class vtkPen;

class VTKCHARTSCORE_EXPORT vtkPlot3D : public vtkContextItem
{
public:
  vtkTypeMacro(vtkPlot3D, vtkContextItem);
48
  void PrintSelf(ostream &os, vtkIndent indent) override;
Zack Galbreath's avatar
Zack Galbreath committed
49

50 51 52 53
  //@{
  /**
   * Set/get the vtkPen object that controls how this plot draws (out)lines.
   */
Zack Galbreath's avatar
Zack Galbreath committed
54 55
  void SetPen(vtkPen *pen);
  vtkPen* GetPen();
56
  //@}
Zack Galbreath's avatar
Zack Galbreath committed
57

58 59 60 61
  //@{
  /**
   * Set/get the vtkPen object that controls how this plot draws (out)lines.
   */
62 63
  void SetSelectionPen(vtkPen *pen);
  vtkPen* GetSelectionPen();
64
  //@}
65

66 67 68 69
  //@{
  /**
   * Set the input to the plot.
   */
Zack Galbreath's avatar
Zack Galbreath committed
70 71 72 73 74 75 76 77 78 79
  virtual void SetInputData(vtkTable *input);
  virtual void SetInputData(vtkTable *input, const vtkStdString &xName,
                            const vtkStdString &yName,
                            const vtkStdString &zName);
  virtual void SetInputData(vtkTable *input, const vtkStdString &xName,
                            const vtkStdString &yName,
                            const vtkStdString &zName,
                            const vtkStdString &colorName);
  virtual void SetInputData(vtkTable *input, vtkIdType xColumn,
                            vtkIdType yColumn, vtkIdType zColumn);
80
  //@}
Zack Galbreath's avatar
Zack Galbreath committed
81

82 83 84 85 86
  /**
   * Set the color of each point in the plot.  The input is a single component
   * scalar array.  The values of this array will be passed through a lookup
   * table to generate the color for each data point in the plot.
   */
87 88
  virtual void SetColors(vtkDataArray *colorArr);

89 90 91
  /**
   * Get all the data points within this plot.
   */
92
  std::vector<vtkVector3f> GetPoints();
Zack Galbreath's avatar
Zack Galbreath committed
93

94 95 96 97
  //@{
  /**
   * Get/set the chart for this plot.
   */
Zack Galbreath's avatar
Zack Galbreath committed
98 99
  vtkGetObjectMacro(Chart, vtkChartXYZ);
  virtual void SetChart(vtkChartXYZ* chart);
100
  //@}
Zack Galbreath's avatar
Zack Galbreath committed
101

102 103 104
  /**
   * Get the label for the X axis.
   */
Zack Galbreath's avatar
Zack Galbreath committed
105 106
  std::string GetXAxisLabel();

107 108 109
  /**
   * Get the label for the Y axis.
   */
Zack Galbreath's avatar
Zack Galbreath committed
110 111
  std::string GetYAxisLabel();

112 113 114
  /**
   * Get the label for the Z axis.
   */
Zack Galbreath's avatar
Zack Galbreath committed
115 116
  std::string GetZAxisLabel();

117 118 119
  /**
   * Get the bounding cube surrounding the currently rendered data points.
   */
120
  std::vector<vtkVector3f> GetDataBounds() { return this->DataBounds; }
Zack Galbreath's avatar
Zack Galbreath committed
121

122 123 124 125
  //@{
  /**
   * Set/get the selection array for the plot.
   */
126 127
  virtual void SetSelection(vtkIdTypeArray *id);
  virtual vtkIdTypeArray* GetSelection();
128
  //@}
129

Zack Galbreath's avatar
Zack Galbreath committed
130 131
protected:
  vtkPlot3D();
132
  ~vtkPlot3D() override;
Zack Galbreath's avatar
Zack Galbreath committed
133

134 135 136
  /**
   * Generate a bounding cube for our data.
   */
Zack Galbreath's avatar
Zack Galbreath committed
137 138
  virtual void ComputeDataBounds();

139 140 141
  /**
   * This object stores the vtkPen that controls how the plot is drawn.
   */
Zack Galbreath's avatar
Zack Galbreath committed
142 143
  vtkSmartPointer<vtkPen> Pen;

144 145 146
  /**
   * This object stores the vtkPen that controls how the plot is drawn.
   */
147 148
  vtkSmartPointer<vtkPen> SelectionPen;

149 150 151
  /**
   * This array assigns a color to each datum in the plot.
   */
Zack Galbreath's avatar
Zack Galbreath committed
152 153
  vtkNew<vtkUnsignedCharArray> Colors;

154 155 156 157
  /**
   * Number of components in our color vectors.  This value is initialized
   * to zero.  It's typically set to 3 or 4 if the points are to be colored.
   */
Zack Galbreath's avatar
Zack Galbreath committed
158 159
  int NumberOfComponents;

160 161 162
  /**
   * The label for the X Axis.
   */
Zack Galbreath's avatar
Zack Galbreath committed
163 164
  std::string XAxisLabel;

165 166 167
  /**
   * The label for the Y Axis.
   */
Zack Galbreath's avatar
Zack Galbreath committed
168 169
  std::string YAxisLabel;

170 171 172
  /**
   * The label for the Z Axis.
   */
Zack Galbreath's avatar
Zack Galbreath committed
173 174
  std::string ZAxisLabel;

175 176 177
  /**
   * The data points read in during SetInputData().
   */
178
  std::vector<vtkVector3f> Points;
Zack Galbreath's avatar
Zack Galbreath committed
179

180 181 182
  /**
   * When the points were last built.
   */
Zack Galbreath's avatar
Zack Galbreath committed
183 184
  vtkTimeStamp PointsBuildTime;

185 186 187
  /**
   * The chart containing this plot.
   */
Zack Galbreath's avatar
Zack Galbreath committed
188 189
  vtkChartXYZ* Chart;

190 191 192
  /**
   * A bounding cube surrounding the currently rendered data points.
   */
193
  std::vector<vtkVector3f> DataBounds;
Zack Galbreath's avatar
Zack Galbreath committed
194

195 196 197
  /**
   * Selected indices for the table the plot is rendering
   */
198 199
  vtkSmartPointer<vtkIdTypeArray> Selection;

Zack Galbreath's avatar
Zack Galbreath committed
200
private:
201 202
  vtkPlot3D(const vtkPlot3D &) = delete;
  void operator=(const vtkPlot3D &) = delete;
Zack Galbreath's avatar
Zack Galbreath committed
203 204 205

};

206
#endif //vtkPlot3D_h