VTK
dox/Filters/Sources/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 "vtkFiltersSourcesModule.h" // For export macro
00039 #include "vtkPolyDataAlgorithm.h"
00040 
00041 #define VTK_NO_GLYPH 0
00042 #define VTK_VERTEX_GLYPH 1
00043 #define VTK_DASH_GLYPH 2
00044 #define VTK_CROSS_GLYPH 3
00045 #define VTK_THICKCROSS_GLYPH 4
00046 #define VTK_TRIANGLE_GLYPH 5
00047 #define VTK_SQUARE_GLYPH 6
00048 #define VTK_CIRCLE_GLYPH 7
00049 #define VTK_DIAMOND_GLYPH 8
00050 #define VTK_ARROW_GLYPH 9
00051 #define VTK_THICKARROW_GLYPH 10
00052 #define VTK_HOOKEDARROW_GLYPH 11
00053 #define VTK_EDGEARROW_GLYPH 12
00054 
00055 class vtkPoints;
00056 class vtkUnsignedCharArray;
00057 class vtkCellArray;
00058 
00059 class VTKFILTERSSOURCES_EXPORT vtkGlyphSource2D : public vtkPolyDataAlgorithm
00060 {
00061 public:
00062   vtkTypeMacro(vtkGlyphSource2D,vtkPolyDataAlgorithm);
00063   void PrintSelf(ostream& os, vtkIndent indent);
00064 
00067   static vtkGlyphSource2D *New();
00068 
00070 
00071   vtkSetVector3Macro(Center,double);
00072   vtkGetVectorMacro(Center,double,3);
00074 
00076 
00078   vtkSetClampMacro(Scale,double,0.0,VTK_DOUBLE_MAX);
00079   vtkGetMacro(Scale,double);
00081 
00083 
00085   vtkSetClampMacro(Scale2,double,0.0,VTK_DOUBLE_MAX);
00086   vtkGetMacro(Scale2,double);
00088 
00090 
00091   vtkSetVector3Macro(Color,double);
00092   vtkGetVectorMacro(Color,double,3);
00094 
00096 
00099   vtkSetMacro(Filled,int);
00100   vtkGetMacro(Filled,int);
00101   vtkBooleanMacro(Filled,int);
00103 
00105 
00108   vtkSetMacro(Dash,int);
00109   vtkGetMacro(Dash,int);
00110   vtkBooleanMacro(Dash,int);
00112 
00114 
00117   vtkSetMacro(Cross,int);
00118   vtkGetMacro(Cross,int);
00119   vtkBooleanMacro(Cross,int);
00121 
00123 
00126   vtkSetMacro(RotationAngle,double);
00127   vtkGetMacro(RotationAngle,double);
00129 
00131 
00132   vtkSetClampMacro(GlyphType,int,VTK_NO_GLYPH,VTK_EDGEARROW_GLYPH);
00133   vtkGetMacro(GlyphType,int);
00134   void SetGlyphTypeToNone() {this->SetGlyphType(VTK_NO_GLYPH);}
00135   void SetGlyphTypeToVertex() {this->SetGlyphType(VTK_VERTEX_GLYPH);}
00136   void SetGlyphTypeToDash() {this->SetGlyphType(VTK_DASH_GLYPH);}
00137   void SetGlyphTypeToCross() {this->SetGlyphType(VTK_CROSS_GLYPH);}
00138   void SetGlyphTypeToThickCross() {this->SetGlyphType(VTK_THICKCROSS_GLYPH);}
00139   void SetGlyphTypeToTriangle() {this->SetGlyphType(VTK_TRIANGLE_GLYPH);}
00140   void SetGlyphTypeToSquare() {this->SetGlyphType(VTK_SQUARE_GLYPH);}
00141   void SetGlyphTypeToCircle() {this->SetGlyphType(VTK_CIRCLE_GLYPH);}
00142   void SetGlyphTypeToDiamond() {this->SetGlyphType(VTK_DIAMOND_GLYPH);}
00143   void SetGlyphTypeToArrow() {this->SetGlyphType(VTK_ARROW_GLYPH);}
00144   void SetGlyphTypeToThickArrow() {this->SetGlyphType(VTK_THICKARROW_GLYPH);}
00145   void SetGlyphTypeToHookedArrow() {this->SetGlyphType(VTK_HOOKEDARROW_GLYPH);}
00146   void SetGlyphTypeToEdgeArrow() {this->SetGlyphType(VTK_EDGEARROW_GLYPH);}
00148 
00149 protected:
00150   vtkGlyphSource2D();
00151   ~vtkGlyphSource2D() {};
00152 
00153   int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00154 
00155   double Center[3];
00156   double Scale;
00157   double Scale2;
00158   double Color[3];
00159   int   Filled;
00160   int   Dash;
00161   int   Cross;
00162   int   GlyphType;
00163   double RotationAngle;
00164 
00165   void TransformGlyph(vtkPoints *pts);
00166   void ConvertColor();
00167   unsigned char RGB[3];
00168 
00169   void CreateVertex(vtkPoints *pts, vtkCellArray *verts,
00170                     vtkUnsignedCharArray *colors);
00171   void CreateDash(vtkPoints *pts, vtkCellArray *lines,
00172                   vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale);
00173   void CreateCross(vtkPoints *pts, vtkCellArray *lines,
00174                    vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale);
00175   void CreateThickCross(vtkPoints *pts, vtkCellArray *lines,
00176                         vtkCellArray *polys, vtkUnsignedCharArray *colors);
00177   void CreateTriangle(vtkPoints *pts, vtkCellArray *lines,
00178                       vtkCellArray *polys, vtkUnsignedCharArray *colors);
00179   void CreateSquare(vtkPoints *pts, vtkCellArray *lines,
00180                     vtkCellArray *polys, vtkUnsignedCharArray *colors);
00181   void CreateCircle(vtkPoints *pts, vtkCellArray *lines,
00182                     vtkCellArray *polys, vtkUnsignedCharArray *colors);
00183   void CreateDiamond(vtkPoints *pts, vtkCellArray *lines,
00184                      vtkCellArray *polys, vtkUnsignedCharArray *colors);
00185   void CreateArrow(vtkPoints *pts, vtkCellArray *lines,
00186                    vtkCellArray *polys, vtkUnsignedCharArray *colors);
00187   void CreateThickArrow(vtkPoints *pts, vtkCellArray *lines,
00188                         vtkCellArray *polys, vtkUnsignedCharArray *colors);
00189   void CreateHookedArrow(vtkPoints *pts, vtkCellArray *lines,
00190                          vtkCellArray *polys, vtkUnsignedCharArray *colors);
00191   void CreateEdgeArrow(vtkPoints *pts, vtkCellArray *lines,
00192                        vtkCellArray *polys, vtkUnsignedCharArray *colors);
00193 
00194 private:
00195   vtkGlyphSource2D(const vtkGlyphSource2D&);  // Not implemented.
00196   void operator=(const vtkGlyphSource2D&);  // Not implemented.
00197 };
00198 
00199 #endif