ParaView
vtkScatterPlotMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkScatterPlotMapper.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 =========================================================================*/
28 #ifndef vtkScatterPlotMapper_h
29 #define vtkScatterPlotMapper_h
30 
31 #include "vtkCompositePolyDataMapper2.h"
32 #include "vtkPVVTKExtensionsDefaultModule.h" //needed for exports
33 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
34 
35 class vtkPainterPolyDataMapper;
36 class vtkPolyData;
37 class vtkScalarsToColorsPainter;
39 
40 class VTKPVVTKEXTENSIONSDEFAULT_EXPORT vtkScatterPlotMapper : public vtkCompositePolyDataMapper2
41 {
42 public:
43  static vtkScatterPlotMapper* New();
44  vtkTypeMacro(vtkScatterPlotMapper, vtkCompositePolyDataMapper2);
45  void PrintSelf(ostream& os, vtkIndent indent);
46 
48  {
49  X_COORDS = 0,
60  NUMBER_OF_ARRAYS
61  };
62 
71  {
72  NoGlyph = 0,
73  UseGlyph = 1,
74  ScaledGlyph = 2,
75  UseMultiGlyph = 4,
76  OrientedGlyph = 8,
77  };
78 
80  {
81  // Where Sx,y,z are the scaling coefs,
82  // X,Y and Z are the GLYPH_[X,Y,Z]_SCALE arrays,
83  // Xc,Yc and Zc are the active component of the respective X,Y and Z arrays
84  // Sx = X[Xc], Sy = Y[Yc], Sz = Z[Zc]
85  Xc_Yc_Zc = 0, // Use one component of each GLYPH_[X,Y,Z]_SCALE arrays (default)
86  // Sx = X[Xc+0], Sy = X[Xc+1], Sz = X[Xc+2]
87  Xc0_Xc1_Xc2 = 1, // Use three components of the GLYPH_X_SCALE array
88  // Sx = X[Xc], Sy = X[Xc], Sz = X[Xc]
89  Xc_Xc_Xc = 2 // Duplicate the component of the GLYPH_X_SCALE array
90  };
91 
93  {
94  SCALE_BY_MAGNITUDE = 0, // XScale = YScale = ZScale = Norm(Sx,Sy,Sz,...)
95  SCALE_BY_COMPONENTS = 1, // XScale = Sx, YScale = Sy, ZScale = Sz
96  };
97 
99  {
100  DIRECTION = 0,
101  ROTATION = 1,
102  };
103 
104  static vtkInformationIntegerKey* FIELD_ACTIVE_COMPONENT();
105 
107 
114  void SetArrayByFieldName(ArrayIndex idx, const char* arrayName, int fieldAssociation,
115  int component = 0, int connection = 0);
116  void SetArrayByFieldIndex(
117  ArrayIndex idx, int fiedIndex, int fieldAssociation, int component = 0, int connection = 0);
119 
140  void SetArrayByFieldType(ArrayIndex idx, int fieldAttributeType, int fieldAssociation,
141  int component = 0, int connection = 0);
142 
143  void SetArrayByPointCoord(ArrayIndex idx, int component = 0, int connection = 0);
144  void SetArrayByName(ArrayIndex idx, const char* arrayName);
145  void SetXCoordsArray(const char* arrayName) { this->SetArrayByName(X_COORDS, arrayName); }
146  void SetYCoordsArray(const char* arrayName) { this->SetArrayByName(Y_COORDS, arrayName); }
147  void SetZCoordsArray(const char* arrayName) { this->SetArrayByName(Z_COORDS, arrayName); }
148  void SetColorArray(const char* arrayName) { this->SetArrayByName(COLOR, arrayName); }
149  void SetGlyphXScalingArray(const char* arrayName)
150  {
151  this->SetArrayByName(GLYPH_X_SCALE, arrayName);
152  }
153  void SetGlyphYScalingArray(const char* arrayName)
154  {
155  this->SetArrayByName(GLYPH_Y_SCALE, arrayName);
156  }
157  void SetGlyphZScalingArray(const char* arrayName)
158  {
159  this->SetArrayByName(GLYPH_Z_SCALE, arrayName);
160  }
161  void SetGlyphSourceArray(const char* arrayName) { this->SetArrayByName(GLYPH_SOURCE, arrayName); }
162  void SetGlyphXOrientationArray(const char* arrayName)
163  {
164  this->SetArrayByName(GLYPH_X_ORIENTATION, arrayName);
165  }
166  void SetGlyphYOrientationArray(const char* arrayName)
167  {
168  this->SetArrayByName(GLYPH_Y_ORIENTATION, arrayName);
169  }
170  void SetGlyphZOrientationArray(const char* arrayName)
171  {
172  this->SetArrayByName(GLYPH_Z_ORIENTATION, arrayName);
173  }
174 
175  vtkDataArray* GetArray(ArrayIndex idx);
176  vtkDataArray* GetArray(ArrayIndex idx, vtkDataSet* input);
177 
178  /*
179  void SetThreeDMode(bool);
180  void SetColorize(bool);
181  void SetGlyphMode(int);
182  void SetScalingArrayMode(int);
183  void SetScaleMode(int);
184  void SetScaleFactor(double);
185  void SetOrientationMode(int);
186  void SetNestedDisplayLists(bool);
187  */
189 
194  vtkSetMacro(ThreeDMode, bool);
195  vtkGetMacro(ThreeDMode, bool);
196  vtkBooleanMacro(ThreeDMode, bool);
198 
200 
205  vtkSetMacro(Colorize, bool);
206  vtkGetMacro(Colorize, bool);
207  vtkBooleanMacro(Colorize, bool);
209 
211 
217  vtkSetMacro(GlyphMode, int);
218  vtkGetMacro(GlyphMode, int);
219  // vtkBooleanMacro(GlyphMode,int);
221 
223 
227  vtkSetMacro(ScalingArrayMode, int);
228  vtkGetMacro(ScalingArrayMode, int);
230 
232 
236  vtkSetMacro(ScaleMode, int);
237  vtkGetMacro(ScaleMode, int);
239 
241 
245  vtkSetMacro(ScaleFactor, double);
246  vtkGetMacro(ScaleFactor, double);
248 
249  vtkSetMacro(OrientationMode, int);
250  vtkGetMacro(OrientationMode, int);
251 
253 
261  vtkSetMacro(NestedDisplayLists, bool);
262  vtkGetMacro(NestedDisplayLists, bool);
263  vtkBooleanMacro(NestedDisplayLists, bool);
265 
267 
271  vtkSetMacro(ParallelToCamera, bool);
272  vtkGetMacro(ParallelToCamera, bool);
273  vtkBooleanMacro(ParallelToCamera, bool);
275 
277 
282  void SetGlyphSourceConnection(int id, vtkAlgorithmOutput* algOutput);
283  void SetGlyphSourceConnection(vtkAlgorithmOutput* algOutput)
284  {
285  this->SetGlyphSourceConnection(0, algOutput);
286  }
288 
293  void AddGlyphSourceConnection(vtkAlgorithmOutput* algOutput);
294  vtkPolyData* GetGlyphSource(int id = 0);
295 
301  virtual void Render(vtkRenderer* renderer, vtkActor* actor);
302 
303 protected:
305  virtual ~vtkScatterPlotMapper();
306 
310  virtual void ReportReferences(vtkGarbageCollector* collector);
311 
312  virtual int FillInputPortInformation(int port, vtkInformation* info);
313  /*
314  virtual int FillOutputPortInformation(int port, vtkInformation *info);
315 
316  virtual int ProcessRequest(vtkInformation* request,
317  vtkInformationVector** inputVector,
318  vtkInformationVector* outputVector);
319  virtual int RequestData(vtkInformation* request,
320  vtkInformationVector** inputVector,
321  vtkInformationVector* outputVector);
322  virtual int RequestUpdateExtent(vtkInformation* request,
323  vtkInformationVector** inputVector,
324  vtkInformationVector* outputVector);
325  virtual int RequestInformation(vtkInformation* request,
326  vtkInformationVector** inputVector,
327  vtkInformationVector* outputVector);
328  */
333  void CopyInformationToSubMapper(vtkPainterPolyDataMapper* mapper);
334 
335  virtual void PrepareForRendering(vtkRenderer* renderer, vtkActor* actor);
336  void InitGlyphMappers(vtkRenderer* renderer, vtkActor* actor, bool createDisplayList = true);
337  void GenerateDefaultGlyphs();
338  virtual void ComputeBounds();
339  virtual void UpdatePainterInformation();
340 
341  vtkScatterPlotPainter* GetScatterPlotPainter();
342 
344  bool Colorize;
346 
347  double ScaleFactor; // Scale factor to use to scale geometry
348  int ScaleMode; // Scale by scalar value or vector magnitude
351  bool NestedDisplayLists; // boolean
353 
354 private:
355  vtkScatterPlotMapper(const vtkScatterPlotMapper&) VTK_DELETE_FUNCTION;
356  void operator=(const vtkScatterPlotMapper&) VTK_DELETE_FUNCTION;
357 };
358 
359 #endif
GlyphDrawingMode
Flags to control how the glyphs are displayed.
void SetGlyphSourceArray(const char *arrayName)
void SetGlyphXOrientationArray(const char *arrayName)
void SetXCoordsArray(const char *arrayName)
void SetGlyphYScalingArray(const char *arrayName)
void SetGlyphZOrientationArray(const char *arrayName)
void SetGlyphSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
void SetZCoordsArray(const char *arrayName)
void SetGlyphZScalingArray(const char *arrayName)
void SetGlyphXScalingArray(const char *arrayName)
void SetGlyphYOrientationArray(const char *arrayName)
Display a vtkDataSet with flexibility.
void SetColorArray(const char *arrayName)
void SetYCoordsArray(const char *arrayName)