Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound 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 =========================================================================*/
00054 #ifndef __vtkButtonSource_h
00055 #define __vtkButtonSource_h
00056 
00057 #include "vtkPolyDataSource.h"
00058 
00059 class vtkCellArray;
00060 class vtkFloatArray;
00061 class vtkPoints;
00062 
00063 #define VTK_TEXTURE_STYLE_FIT_IMAGE    0
00064 #define VTK_TEXTURE_STYLE_PROPORTIONAL 1
00065 
00066 class VTK_GRAPHICS_EXPORT vtkButtonSource : public vtkPolyDataSource 
00067 {
00068 public:
00069   void PrintSelf(ostream& os, vtkIndent indent);
00070   vtkTypeRevisionMacro(vtkButtonSource,vtkPolyDataSource);
00071 
00073   static vtkButtonSource *New();
00074 
00076 
00077   vtkSetClampMacro(Width,float,0.0,VTK_LARGE_FLOAT);
00078   vtkGetMacro(Width,float);
00080 
00082 
00083   vtkSetClampMacro(Height,float,0.0,VTK_LARGE_FLOAT);
00084   vtkGetMacro(Height,float);
00086 
00088 
00089   vtkSetClampMacro(Depth,float,0.0,VTK_LARGE_FLOAT);
00090   vtkGetMacro(Depth,float);
00092 
00094 
00101   vtkSetClampMacro(RadialRatio,float,1.0,VTK_LARGE_FLOAT);
00102   vtkGetMacro(RadialRatio,float);
00104 
00106 
00108   vtkSetClampMacro(CircumferentialResolution,int,4,VTK_LARGE_INTEGER);
00109   vtkGetMacro(CircumferentialResolution,int);
00111 
00113 
00115   vtkSetClampMacro(TextureResolution,int,1,VTK_LARGE_INTEGER);
00116   vtkGetMacro(TextureResolution,int);
00118 
00120 
00122   vtkSetClampMacro(ShoulderResolution,int,1,VTK_LARGE_INTEGER);
00123   vtkGetMacro(ShoulderResolution,int);
00125 
00127 
00128   vtkSetVector3Macro(Origin,float);
00129   vtkGetVectorMacro(Origin,float,3);
00131 
00133 
00139   vtkSetClampMacro(TextureStyle,int,VTK_TEXTURE_STYLE_FIT_IMAGE,
00140                                     VTK_TEXTURE_STYLE_PROPORTIONAL);
00141   vtkGetMacro(TextureStyle,int);
00142   void SetTextureStyleToFitImage() 
00143     {this->SetTextureStyle(VTK_TEXTURE_STYLE_FIT_IMAGE);}
00144   void SetTextureStyleToProportional() 
00145     {this->SetTextureStyle(VTK_TEXTURE_STYLE_PROPORTIONAL);}
00147 
00149 
00151   vtkSetVector2Macro(TextureDimensions,int);
00152   vtkGetVector2Macro(TextureDimensions,int);
00154 
00156 
00157   vtkSetVector2Macro(ShoulderTextureCoordinate,float);
00158   vtkGetVector2Macro(ShoulderTextureCoordinate,float);
00160 
00162 
00166   vtkSetMacro(TwoSided,int);
00167   vtkGetMacro(TwoSided,int);
00168   vtkBooleanMacro(TwoSided,int);
00170 
00171 protected:
00172   vtkButtonSource();
00173   ~vtkButtonSource() {}
00174 
00175   void Execute();
00176 
00177   float Width;
00178   float Height;
00179   float Depth;
00180 
00181   int   CircumferentialResolution;
00182   int   TextureResolution;
00183   int   ShoulderResolution;
00184 
00185   float Origin[3];
00186   float ShoulderTextureCoordinate[2];
00187 
00188   float RadialRatio;
00189   int TextureStyle;
00190   int TextureDimensions[2];
00191   int TwoSided;
00192 
00193 private:
00194   vtkButtonSource(const vtkButtonSource&);  // Not implemented.
00195   void operator=(const vtkButtonSource&);  // Not implemented.
00196 
00197   //internal variable related to axes of ellipsoid
00198   float A;
00199   float A2;
00200   float B;
00201   float B2;
00202   float C;
00203   float C2;
00204   
00205   float ComputeDepth(int inTextureRegion, float x, float y, float n[3]);
00206   void InterpolateCurve(int inTextureRegion, vtkPoints *newPts, int numPts,
00207                         vtkFloatArray *normals, vtkFloatArray *tcoords, 
00208                         int res, int c1StartPoint,int c1Incr,
00209                         int c2StartPoint,int s2Incr, int startPoint,int incr);
00210   void CreatePolygons(vtkCellArray *newPolys, int num, int res, int startIdx);
00211   void IntersectEllipseWithLine(float a2, float b2, float dX, float dY, 
00212                                 float& xe, float& ye);
00213   
00214     
00215 };
00216 
00217 #endif
00218 
00219