VTK
dox/Graphics/vtkGlyphSource2D.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkGlyphSource2D.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 =========================================================================*/
00035 #ifndef __vtkGlyphSource2D_h
00036 #define __vtkGlyphSource2D_h
00037 
00038 #include "vtkPolyDataAlgorithm.h"
00039 
00040 #define VTK_NO_GLYPH 0
00041 #define VTK_VERTEX_GLYPH 1
00042 #define VTK_DASH_GLYPH 2
00043 #define VTK_CROSS_GLYPH 3
00044 #define VTK_THICKCROSS_GLYPH 4
00045 #define VTK_TRIANGLE_GLYPH 5
00046 #define VTK_SQUARE_GLYPH 6
00047 #define VTK_CIRCLE_GLYPH 7
00048 #define VTK_DIAMOND_GLYPH 8
00049 #define VTK_ARROW_GLYPH 9
00050 #define VTK_THICKARROW_GLYPH 10
00051 #define VTK_HOOKEDARROW_GLYPH 11
00052 #define VTK_EDGEARROW_GLYPH 12
00053 
00054 class vtkPoints;
00055 class vtkUnsignedCharArray;
00056 class vtkCellArray;
00057 
00058 class VTK_GRAPHICS_EXPORT vtkGlyphSource2D : public vtkPolyDataAlgorithm 
00059 {
00060 public:
00061   vtkTypeMacro(vtkGlyphSource2D,vtkPolyDataAlgorithm);
00062   void PrintSelf(ostream& os, vtkIndent indent);
00063 
00066   static vtkGlyphSource2D *New();
00067 
00069 
00070   vtkSetVector3Macro(Center,double);
00071   vtkGetVectorMacro(Center,double,3);
00073 
00075 
00077   vtkSetClampMacro(Scale,double,0.0,VTK_DOUBLE_MAX);
00078   vtkGetMacro(Scale,double);
00080 
00082 
00084   vtkSetClampMacro(Scale2,double,0.0,VTK_DOUBLE_MAX);
00085   vtkGetMacro(Scale2,double);
00087 
00089 
00090   vtkSetVector3Macro(Color,double);
00091   vtkGetVectorMacro(Color,double,3);
00093 
00095 
00098   vtkSetMacro(Filled,int);
00099   vtkGetMacro(Filled,int);
00100   vtkBooleanMacro(Filled,int);
00102 
00104 
00107   vtkSetMacro(Dash,int);
00108   vtkGetMacro(Dash,int);
00109   vtkBooleanMacro(Dash,int);
00111 
00113 
00116   vtkSetMacro(Cross,int);
00117   vtkGetMacro(Cross,int);
00118   vtkBooleanMacro(Cross,int);
00120 
00122 
00125   vtkSetMacro(RotationAngle,double);
00126   vtkGetMacro(RotationAngle,double);
00128 
00130 
00131   vtkSetClampMacro(GlyphType,int,VTK_NO_GLYPH,VTK_EDGEARROW_GLYPH);
00132   vtkGetMacro(GlyphType,int);
00133   void SetGlyphTypeToNone() {this->SetGlyphType(VTK_NO_GLYPH);}  
00134   void SetGlyphTypeToVertex() {this->SetGlyphType(VTK_VERTEX_GLYPH);}  
00135   void SetGlyphTypeToDash() {this->SetGlyphType(VTK_DASH_GLYPH);}  
00136   void SetGlyphTypeToCross() {this->SetGlyphType(VTK_CROSS_GLYPH);}
00137   void SetGlyphTypeToThickCross() {this->SetGlyphType(VTK_THICKCROSS_GLYPH);}
00138   void SetGlyphTypeToTriangle() {this->SetGlyphType(VTK_TRIANGLE_GLYPH);}
00139   void SetGlyphTypeToSquare() {this->SetGlyphType(VTK_SQUARE_GLYPH);}
00140   void SetGlyphTypeToCircle() {this->SetGlyphType(VTK_CIRCLE_GLYPH);}
00141   void SetGlyphTypeToDiamond() {this->SetGlyphType(VTK_DIAMOND_GLYPH);}
00142   void SetGlyphTypeToArrow() {this->SetGlyphType(VTK_ARROW_GLYPH);}
00143   void SetGlyphTypeToThickArrow() {this->SetGlyphType(VTK_THICKARROW_GLYPH);}
00144   void SetGlyphTypeToHookedArrow() {this->SetGlyphType(VTK_HOOKEDARROW_GLYPH);}
00145   void SetGlyphTypeToEdgeArrow() {this->SetGlyphType(VTK_EDGEARROW_GLYPH);}
00147 
00148 protected:
00149   vtkGlyphSource2D();
00150   ~vtkGlyphSource2D() {};
00151 
00152   int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00153 
00154   double Center[3];
00155   double Scale;
00156   double Scale2;
00157   double Color[3];
00158   int   Filled;
00159   int   Dash;
00160   int   Cross;
00161   int   GlyphType;
00162   double RotationAngle;
00163   
00164   void TransformGlyph(vtkPoints *pts);
00165   void ConvertColor();
00166   unsigned char RGB[3];
00167   
00168   void CreateVertex(vtkPoints *pts, vtkCellArray *verts, 
00169                     vtkUnsignedCharArray *colors);
00170   void CreateDash(vtkPoints *pts, vtkCellArray *lines, 
00171                   vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale);
00172   void CreateCross(vtkPoints *pts, vtkCellArray *lines, 
00173                    vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale);
00174   void CreateThickCross(vtkPoints *pts, vtkCellArray *lines, 
00175                         vtkCellArray *polys, vtkUnsignedCharArray *colors);
00176   void CreateTriangle(vtkPoints *pts, vtkCellArray *lines,
00177                       vtkCellArray *polys, vtkUnsignedCharArray *colors);
00178   void CreateSquare(vtkPoints *pts, vtkCellArray *lines,
00179                     vtkCellArray *polys, vtkUnsignedCharArray *colors);
00180   void CreateCircle(vtkPoints *pts, vtkCellArray *lines,
00181                     vtkCellArray *polys, vtkUnsignedCharArray *colors);
00182   void CreateDiamond(vtkPoints *pts, vtkCellArray *lines,
00183                      vtkCellArray *polys, vtkUnsignedCharArray *colors);
00184   void CreateArrow(vtkPoints *pts, vtkCellArray *lines,
00185                    vtkCellArray *polys, vtkUnsignedCharArray *colors);
00186   void CreateThickArrow(vtkPoints *pts, vtkCellArray *lines,
00187                         vtkCellArray *polys, vtkUnsignedCharArray *colors);
00188   void CreateHookedArrow(vtkPoints *pts, vtkCellArray *lines,
00189                          vtkCellArray *polys, vtkUnsignedCharArray *colors);
00190   void CreateEdgeArrow(vtkPoints *pts, vtkCellArray *lines,
00191                        vtkCellArray *polys, vtkUnsignedCharArray *colors);
00192 
00193 private:
00194   vtkGlyphSource2D(const vtkGlyphSource2D&);  // Not implemented.
00195   void operator=(const vtkGlyphSource2D&);  // Not implemented.
00196 };
00197 
00198 #endif