00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00032 #ifndef __vtkIconGlyphFilter_h
00033 #define __vtkIconGlyphFilter_h
00034
00035 #include "vtkPolyDataAlgorithm.h"
00036
00037 #define VTK_ICON_GRAVITY_TOP_RIGHT 1
00038 #define VTK_ICON_GRAVITY_TOP_CENTER 2
00039 #define VTK_ICON_GRAVITY_TOP_LEFT 3
00040 #define VTK_ICON_GRAVITY_CENTER_RIGHT 4
00041 #define VTK_ICON_GRAVITY_CENTER_CENTER 5
00042 #define VTK_ICON_GRAVITY_CENTER_LEFT 6
00043 #define VTK_ICON_GRAVITY_BOTTOM_RIGHT 7
00044 #define VTK_ICON_GRAVITY_BOTTOM_CENTER 8
00045 #define VTK_ICON_GRAVITY_BOTTOM_LEFT 9
00046
00047
00048 class VTK_GRAPHICS_EXPORT vtkIconGlyphFilter : public vtkPolyDataAlgorithm
00049 {
00050 public:
00051
00053 static vtkIconGlyphFilter *New();
00054 vtkTypeRevisionMacro(vtkIconGlyphFilter,vtkPolyDataAlgorithm);
00055 void PrintSelf(ostream& os, vtkIndent indent);
00057
00059
00060 vtkSetVector2Macro(IconSize,int);
00061 vtkGetVectorMacro(IconSize,int,2);
00063
00065
00066 vtkSetVector2Macro(IconSheetSize,int);
00067 vtkGetVectorMacro(IconSheetSize,int,2);
00069
00070
00072
00074 void SetUseIconSize(bool b);
00075 bool GetUseIconSize();
00076 vtkBooleanMacro(UseIconSize, bool);
00078
00080
00084 vtkSetMacro(Gravity, int);
00085 vtkGetMacro(Gravity, int);
00086 void SetGravityToTopRight() {this->SetGravity(VTK_ICON_GRAVITY_TOP_RIGHT);};
00087 void SetGravityToTopCenter() {this->SetGravity(VTK_ICON_GRAVITY_TOP_CENTER);};
00088 void SetGravityToTopLeft() {this->SetGravity(VTK_ICON_GRAVITY_TOP_LEFT);};
00089 void SetGravityToCenterRight() {this->SetGravity(VTK_ICON_GRAVITY_CENTER_RIGHT);};
00090 void SetGravityToCenterCenter() {this->SetGravity(VTK_ICON_GRAVITY_CENTER_CENTER);};
00091 void SetGravityToCenterLeft() {this->SetGravity(VTK_ICON_GRAVITY_CENTER_LEFT);};
00092 void SetGravityToBottomRight() {this->SetGravity(VTK_ICON_GRAVITY_BOTTOM_RIGHT);};
00093 void SetGravityToBottomCenter() {this->SetGravity(VTK_ICON_GRAVITY_BOTTOM_CENTER);};
00094 void SetGravityToBottomLeft() {this->SetGravity(VTK_ICON_GRAVITY_BOTTOM_LEFT);};
00096
00097 protected:
00098 vtkIconGlyphFilter();
00099 ~vtkIconGlyphFilter();
00100
00101 virtual int RequestData(vtkInformation *,
00102 vtkInformationVector **,
00103 vtkInformationVector *);
00104
00105 int IconSize[2];
00106 int IconSheetSize[2];
00107
00108 int Gravity;
00109 bool UseIconSize;
00110
00111 private:
00112 vtkIconGlyphFilter(const vtkIconGlyphFilter&);
00113 void operator=(const vtkIconGlyphFilter&);
00114
00115 void IconConvertIndex(int id, int & j, int & k);
00116 };
00117
00118 inline void vtkIconGlyphFilter::IconConvertIndex(int id, int & j, int & k)
00119 {
00120 int dimX = this->IconSheetSize[0]/this->IconSize[0];
00121 int dimY = this->IconSheetSize[1]/this->IconSize[1];
00122
00123 j = id - dimX * static_cast<int>(id/dimX);
00124 k = dimY - static_cast<int>(id/dimX) - 1;
00125 }
00126
00127 #endif