00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00041 #ifndef __vtkIconGlyphFilter_h
00042 #define __vtkIconGlyphFilter_h
00043
00044 #include "vtkPolyDataAlgorithm.h"
00045
00046 #define VTK_ICON_GRAVITY_TOP_RIGHT 1
00047 #define VTK_ICON_GRAVITY_TOP_CENTER 2
00048 #define VTK_ICON_GRAVITY_TOP_LEFT 3
00049 #define VTK_ICON_GRAVITY_CENTER_RIGHT 4
00050 #define VTK_ICON_GRAVITY_CENTER_CENTER 5
00051 #define VTK_ICON_GRAVITY_CENTER_LEFT 6
00052 #define VTK_ICON_GRAVITY_BOTTOM_RIGHT 7
00053 #define VTK_ICON_GRAVITY_BOTTOM_CENTER 8
00054 #define VTK_ICON_GRAVITY_BOTTOM_LEFT 9
00055
00056 #define VTK_ICON_SCALING_OFF 0
00057 #define VTK_ICON_SCALING_USE_SCALING_ARRAY 1
00058
00059
00060 class VTK_GRAPHICS_EXPORT vtkIconGlyphFilter : public vtkPolyDataAlgorithm
00061 {
00062 public:
00064
00065 static vtkIconGlyphFilter *New();
00066 vtkTypeMacro(vtkIconGlyphFilter,vtkPolyDataAlgorithm);
00067 void PrintSelf(ostream& os, vtkIndent indent);
00069
00071
00073 vtkSetVector2Macro(IconSize,int);
00074 vtkGetVectorMacro(IconSize,int,2);
00076
00078
00080 vtkSetVector2Macro(IconSheetSize,int);
00081 vtkGetVectorMacro(IconSheetSize,int,2);
00083
00085
00090 vtkSetVector2Macro(DisplaySize,int);
00091 vtkGetVectorMacro(DisplaySize,int,2);
00093
00095
00097 vtkSetMacro(UseIconSize,bool);
00098 vtkGetMacro(UseIconSize,bool);
00099 vtkBooleanMacro(UseIconSize, bool);
00101
00103
00106 vtkSetMacro(IconScaling,int);
00107 vtkGetMacro(IconScaling,int);
00108 void SetIconScalingToScalingOff() {this->SetIconScaling(VTK_ICON_SCALING_OFF);}
00109 void SetIconScalingToScalingArray()
00110 {this->SetIconScaling(VTK_ICON_SCALING_USE_SCALING_ARRAY);}
00112
00114
00118 vtkSetMacro(PassScalars,bool);
00119 vtkGetMacro(PassScalars,bool);
00120 vtkBooleanMacro(PassScalars,bool);
00122
00124
00128 vtkSetMacro(Gravity, int);
00129 vtkGetMacro(Gravity, int);
00130 void SetGravityToTopRight() {this->SetGravity(VTK_ICON_GRAVITY_TOP_RIGHT);};
00131 void SetGravityToTopCenter() {this->SetGravity(VTK_ICON_GRAVITY_TOP_CENTER);};
00132 void SetGravityToTopLeft() {this->SetGravity(VTK_ICON_GRAVITY_TOP_LEFT);};
00133 void SetGravityToCenterRight() {this->SetGravity(VTK_ICON_GRAVITY_CENTER_RIGHT);};
00134 void SetGravityToCenterCenter() {this->SetGravity(VTK_ICON_GRAVITY_CENTER_CENTER);};
00135 void SetGravityToCenterLeft() {this->SetGravity(VTK_ICON_GRAVITY_CENTER_LEFT);};
00136 void SetGravityToBottomRight() {this->SetGravity(VTK_ICON_GRAVITY_BOTTOM_RIGHT);};
00137 void SetGravityToBottomCenter() {this->SetGravity(VTK_ICON_GRAVITY_BOTTOM_CENTER);};
00138 void SetGravityToBottomLeft() {this->SetGravity(VTK_ICON_GRAVITY_BOTTOM_LEFT);};
00140
00142
00144 vtkSetVector2Macro(Offset,int);
00145 vtkGetVectorMacro(Offset,int,2);
00147
00148 protected:
00149 vtkIconGlyphFilter();
00150 ~vtkIconGlyphFilter();
00151
00152 virtual int RequestData(vtkInformation *,
00153 vtkInformationVector **,
00154 vtkInformationVector *);
00155
00156 int IconSize[2];
00157 int IconSheetSize[2];
00158 int DisplaySize[2];
00159
00160 int Gravity;
00161 bool UseIconSize;
00162 int IconScaling;
00163 bool PassScalars;
00164 int Offset[2];
00165
00166 private:
00167 vtkIconGlyphFilter(const vtkIconGlyphFilter&);
00168 void operator=(const vtkIconGlyphFilter&);
00169
00170 void IconConvertIndex(int id, int & j, int & k);
00171 };
00172
00173 inline void vtkIconGlyphFilter::IconConvertIndex(int id, int & j, int & k)
00174 {
00175 int dimX = this->IconSheetSize[0]/this->IconSize[0];
00176 int dimY = this->IconSheetSize[1]/this->IconSize[1];
00177
00178 j = id - dimX * static_cast<int>(id/dimX);
00179 k = dimY - static_cast<int>(id/dimX) - 1;
00180 }
00181
00182 #endif