VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkIconGlyphFilter.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 =========================================================================*/ 00041 #ifndef __vtkIconGlyphFilter_h 00042 #define __vtkIconGlyphFilter_h 00043 00044 #include "vtkFiltersGeneralModule.h" // For export macro 00045 #include "vtkPolyDataAlgorithm.h" 00046 00047 #define VTK_ICON_GRAVITY_TOP_RIGHT 1 00048 #define VTK_ICON_GRAVITY_TOP_CENTER 2 00049 #define VTK_ICON_GRAVITY_TOP_LEFT 3 00050 #define VTK_ICON_GRAVITY_CENTER_RIGHT 4 00051 #define VTK_ICON_GRAVITY_CENTER_CENTER 5 00052 #define VTK_ICON_GRAVITY_CENTER_LEFT 6 00053 #define VTK_ICON_GRAVITY_BOTTOM_RIGHT 7 00054 #define VTK_ICON_GRAVITY_BOTTOM_CENTER 8 00055 #define VTK_ICON_GRAVITY_BOTTOM_LEFT 9 00056 00057 #define VTK_ICON_SCALING_OFF 0 00058 #define VTK_ICON_SCALING_USE_SCALING_ARRAY 1 00059 00060 00061 class VTKFILTERSGENERAL_EXPORT vtkIconGlyphFilter : public vtkPolyDataAlgorithm 00062 { 00063 public: 00065 00066 static vtkIconGlyphFilter *New(); 00067 vtkTypeMacro(vtkIconGlyphFilter,vtkPolyDataAlgorithm); 00068 void PrintSelf(ostream& os, vtkIndent indent); 00070 00072 00074 vtkSetVector2Macro(IconSize,int); 00075 vtkGetVectorMacro(IconSize,int,2); 00077 00079 00081 vtkSetVector2Macro(IconSheetSize,int); 00082 vtkGetVectorMacro(IconSheetSize,int,2); 00084 00086 00091 vtkSetVector2Macro(DisplaySize,int); 00092 vtkGetVectorMacro(DisplaySize,int,2); 00094 00096 00098 vtkSetMacro(UseIconSize,bool); 00099 vtkGetMacro(UseIconSize,bool); 00100 vtkBooleanMacro(UseIconSize, bool); 00102 00104 00107 vtkSetMacro(IconScaling,int); 00108 vtkGetMacro(IconScaling,int); 00109 void SetIconScalingToScalingOff() {this->SetIconScaling(VTK_ICON_SCALING_OFF);} 00110 void SetIconScalingToScalingArray() 00111 {this->SetIconScaling(VTK_ICON_SCALING_USE_SCALING_ARRAY);} 00113 00115 00119 vtkSetMacro(PassScalars,bool); 00120 vtkGetMacro(PassScalars,bool); 00121 vtkBooleanMacro(PassScalars,bool); 00123 00125 00129 vtkSetMacro(Gravity, int); 00130 vtkGetMacro(Gravity, int); 00131 void SetGravityToTopRight() {this->SetGravity(VTK_ICON_GRAVITY_TOP_RIGHT);}; 00132 void SetGravityToTopCenter() {this->SetGravity(VTK_ICON_GRAVITY_TOP_CENTER);}; 00133 void SetGravityToTopLeft() {this->SetGravity(VTK_ICON_GRAVITY_TOP_LEFT);}; 00134 void SetGravityToCenterRight() {this->SetGravity(VTK_ICON_GRAVITY_CENTER_RIGHT);}; 00135 void SetGravityToCenterCenter() {this->SetGravity(VTK_ICON_GRAVITY_CENTER_CENTER);}; 00136 void SetGravityToCenterLeft() {this->SetGravity(VTK_ICON_GRAVITY_CENTER_LEFT);}; 00137 void SetGravityToBottomRight() {this->SetGravity(VTK_ICON_GRAVITY_BOTTOM_RIGHT);}; 00138 void SetGravityToBottomCenter() {this->SetGravity(VTK_ICON_GRAVITY_BOTTOM_CENTER);}; 00139 void SetGravityToBottomLeft() {this->SetGravity(VTK_ICON_GRAVITY_BOTTOM_LEFT);}; 00141 00143 00145 vtkSetVector2Macro(Offset,int); 00146 vtkGetVectorMacro(Offset,int,2); 00148 00149 protected: 00150 vtkIconGlyphFilter(); 00151 ~vtkIconGlyphFilter(); 00152 00153 virtual int RequestData(vtkInformation *, 00154 vtkInformationVector **, 00155 vtkInformationVector *); 00156 00157 int IconSize[2]; // Size in pixels of an icon in an icon sheet 00158 int IconSheetSize[2]; // Size in pixels of the icon sheet 00159 int DisplaySize[2]; // Size in pixels of the icon when displayed 00160 00161 int Gravity; 00162 bool UseIconSize; 00163 int IconScaling; 00164 bool PassScalars; 00165 int Offset[2]; 00166 00167 private: 00168 vtkIconGlyphFilter(const vtkIconGlyphFilter&); // Not implemented. 00169 void operator=(const vtkIconGlyphFilter&); // Not implemented. 00170 00171 void IconConvertIndex(int id, int & j, int & k); 00172 }; 00173 00174 inline void vtkIconGlyphFilter::IconConvertIndex(int id, int & j, int & k) 00175 { 00176 int dimX = this->IconSheetSize[0]/this->IconSize[0]; 00177 int dimY = this->IconSheetSize[1]/this->IconSize[1]; 00178 00179 j = id - dimX * static_cast<int>(id/dimX); 00180 k = dimY - static_cast<int>(id/dimX) - 1; 00181 } 00182 00183 #endif