Rendering/vtkMapper.h Source File

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# Rendering/vtkMapper.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkMapper.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00073 #ifndef __vtkMapper_h
    00074 #define __vtkMapper_h
    00075
    00076 #include "vtkAbstractMapper3D.h"
    00077 #include "vtkScalarsToColors.h" // For VTK_COLOR_MODE_DEFAULT and _MAP_SCALARS
    00078
    00079 #define VTK_RESOLVE_OFF 0
    00080 #define VTK_RESOLVE_POLYGON_OFFSET 1
    00081 #define VTK_RESOLVE_SHIFT_ZBUFFER 2
    00082
    00083 #define VTK_GET_ARRAY_BY_ID 0
    00084 #define VTK_GET_ARRAY_BY_NAME 1
    00085
    00086 class vtkWindow;
    00087 class vtkRenderer;
    00088 class vtkActor;
    00089 class vtkDataSet;
    00090
    00091 class VTK_RENDERING_EXPORT vtkMapper : public vtkAbstractMapper3D
    00092 {
    00093 public:
    00094   vtkTypeRevisionMacro(vtkMapper,vtkAbstractMapper3D);
    00095   void PrintSelf(ostream& os, vtkIndent indent);
    00096
    00098   void ShallowCopy(vtkAbstractMapper *m);
    00099
    00102   unsigned long GetMTime();
    00103
    00106   virtual void Render(vtkRenderer *ren, vtkActor *a) = 0;
    00107
    00111   virtual void ReleaseGraphicsResources(vtkWindow *) {};
    00112
    00114
    00115   void SetLookupTable(vtkScalarsToColors *lut);
    00116   vtkScalarsToColors *GetLookupTable();
    00118
    00121   virtual void CreateDefaultLookupTable();
    00122
    00124
    00126   vtkSetMacro(ScalarVisibility,int);
    00127   vtkGetMacro(ScalarVisibility,int);
    00128   vtkBooleanMacro(ScalarVisibility,int);
    00130
    00132
    00139   vtkSetMacro(ColorMode,int);
    00140   vtkGetMacro(ColorMode,int);
    00141   void SetColorModeToDefault()
    00142     {this->SetColorMode(VTK_COLOR_MODE_DEFAULT);};
    00143   void SetColorModeToMapScalars()
    00144     {this->SetColorMode(VTK_COLOR_MODE_MAP_SCALARS);};
    00146
    00148   const char *GetColorModeAsString();
    00149
    00151
    00157   vtkSetMacro(UseLookupTableScalarRange,int);
    00158   vtkGetMacro(UseLookupTableScalarRange,int);
    00159   vtkBooleanMacro(UseLookupTableScalarRange,int);
    00161
    00163
    00166   vtkSetVector2Macro(ScalarRange,float);
    00167   vtkGetVectorMacro(ScalarRange,float,2);
    00169
    00171
    00176   vtkSetMacro(ImmediateModeRendering,int);
    00177   vtkGetMacro(ImmediateModeRendering,int);
    00178   vtkBooleanMacro(ImmediateModeRendering,int);
    00180
    00182
    00187   static void SetGlobalImmediateModeRendering(int val);
    00188   static void GlobalImmediateModeRenderingOn()
    00189     {vtkMapper::SetGlobalImmediateModeRendering(1);};
    00190   static void GlobalImmediateModeRenderingOff()
    00191     {vtkMapper::SetGlobalImmediateModeRendering(0);};
    00192   static int  GetGlobalImmediateModeRendering();
    00194
    00196
    00206   vtkSetMacro(ScalarMode,int);
    00207   vtkGetMacro(ScalarMode,int);
    00208   void SetScalarModeToDefault() {
    00209     this->SetScalarMode(VTK_SCALAR_MODE_DEFAULT);};
    00210   void SetScalarModeToUsePointData() {
    00211     this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_DATA);};
    00212   void SetScalarModeToUseCellData() {
    00213     this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_DATA);};
    00214   void SetScalarModeToUsePointFieldData() {
    00215     this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA);};
    00216   void SetScalarModeToUseCellFieldData() {
    00217     this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA);};
    00219
    00221
    00224   void SelectColorArray(int arrayNum);
    00225   void SelectColorArray(const char* arrayName);
    00227
    00229
    00231   void ColorByArrayComponent(int arrayNum, int component);
    00232   void ColorByArrayComponent(const char* arrayName, int component);
    00234
    00236
    00237   char* GetArrayName() { return this->ArrayName; }
    00238   int GetArrayId() { return this->ArrayId; }
    00239   int GetArrayAccessMode() { return this->ArrayAccessMode; }
    00240   int GetArrayComponent() { return this->ArrayComponent; }
    00242
    00244   const char *GetScalarModeAsString();
    00245
    00247
    00257   static void SetResolveCoincidentTopology(int val);
    00258   static int  GetResolveCoincidentTopology();
    00259   static void SetResolveCoincidentTopologyToDefault();
    00260   static void SetResolveCoincidentTopologyToOff()
    00261     {SetResolveCoincidentTopology(VTK_RESOLVE_OFF);}
    00262   static void SetResolveCoincidentTopologyToPolygonOffset()
    00263     {SetResolveCoincidentTopology(VTK_RESOLVE_POLYGON_OFFSET);}
    00264   static void SetResolveCoincidentTopologyToShiftZBuffer()
    00265     {SetResolveCoincidentTopology(VTK_RESOLVE_SHIFT_ZBUFFER);}
    00267
    00269
    00272   static void SetResolveCoincidentTopologyPolygonOffsetParameters(float factor,
    00273                                                                   float units);
    00274   static void GetResolveCoincidentTopologyPolygonOffsetParameters(float& factor,
    00275                                                                   float& units);
    00277
    00279
    00281   static void SetResolveCoincidentTopologyZShift(double val);
    00282   static double GetResolveCoincidentTopologyZShift();
    00284
    00286
    00288   virtual float *GetBounds();
    00289   virtual void GetBounds(float bounds[6])
    00290     {this->vtkAbstractMapper3D::GetBounds(bounds);};
    00292
    00294
    00297   void SetRenderTime(float time) {this->RenderTime = time;}
    00298   vtkGetMacro(RenderTime, float);
    00300
    00301   //BTX
    00303   /*! Get the input as a vtkDataSet.  This method is overridden in the
    00304       specialized mapper classes to return more specific data types. */
    00305   vtkDataSet *GetInput();
    00306   //ETX
    00308
    00310   /*! Get the input to this mapper as a vtkDataSet, instead of as a more
    00311       specialized data type that the subclass may return from GetInput().
    00312       This method is provided for use in the wrapper languages, C++
    00313       programmers should use GetInput() instead. */
    00314   vtkDataSet *GetInputAsDataSet()
    00315     {return this->GetInput();}
    00317
    00323   vtkUnsignedCharArray *MapScalars(float alpha);
    00324
    00326   virtual void Update();
    00327
    00328 protected:
    00329   vtkMapper();
    00330   ~vtkMapper();
    00331
    00332   vtkUnsignedCharArray *Colors;
    00333
    00334   vtkScalarsToColors *LookupTable;
    00335   int ScalarVisibility;
    00336   vtkTimeStamp BuildTime;
    00337   float ScalarRange[2];
    00338   int UseLookupTableScalarRange;
    00339   int ImmediateModeRendering;
    00340   int ColorMode;
    00341   int ScalarMode;
    00342
    00343   float RenderTime;
    00344
    00345   // for coloring by a component of a field data array
    00346   int ArrayId;
    00347   char ArrayName[256];
    00348   int ArrayComponent;
    00349   int ArrayAccessMode;
    00350 private:
    00351   vtkMapper(const vtkMapper&);  // Not implemented.
    00352   void operator=(const vtkMapper&);  // Not implemented.
    00353 };
    00354
    00355 #endif