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 =========================================================================*/
00043 #ifndef __vtkButtonSource_h
00044 #define __vtkButtonSource_h
00045 
00046 #include "vtkPolyDataSource.h"
00047 
00048 class vtkCellArray;
00049 class vtkFloatArray;
00050 class vtkPoints;
00051 
00052 #define VTK_TEXTURE_STYLE_FIT_IMAGE    0
00053 #define VTK_TEXTURE_STYLE_PROPORTIONAL 1
00054 
00055 class VTK_GRAPHICS_EXPORT vtkButtonSource : public vtkPolyDataSource 
00056 {
00057 public:
00058   void PrintSelf(ostream& os, vtkIndent indent);
00059   vtkTypeRevisionMacro(vtkButtonSource,vtkPolyDataSource);
00060 
00062   static vtkButtonSource *New();
00063 
00065 
00066   vtkSetClampMacro(Width,float,0.0,VTK_LARGE_FLOAT);
00067   vtkGetMacro(Width,float);
00069 
00071 
00072   vtkSetClampMacro(Height,float,0.0,VTK_LARGE_FLOAT);
00073   vtkGetMacro(Height,float);
00075 
00077 
00078   vtkSetClampMacro(Depth,float,0.0,VTK_LARGE_FLOAT);
00079   vtkGetMacro(Depth,float);
00081 
00083 
00090   vtkSetClampMacro(RadialRatio,float,1.0,VTK_LARGE_FLOAT);
00091   vtkGetMacro(RadialRatio,float);
00093 
00095 
00097   vtkSetClampMacro(CircumferentialResolution,int,4,VTK_LARGE_INTEGER);
00098   vtkGetMacro(CircumferentialResolution,int);
00100 
00102 
00104   vtkSetClampMacro(TextureResolution,int,1,VTK_LARGE_INTEGER);
00105   vtkGetMacro(TextureResolution,int);
00107 
00109 
00111   vtkSetClampMacro(ShoulderResolution,int,1,VTK_LARGE_INTEGER);
00112   vtkGetMacro(ShoulderResolution,int);
00114 
00116 
00117   vtkSetVector3Macro(Origin,float);
00118   vtkGetVectorMacro(Origin,float,3);
00120 
00122 
00128   vtkSetClampMacro(TextureStyle,int,VTK_TEXTURE_STYLE_FIT_IMAGE,
00129                                     VTK_TEXTURE_STYLE_PROPORTIONAL);
00130   vtkGetMacro(TextureStyle,int);
00131   void SetTextureStyleToFitImage() 
00132     {this->SetTextureStyle(VTK_TEXTURE_STYLE_FIT_IMAGE);}
00133   void SetTextureStyleToProportional() 
00134     {this->SetTextureStyle(VTK_TEXTURE_STYLE_PROPORTIONAL);}
00136 
00138 
00140   vtkSetVector2Macro(TextureDimensions,int);
00141   vtkGetVector2Macro(TextureDimensions,int);
00143 
00145 
00146   vtkSetVector2Macro(ShoulderTextureCoordinate,float);
00147   vtkGetVector2Macro(ShoulderTextureCoordinate,float);
00149 
00151 
00155   vtkSetMacro(TwoSided,int);
00156   vtkGetMacro(TwoSided,int);
00157   vtkBooleanMacro(TwoSided,int);
00159 
00160 protected:
00161   vtkButtonSource();
00162   ~vtkButtonSource() {}
00163 
00164   void Execute();
00165 
00166   float Width;
00167   float Height;
00168   float Depth;
00169 
00170   int   CircumferentialResolution;
00171   int   TextureResolution;
00172   int   ShoulderResolution;
00173 
00174   float Origin[3];
00175   float ShoulderTextureCoordinate[2];
00176 
00177   float RadialRatio;
00178   int TextureStyle;
00179   int TextureDimensions[2];
00180   int TwoSided;
00181 
00182 private:
00183   vtkButtonSource(const vtkButtonSource&);  // Not implemented.
00184   void operator=(const vtkButtonSource&);  // Not implemented.
00185 
00186   //internal variable related to axes of ellipsoid
00187   float A;
00188   float A2;
00189   float B;
00190   float B2;
00191   float C;
00192   float C2;
00193   
00194   float ComputeDepth(int inTextureRegion, float x, float y, float n[3]);
00195   void InterpolateCurve(int inTextureRegion, vtkPoints *newPts, int numPts,
00196                         vtkFloatArray *normals, vtkFloatArray *tcoords, 
00197                         int res, int c1StartPoint,int c1Incr,
00198                         int c2StartPoint,int s2Incr, int startPoint,int incr);
00199   void CreatePolygons(vtkCellArray *newPolys, int num, int res, int startIdx);
00200   void IntersectEllipseWithLine(float a2, float b2, float dX, float dY, 
00201                                 float& xe, float& ye);
00202   
00203     
00204 };
00205 
00206 #endif
00207 
00208