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

Graphics/vtkButtonSource.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkButtonSource.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 =========================================================================*/
00055 #ifndef __vtkButtonSource_h
00056 #define __vtkButtonSource_h
00057 
00058 #include "vtkPolyDataSource.h"
00059 
00060 class vtkCellArray;
00061 class vtkFloatArray;
00062 class vtkPoints;
00063 
00064 #define VTK_TEXTURE_STYLE_FIT_IMAGE    0
00065 #define VTK_TEXTURE_STYLE_PROPORTIONAL 1
00066 
00067 class VTK_GRAPHICS_EXPORT vtkButtonSource : public vtkPolyDataSource 
00068 {
00069 public:
00070   void PrintSelf(ostream& os, vtkIndent indent);
00071   vtkTypeRevisionMacro(vtkButtonSource,vtkPolyDataSource);
00072 
00074   static vtkButtonSource *New();
00075 
00077 
00078   vtkSetClampMacro(Width,float,0.0,VTK_LARGE_FLOAT);
00079   vtkGetMacro(Width,float);
00081 
00083 
00084   vtkSetClampMacro(Height,float,0.0,VTK_LARGE_FLOAT);
00085   vtkGetMacro(Height,float);
00087 
00089 
00090   vtkSetClampMacro(Depth,float,0.0,VTK_LARGE_FLOAT);
00091   vtkGetMacro(Depth,float);
00093 
00095 
00102   vtkSetClampMacro(RadialRatio,float,1.0,VTK_LARGE_FLOAT);
00103   vtkGetMacro(RadialRatio,float);
00105 
00107 
00109   vtkSetClampMacro(CircumferentialResolution,int,4,VTK_LARGE_INTEGER);
00110   vtkGetMacro(CircumferentialResolution,int);
00112 
00114 
00116   vtkSetClampMacro(TextureResolution,int,1,VTK_LARGE_INTEGER);
00117   vtkGetMacro(TextureResolution,int);
00119 
00121 
00123   vtkSetClampMacro(ShoulderResolution,int,1,VTK_LARGE_INTEGER);
00124   vtkGetMacro(ShoulderResolution,int);
00126 
00128 
00129   vtkSetVector3Macro(Origin,float);
00130   vtkGetVectorMacro(Origin,float,3);
00132 
00134 
00140   vtkSetClampMacro(TextureStyle,int,VTK_TEXTURE_STYLE_FIT_IMAGE,
00141                                     VTK_TEXTURE_STYLE_PROPORTIONAL);
00142   vtkGetMacro(TextureStyle,int);
00143   void SetTextureStyleToFitImage() 
00144     {this->SetTextureStyle(VTK_TEXTURE_STYLE_FIT_IMAGE);}
00145   void SetTextureStyleToProportional() 
00146     {this->SetTextureStyle(VTK_TEXTURE_STYLE_PROPORTIONAL);}
00148 
00150 
00152   vtkSetVector2Macro(TextureDimensions,int);
00153   vtkGetVector2Macro(TextureDimensions,int);
00155 
00157 
00158   vtkSetVector2Macro(ShoulderTextureCoordinate,float);
00159   vtkGetVector2Macro(ShoulderTextureCoordinate,float);
00161 
00163 
00167   vtkSetMacro(TwoSided,int);
00168   vtkGetMacro(TwoSided,int);
00169   vtkBooleanMacro(TwoSided,int);
00171 
00172 protected:
00173   vtkButtonSource();
00174   ~vtkButtonSource() {}
00175 
00176   void Execute();
00177 
00178   float Width;
00179   float Height;
00180   float Depth;
00181 
00182   int   CircumferentialResolution;
00183   int   TextureResolution;
00184   int   ShoulderResolution;
00185 
00186   float Origin[3];
00187   float ShoulderTextureCoordinate[2];
00188 
00189   float RadialRatio;
00190   int TextureStyle;
00191   int TextureDimensions[2];
00192   int TwoSided;
00193 
00194 private:
00195   vtkButtonSource(const vtkButtonSource&);  // Not implemented.
00196   void operator=(const vtkButtonSource&);  // Not implemented.
00197 
00198   //internal variable related to axes of ellipsoid
00199   float A;
00200   float A2;
00201   float B;
00202   float B2;
00203   float C;
00204   float C2;
00205   
00206   float ComputeDepth(int inTextureRegion, float x, float y, float n[3]);
00207   void InterpolateCurve(int inTextureRegion, vtkPoints *newPts, int numPts,
00208                         vtkFloatArray *normals, vtkFloatArray *tcoords, 
00209                         int res, int c1StartPoint,int c1Incr,
00210                         int c2StartPoint,int s2Incr, int startPoint,int incr);
00211   void CreatePolygons(vtkCellArray *newPolys, int num, int res, int startIdx);
00212   void IntersectEllipseWithLine(float a2, float b2, float dX, float dY, 
00213                                 float& xe, float& ye);
00214   
00215     
00216 };
00217 
00218 #endif
00219 
00220