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