VTK
|
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 }; 00051 //ETX 00052 00054 00057 void SetSourceConnection(int idx, vtkAlgorithmOutput* algOutput); 00058 void SetSourceConnection(vtkAlgorithmOutput* algOutput) 00059 { 00060 this->SetSourceConnection(0, algOutput); 00061 } 00063 00065 void SetSource(int idx, vtkPolyData *pd); 00066 00069 void SetSource(vtkPolyData *pd); 00070 00072 vtkPolyData *GetSource(int idx=0); 00073 00075 00078 vtkSetMacro(Scaling, bool); 00079 vtkBooleanMacro(Scaling, bool); 00080 vtkGetMacro(Scaling, bool); 00082 00084 00088 vtkSetMacro(ScaleMode, int); 00089 vtkGetMacro(ScaleMode, int); 00091 00093 00095 vtkSetMacro(ScaleFactor,double); 00096 vtkGetMacro(ScaleFactor,double); 00098 00099 //BTX 00100 enum ScaleModes 00101 { 00102 NO_DATA_SCALING = 0, 00103 SCALE_BY_MAGNITUDE = 1, 00104 SCALE_BY_COMPONENTS = 2 00105 }; 00106 //ETX 00107 void SetScaleModeToScaleByMagnitude() 00108 { this->SetScaleMode(SCALE_BY_MAGNITUDE); } 00109 void SetScaleModeToScaleByVectorComponents() 00110 { this->SetScaleMode(SCALE_BY_COMPONENTS); } 00111 void SetScaleModeToNoDataScaling() 00112 { this->SetScaleMode(NO_DATA_SCALING); } 00113 const char *GetScaleModeAsString(); 00114 00116 00117 vtkSetVector2Macro(Range,double); 00118 vtkGetVectorMacro(Range,double,2); 00120 00122 00124 vtkSetMacro(Orient, bool); 00125 vtkGetMacro(Orient, bool); 00126 vtkBooleanMacro(Orient, bool); 00128 00130 00133 vtkSetClampMacro(OrientationMode, int, DIRECTION, ROTATION); 00134 vtkGetMacro(OrientationMode, int); 00135 void SetOrientationModeToDirection() 00136 { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); } 00137 void SetOrientationModeToRotation() 00138 { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); } 00139 const char* GetOrientationModeAsString(); 00140 //BTX 00141 enum OrientationModes 00142 { 00143 DIRECTION=0, 00144 ROTATION=1 00145 }; 00146 //ETX 00148 00150 00152 vtkSetMacro(Clamping, bool); 00153 vtkGetMacro(Clamping, bool); 00154 vtkBooleanMacro(Clamping, bool); 00156 00158 00163 vtkSetMacro(SourceIndexing, bool); 00164 vtkGetMacro(SourceIndexing, bool); 00165 vtkBooleanMacro(SourceIndexing, bool); 00167 00169 virtual double *GetBounds(); 00170 00173 virtual void GetBounds(double bounds[6]); 00174 00176 virtual void Render(vtkRenderer *ren, vtkActor *act); 00177 00179 00184 vtkSetMacro(NestedDisplayLists, bool); 00185 vtkGetMacro(NestedDisplayLists, bool); 00186 vtkBooleanMacro(NestedDisplayLists, bool); 00188 00190 00195 vtkSetMacro(Masking, bool); 00196 vtkGetMacro(Masking, bool); 00197 vtkBooleanMacro(Masking, bool); 00199 00204 void SetMaskArray(const char* maskarrayname); 00205 00214 void SetMaskArray(int fieldAttributeType); 00215 00229 void SetOrientationArray(const char* orientationarrayname); 00230 00247 void SetOrientationArray(int fieldAttributeType); 00248 00252 void SetScaleArray(const char* scalarsarrayname); 00253 00257 void SetScaleArray(int fieldAttributeType); 00258 00263 void SetSourceIndexArray(const char* arrayname); 00264 00269 void SetSourceIndexArray(int fieldAttributeType); 00270 00272 00275 vtkSetMacro(SelectionColorId,unsigned int); 00276 vtkGetMacro(SelectionColorId,unsigned int); 00278 00280 00281 vtkSetMacro(SelectMode, int); 00283 00285 00289 virtual bool GetSupportsSelection() 00290 { return true; } 00291 //BTX 00292 protected: 00293 vtkGlyph3DMapper(); 00294 ~vtkGlyph3DMapper(); 00296 00297 virtual int RequestUpdateExtent(vtkInformation *request, 00298 vtkInformationVector **inInfo, 00299 vtkInformationVector *outInfo); 00300 00301 virtual int FillInputPortInformation(int port, 00302 vtkInformation *info); 00303 00304 vtkPolyData *GetSource(int idx, vtkInformationVector *sourceInfo); 00305 00307 00308 vtkDataArray* GetMaskArray(vtkDataSet* input); 00309 vtkDataArray* GetSourceIndexArray(vtkDataSet* input); 00310 vtkDataArray* GetOrientationArray(vtkDataSet* input); 00311 vtkDataArray* GetScaleArray(vtkDataSet* input); 00312 vtkUnsignedCharArray* GetColors(vtkDataSet* input); 00314 00315 bool Scaling; // Determine whether scaling of geometry is performed 00316 double ScaleFactor; // Scale factor to use to scale geometry 00317 int ScaleMode; // Scale by scalar value or vector magnitude 00318 00319 double Range[2]; // Range to use to perform scalar scaling 00320 bool Orient; // boolean controls whether to "orient" data 00321 bool Clamping; // whether to clamp scale factor 00322 bool SourceIndexing; // Enable/disable indexing into the glyph table 00323 bool Masking; // Enable/disable masking. 00324 int OrientationMode; 00325 bool NestedDisplayLists; // boolean 00326 00327 unsigned int SelectionColorId; 00328 int SelectMode; 00329 00330 private: 00331 vtkGlyph3DMapper(const vtkGlyph3DMapper&); // Not implemented. 00332 void operator=(const vtkGlyph3DMapper&); // Not implemented. 00333 00335 00336 bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]); 00337 //ETX 00338 }; 00340 00341 #endif