VTK
dox/Rendering/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 "vtkMapper.h"
00034 #include "vtkGlyph3D.h" // for the constants (VTK_SCALE_BY_SCALAR, ...).
00035 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
00036 
00037 class VTK_RENDERING_EXPORT vtkGlyph3DMapper : public vtkMapper
00038 {
00039 public:
00040   static vtkGlyph3DMapper* New();
00041   vtkTypeMacro(vtkGlyph3DMapper, vtkMapper);
00042   void PrintSelf(ostream& os, vtkIndent indent);
00043   //BTX
00044   enum ArrayIndexes
00045     {
00046     SCALE = 0,
00047     SOURCE_INDEX = 1,
00048     MASK = 2,
00049     ORIENTATION = 3,
00050     SELECTIONID = 4
00051     };
00052   //ETX
00053 
00055 
00058   void SetSourceConnection(int idx, vtkAlgorithmOutput* algOutput);
00059   void SetSourceConnection(vtkAlgorithmOutput* algOutput)
00060     {
00061       this->SetSourceConnection(0, algOutput);
00062     }
00064 
00066   void SetSource(int idx, vtkPolyData *pd);
00067 
00070   void SetSource(vtkPolyData *pd);
00071 
00073   vtkPolyData *GetSource(int idx=0);
00074 
00076 
00079   vtkSetMacro(Scaling, bool);
00080   vtkBooleanMacro(Scaling, bool);
00081   vtkGetMacro(Scaling, bool);
00083 
00085 
00089   vtkSetMacro(ScaleMode, int);
00090   vtkGetMacro(ScaleMode, int);
00092 
00094 
00096   vtkSetMacro(ScaleFactor,double);
00097   vtkGetMacro(ScaleFactor,double);
00099 
00100   //BTX
00101   enum ScaleModes
00102     {
00103     NO_DATA_SCALING = 0,
00104     SCALE_BY_MAGNITUDE = 1,
00105     SCALE_BY_COMPONENTS = 2
00106     };
00107   //ETX
00108   void SetScaleModeToScaleByMagnitude()
00109     { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
00110   void SetScaleModeToScaleByVectorComponents()
00111     { this->SetScaleMode(SCALE_BY_COMPONENTS); }
00112   void SetScaleModeToNoDataScaling()
00113     { this->SetScaleMode(NO_DATA_SCALING); }
00114   const char *GetScaleModeAsString();
00115 
00117 
00118   vtkSetVector2Macro(Range,double);
00119   vtkGetVectorMacro(Range,double,2);
00121 
00123 
00125   vtkSetMacro(Orient, bool);
00126   vtkGetMacro(Orient, bool);
00127   vtkBooleanMacro(Orient, bool);
00129 
00131 
00134   vtkSetClampMacro(OrientationMode, int, DIRECTION, ROTATION);
00135   vtkGetMacro(OrientationMode, int);
00136   void SetOrientationModeToDirection()
00137     { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
00138   void SetOrientationModeToRotation()
00139     { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
00140   const char* GetOrientationModeAsString();
00141   //BTX
00142   enum OrientationModes
00143     {
00144     DIRECTION=0,
00145     ROTATION=1
00146     };
00147   //ETX
00149 
00151 
00153   vtkSetMacro(Clamping, bool);
00154   vtkGetMacro(Clamping, bool);
00155   vtkBooleanMacro(Clamping, bool);
00157 
00159 
00164   vtkSetMacro(SourceIndexing, bool);
00165   vtkGetMacro(SourceIndexing, bool);
00166   vtkBooleanMacro(SourceIndexing, bool);
00168 
00170 
00172   vtkSetMacro(UseSelectionIds, bool);
00173   vtkBooleanMacro(UseSelectionIds, bool);
00174   vtkGetMacro(UseSelectionIds, bool);
00176 
00178   virtual double *GetBounds();
00179 
00182   virtual void GetBounds(double bounds[6]);
00183 
00185   virtual void Render(vtkRenderer *ren, vtkActor *act);
00186 
00188 
00193   vtkSetMacro(NestedDisplayLists, bool);
00194   vtkGetMacro(NestedDisplayLists, bool);
00195   vtkBooleanMacro(NestedDisplayLists, bool);
00197 
00199 
00204   vtkSetMacro(Masking, bool);
00205   vtkGetMacro(Masking, bool);
00206   vtkBooleanMacro(Masking, bool);
00208 
00213   void SetMaskArray(const char* maskarrayname);
00214 
00223   void SetMaskArray(int fieldAttributeType);
00224 
00238   void SetOrientationArray(const char* orientationarrayname);
00239 
00256   void SetOrientationArray(int fieldAttributeType);
00257 
00261   void SetScaleArray(const char* scalarsarrayname);
00262 
00266   void SetScaleArray(int fieldAttributeType);
00267 
00272   void SetSourceIndexArray(const char* arrayname);
00273 
00278   void SetSourceIndexArray(int fieldAttributeType);
00279 
00285   void SetSelectionIdArray(const char* selectionIdArrayName);
00286 
00292   void SetSelectionIdArray(int fieldAttributeType);
00293 
00295 
00298   vtkSetMacro(SelectionColorId,unsigned int);
00299   vtkGetMacro(SelectionColorId,unsigned int);
00301 
00303 
00304   vtkSetMacro(SelectMode, int);
00306 
00308 
00312   virtual bool GetSupportsSelection()
00313     { return true; }
00314   //BTX
00315 protected:
00316   vtkGlyph3DMapper();
00317   ~vtkGlyph3DMapper();
00319 
00320   virtual int RequestUpdateExtent(vtkInformation *request,
00321     vtkInformationVector **inInfo,
00322     vtkInformationVector *outInfo);
00323 
00324   virtual int FillInputPortInformation(int port,
00325     vtkInformation *info);
00326 
00327   vtkPolyData *GetSource(int idx, vtkInformationVector *sourceInfo);
00328 
00330 
00331   vtkDataArray* GetMaskArray(vtkDataSet* input);
00332   vtkDataArray* GetSourceIndexArray(vtkDataSet* input);
00333   vtkDataArray* GetOrientationArray(vtkDataSet* input);
00334   vtkDataArray* GetScaleArray(vtkDataSet* input);
00335   vtkDataArray* GetSelectionIdArray(vtkDataSet* input);
00336   vtkUnsignedCharArray* GetColors(vtkDataSet* input);
00338 
00339   bool Scaling; // Determine whether scaling of geometry is performed
00340   double ScaleFactor; // Scale factor to use to scale geometry
00341   int ScaleMode; // Scale by scalar value or vector magnitude
00342 
00343   double Range[2]; // Range to use to perform scalar scaling
00344   bool Orient; // boolean controls whether to "orient" data
00345   bool Clamping; // whether to clamp scale factor
00346   bool SourceIndexing; // Enable/disable indexing into the glyph table
00347   bool UseSelectionIds; // Enable/disable custom pick ids
00348   bool Masking; // Enable/disable masking.
00349   int OrientationMode;
00350   bool NestedDisplayLists; // boolean
00351 
00352   unsigned int SelectionColorId;
00353   int SelectMode;
00354 
00355 private:
00356   vtkGlyph3DMapper(const vtkGlyph3DMapper&); // Not implemented.
00357   void operator=(const vtkGlyph3DMapper&); // Not implemented.
00358 
00360 
00361   bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
00362   //ETX
00363 };
00365 
00366 #endif