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 
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 =========================================================================*/
00039 #ifndef __vtkButtonSource_h
00040 #define __vtkButtonSource_h
00041 
00042 #include "vtkPolyDataSource.h"
00043 
00044 class vtkCellArray;
00045 class vtkFloatArray;
00046 class vtkPoints;
00047 
00048 #define VTK_TEXTURE_STYLE_FIT_IMAGE    0
00049 #define VTK_TEXTURE_STYLE_PROPORTIONAL 1
00050 
00051 class VTK_GRAPHICS_EXPORT vtkButtonSource : public vtkPolyDataSource 
00052 {
00053 public:
00054   void PrintSelf(ostream& os, vtkIndent indent);
00055   vtkTypeRevisionMacro(vtkButtonSource,vtkPolyDataSource);
00056 
00058   static vtkButtonSource *New();
00059 
00061 
00062   vtkSetClampMacro(Width,double,0.0,VTK_DOUBLE_MAX);
00063   vtkGetMacro(Width,double);
00065 
00067 
00068   vtkSetClampMacro(Height,double,0.0,VTK_DOUBLE_MAX);
00069   vtkGetMacro(Height,double);
00071 
00073 
00074   vtkSetClampMacro(Depth,double,0.0,VTK_DOUBLE_MAX);
00075   vtkGetMacro(Depth,double);
00077 
00079 
00086   vtkSetClampMacro(RadialRatio,double,1.0,VTK_DOUBLE_MAX);
00087   vtkGetMacro(RadialRatio,double);
00089 
00091 
00093   vtkSetClampMacro(CircumferentialResolution,int,4,VTK_LARGE_INTEGER);
00094   vtkGetMacro(CircumferentialResolution,int);
00096 
00098 
00100   vtkSetClampMacro(TextureResolution,int,1,VTK_LARGE_INTEGER);
00101   vtkGetMacro(TextureResolution,int);
00103 
00105 
00107   vtkSetClampMacro(ShoulderResolution,int,1,VTK_LARGE_INTEGER);
00108   vtkGetMacro(ShoulderResolution,int);
00110 
00112 
00113   vtkSetVector3Macro(Origin,double);
00114   vtkGetVectorMacro(Origin,double,3);
00116 
00118 
00124   vtkSetClampMacro(TextureStyle,int,VTK_TEXTURE_STYLE_FIT_IMAGE,
00125                                     VTK_TEXTURE_STYLE_PROPORTIONAL);
00126   vtkGetMacro(TextureStyle,int);
00127   void SetTextureStyleToFitImage() 
00128     {this->SetTextureStyle(VTK_TEXTURE_STYLE_FIT_IMAGE);}
00129   void SetTextureStyleToProportional() 
00130     {this->SetTextureStyle(VTK_TEXTURE_STYLE_PROPORTIONAL);}
00132 
00134 
00136   vtkSetVector2Macro(TextureDimensions,int);
00137   vtkGetVector2Macro(TextureDimensions,int);
00139 
00141 
00142   vtkSetVector2Macro(ShoulderTextureCoordinate,double);
00143   vtkGetVector2Macro(ShoulderTextureCoordinate,double);
00145 
00147 
00151   vtkSetMacro(TwoSided,int);
00152   vtkGetMacro(TwoSided,int);
00153   vtkBooleanMacro(TwoSided,int);
00155 
00156 protected:
00157   vtkButtonSource();
00158   ~vtkButtonSource() {}
00159 
00160   void Execute();
00161 
00162   double Width;
00163   double Height;
00164   double Depth;
00165 
00166   int   CircumferentialResolution;
00167   int   TextureResolution;
00168   int   ShoulderResolution;
00169 
00170   double Origin[3];
00171   double ShoulderTextureCoordinate[2];
00172 
00173   double RadialRatio;
00174   int TextureStyle;
00175   int TextureDimensions[2];
00176   int TwoSided;
00177 
00178 private:
00179   vtkButtonSource(const vtkButtonSource&);  // Not implemented.
00180   void operator=(const vtkButtonSource&);  // Not implemented.
00181 
00182   //internal variable related to axes of ellipsoid
00183   double A;
00184   double A2;
00185   double B;
00186   double B2;
00187   double C;
00188   double C2;
00189   
00190   double ComputeDepth(int inTextureRegion, double x, double y, double n[3]);
00191   void InterpolateCurve(int inTextureRegion, vtkPoints *newPts, int numPts,
00192                         vtkFloatArray *normals, vtkFloatArray *tcoords, 
00193                         int res, int c1StartPoint,int c1Incr,
00194                         int c2StartPoint,int s2Incr, int startPoint,int incr);
00195   void CreatePolygons(vtkCellArray *newPolys, int num, int res, int startIdx);
00196   void IntersectEllipseWithLine(double a2, double b2, double dX, double dY, 
00197                                 double& xe, double& ye);
00198   
00199     
00200 };
00201 
00202 #endif
00203 
00204