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

Graphics/vtkGlyphSource2D.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkGlyphSource2D.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 =========================================================================*/
00039 #ifndef __vtkGlyphSource2D_h
00040 #define __vtkGlyphSource2D_h
00041 
00042 #include "vtkPolyDataSource.h"
00043 
00044 #define VTK_NO_GLYPH 0
00045 #define VTK_VERTEX_GLYPH 1
00046 #define VTK_DASH_GLYPH 2
00047 #define VTK_CROSS_GLYPH 3
00048 #define VTK_THICKCROSS_GLYPH 4
00049 #define VTK_TRIANGLE_GLYPH 5
00050 #define VTK_SQUARE_GLYPH 6
00051 #define VTK_CIRCLE_GLYPH 7
00052 #define VTK_DIAMOND_GLYPH 8
00053 #define VTK_ARROW_GLYPH 9
00054 #define VTK_THICKARROW_GLYPH 10
00055 #define VTK_HOOKEDARROW_GLYPH 11
00056 
00057 class vtkPoints;
00058 class vtkUnsignedCharArray;
00059 class vtkCellArray;
00060 
00061 class VTK_GRAPHICS_EXPORT vtkGlyphSource2D : public vtkPolyDataSource 
00062 {
00063 public:
00064   vtkTypeRevisionMacro(vtkGlyphSource2D,vtkPolyDataSource);
00065   void PrintSelf(ostream& os, vtkIndent indent);
00066 
00069   static vtkGlyphSource2D *New();
00070 
00072 
00073   vtkSetVector3Macro(Center,float);
00074   vtkGetVectorMacro(Center,float,3);
00076 
00078 
00080   vtkSetClampMacro(Scale,float,0.0,VTK_LARGE_FLOAT);
00081   vtkGetMacro(Scale,float);
00083 
00085 
00087   vtkSetClampMacro(Scale2,float,0.0,VTK_LARGE_FLOAT);
00088   vtkGetMacro(Scale2,float);
00090 
00092 
00093   vtkSetVector3Macro(Color,float);
00094   vtkGetVectorMacro(Color,float,3);
00096 
00098 
00101   vtkSetMacro(Filled,int);
00102   vtkGetMacro(Filled,int);
00103   vtkBooleanMacro(Filled,int);
00105 
00107 
00110   vtkSetMacro(Dash,int);
00111   vtkGetMacro(Dash,int);
00112   vtkBooleanMacro(Dash,int);
00114 
00116 
00119   vtkSetMacro(Cross,int);
00120   vtkGetMacro(Cross,int);
00121   vtkBooleanMacro(Cross,int);
00123 
00125 
00128   vtkSetMacro(RotationAngle,float);
00129   vtkGetMacro(RotationAngle,float);
00131 
00133 
00134   vtkSetClampMacro(GlyphType,int,VTK_NO_GLYPH,VTK_HOOKEDARROW_GLYPH);
00135   vtkGetMacro(GlyphType,int);
00136   void SetGlyphTypeToNone() {this->SetGlyphType(VTK_NO_GLYPH);}  
00137   void SetGlyphTypeToVertex() {this->SetGlyphType(VTK_VERTEX_GLYPH);}  
00138   void SetGlyphTypeToDash() {this->SetGlyphType(VTK_DASH_GLYPH);}  
00139   void SetGlyphTypeToCross() {this->SetGlyphType(VTK_CROSS_GLYPH);}
00140   void SetGlyphTypeToThickCross() {this->SetGlyphType(VTK_THICKCROSS_GLYPH);}
00141   void SetGlyphTypeToTriangle() {this->SetGlyphType(VTK_TRIANGLE_GLYPH);}
00142   void SetGlyphTypeToSquare() {this->SetGlyphType(VTK_SQUARE_GLYPH);}
00143   void SetGlyphTypeToCircle() {this->SetGlyphType(VTK_CIRCLE_GLYPH);}
00144   void SetGlyphTypeToDiamond() {this->SetGlyphType(VTK_DIAMOND_GLYPH);}
00145   void SetGlyphTypeToArrow() {this->SetGlyphType(VTK_ARROW_GLYPH);}
00146   void SetGlyphTypeToThickArrow() {this->SetGlyphType(VTK_THICKARROW_GLYPH);}
00147   void SetGlyphTypeToHookedArrow() {this->SetGlyphType(VTK_HOOKEDARROW_GLYPH);}
00149 
00150 protected:
00151   vtkGlyphSource2D();
00152   ~vtkGlyphSource2D() {};
00153 
00154   void Execute();
00155 
00156   float Center[3];
00157   float Scale;
00158   float Scale2;
00159   float Color[3];
00160   int   Filled;
00161   int   Dash;
00162   int   Cross;
00163   int   GlyphType;
00164   float RotationAngle;
00165   
00166   void TransformGlyph(vtkPoints *pts);
00167   void ConvertColor();
00168   unsigned char RGB[3];
00169   
00170   void CreateVertex(vtkPoints *pts, vtkCellArray *verts, 
00171                     vtkUnsignedCharArray *colors);
00172   void CreateDash(vtkPoints *pts, vtkCellArray *lines, 
00173                   vtkCellArray *polys, vtkUnsignedCharArray *colors, float scale);
00174   void CreateCross(vtkPoints *pts, vtkCellArray *lines, 
00175                    vtkCellArray *polys, vtkUnsignedCharArray *colors, float scale);
00176   void CreateThickCross(vtkPoints *pts, vtkCellArray *lines, 
00177                         vtkCellArray *polys, vtkUnsignedCharArray *colors);
00178   void CreateTriangle(vtkPoints *pts, vtkCellArray *lines,
00179                       vtkCellArray *polys, vtkUnsignedCharArray *colors);
00180   void CreateSquare(vtkPoints *pts, vtkCellArray *lines,
00181                     vtkCellArray *polys, vtkUnsignedCharArray *colors);
00182   void CreateCircle(vtkPoints *pts, vtkCellArray *lines,
00183                     vtkCellArray *polys, vtkUnsignedCharArray *colors);
00184   void CreateDiamond(vtkPoints *pts, vtkCellArray *lines,
00185                      vtkCellArray *polys, vtkUnsignedCharArray *colors);
00186   void CreateArrow(vtkPoints *pts, vtkCellArray *lines,
00187                    vtkCellArray *polys, vtkUnsignedCharArray *colors);
00188   void CreateThickArrow(vtkPoints *pts, vtkCellArray *lines,
00189                         vtkCellArray *polys, vtkUnsignedCharArray *colors);
00190   void CreateHookedArrow(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
00199 
00200