VTK
dox/Rendering/Core/vtkGlyph3DMapper.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkGlyph3DMapper.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 =========================================================================*/
00030 #ifndef __vtkGlyph3DMapper_h
00031 #define __vtkGlyph3DMapper_h
00032 
00033 #include "vtkRenderingCoreModule.h" // For export macro
00034 #include "vtkMapper.h"
00035 #include "vtkGlyph3D.h" // for the constants (VTK_SCALE_BY_SCALAR, ...).
00036 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
00037 
00038 class VTKRENDERINGCORE_EXPORT vtkGlyph3DMapper : public vtkMapper
00039 {
00040 public:
00041   static vtkGlyph3DMapper* New();
00042   vtkTypeMacro(vtkGlyph3DMapper, vtkMapper);
00043   void PrintSelf(ostream& os, vtkIndent indent);
00044   //BTX
00045   enum ArrayIndexes
00046     {
00047     SCALE = 0,
00048     SOURCE_INDEX = 1,
00049     MASK = 2,
00050     ORIENTATION = 3,
00051     SELECTIONID = 4
00052     };
00053   //ETX
00054 
00056 
00059   void SetSourceConnection(int idx, vtkAlgorithmOutput* algOutput);
00060   void SetSourceConnection(vtkAlgorithmOutput* algOutput)
00061     { this->SetSourceConnection(0, algOutput); }
00063 
00067   void SetInputData(vtkDataObject *);
00068 
00070   void SetSourceData(int idx, vtkPolyData *pd);
00071 
00074   void SetSourceData(vtkPolyData *pd);
00075 
00077   vtkPolyData *GetSource(int idx = 0);
00078 
00080 
00083   vtkSetMacro(Scaling, bool);
00084   vtkBooleanMacro(Scaling, bool);
00085   vtkGetMacro(Scaling, bool);
00087 
00089 
00093   vtkSetMacro(ScaleMode, int);
00094   vtkGetMacro(ScaleMode, int);
00096 
00098 
00100   vtkSetMacro(ScaleFactor, double);
00101   vtkGetMacro(ScaleFactor, double);
00103 
00104   //BTX
00105   enum ScaleModes
00106     {
00107     NO_DATA_SCALING = 0,
00108     SCALE_BY_MAGNITUDE = 1,
00109     SCALE_BY_COMPONENTS = 2
00110     };
00111   //ETX
00112   void SetScaleModeToScaleByMagnitude()
00113     { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
00114   void SetScaleModeToScaleByVectorComponents()
00115     { this->SetScaleMode(SCALE_BY_COMPONENTS); }
00116   void SetScaleModeToNoDataScaling()
00117     { this->SetScaleMode(NO_DATA_SCALING); }
00118   const char *GetScaleModeAsString();
00119 
00121 
00122   vtkSetVector2Macro(Range, double);
00123   vtkGetVectorMacro(Range, double, 2);
00125 
00127 
00129   vtkSetMacro(Orient, bool);
00130   vtkGetMacro(Orient, bool);
00131   vtkBooleanMacro(Orient, bool);
00133 
00135 
00138   vtkSetClampMacro(OrientationMode, int, DIRECTION, ROTATION);
00139   vtkGetMacro(OrientationMode, int);
00140   void SetOrientationModeToDirection()
00141     { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
00142   void SetOrientationModeToRotation()
00143     { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
00144   const char* GetOrientationModeAsString();
00145   //BTX
00146   enum OrientationModes
00147     {
00148     DIRECTION=0,
00149     ROTATION=1
00150     };
00151   //ETX
00153 
00155 
00157   vtkSetMacro(Clamping, bool);
00158   vtkGetMacro(Clamping, bool);
00159   vtkBooleanMacro(Clamping, bool);
00161 
00163 
00168   vtkSetMacro(SourceIndexing, bool);
00169   vtkGetMacro(SourceIndexing, bool);
00170   vtkBooleanMacro(SourceIndexing, bool);
00172 
00174 
00176   vtkSetMacro(UseSelectionIds, bool);
00177   vtkBooleanMacro(UseSelectionIds, bool);
00178   vtkGetMacro(UseSelectionIds, bool);
00180 
00182   virtual double *GetBounds();
00183 
00186   virtual void GetBounds(double bounds[6]);
00187 
00189   virtual void Render(vtkRenderer *ren, vtkActor *act);
00190 
00192 
00197   vtkSetMacro(NestedDisplayLists, bool);
00198   vtkGetMacro(NestedDisplayLists, bool);
00199   vtkBooleanMacro(NestedDisplayLists, bool);
00201 
00203 
00208   vtkSetMacro(Masking, bool);
00209   vtkGetMacro(Masking, bool);
00210   vtkBooleanMacro(Masking, bool);
00212 
00217   void SetMaskArray(const char* maskarrayname);
00218 
00227   void SetMaskArray(int fieldAttributeType);
00228 
00242   void SetOrientationArray(const char* orientationarrayname);
00243 
00260   void SetOrientationArray(int fieldAttributeType);
00261 
00265   void SetScaleArray(const char* scalarsarrayname);
00266 
00270   void SetScaleArray(int fieldAttributeType);
00271 
00276   void SetSourceIndexArray(const char* arrayname);
00277 
00282   void SetSourceIndexArray(int fieldAttributeType);
00283 
00289   void SetSelectionIdArray(const char* selectionIdArrayName);
00290 
00296   void SetSelectionIdArray(int fieldAttributeType);
00297 
00299 
00302   vtkSetMacro(SelectionColorId, unsigned int);
00303   vtkGetMacro(SelectionColorId, unsigned int);
00305 
00307 
00308   vtkSetMacro(SelectMode, int);
00310 
00312 
00316   virtual bool GetSupportsSelection()
00317     { return true; }
00318   //BTX
00319 protected:
00320   vtkGlyph3DMapper();
00321   ~vtkGlyph3DMapper();
00323 
00324   virtual int RequestUpdateExtent(vtkInformation *request,
00325     vtkInformationVector **inInfo,
00326     vtkInformationVector *outInfo);
00327 
00328   virtual int FillInputPortInformation(int port, vtkInformation *info);
00329 
00330   vtkPolyData *GetSource(int idx, vtkInformationVector *sourceInfo);
00331 
00333 
00334   vtkDataArray* GetMaskArray(vtkDataSet* input);
00335   vtkDataArray* GetSourceIndexArray(vtkDataSet* input);
00336   vtkDataArray* GetOrientationArray(vtkDataSet* input);
00337   vtkDataArray* GetScaleArray(vtkDataSet* input);
00338   vtkDataArray* GetSelectionIdArray(vtkDataSet* input);
00339   vtkUnsignedCharArray* GetColors(vtkDataSet* input);
00341 
00342   bool Scaling; // Determine whether scaling of geometry is performed
00343   double ScaleFactor; // Scale factor to use to scale geometry
00344   int ScaleMode; // Scale by scalar value or vector magnitude
00345 
00346   double Range[2]; // Range to use to perform scalar scaling
00347   bool Orient; // boolean controls whether to "orient" data
00348   bool Clamping; // whether to clamp scale factor
00349   bool SourceIndexing; // Enable/disable indexing into the glyph table
00350   bool UseSelectionIds; // Enable/disable custom pick ids
00351   bool Masking; // Enable/disable masking.
00352   int OrientationMode;
00353   bool NestedDisplayLists; // boolean
00354 
00355   unsigned int SelectionColorId;
00356   int SelectMode;
00357 
00358 private:
00359   vtkGlyph3DMapper(const vtkGlyph3DMapper&); // Not implemented.
00360   void operator=(const vtkGlyph3DMapper&); // Not implemented.
00361 
00363 
00364   bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
00365   //ETX
00366 };
00368 
00369 #endif