VTK
dox/Widgets/vtkTexturedButtonRepresentation.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkTexturedButtonRepresentation.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 =========================================================================*/
00049 #ifndef __vtkTexturedButtonRepresentation_h
00050 #define __vtkTexturedButtonRepresentation_h
00051 
00052 #include "vtkButtonRepresentation.h"
00053 
00054 class vtkCellPicker;
00055 class vtkActor;
00056 class vtkProperty;
00057 class vtkImageData;
00058 class vtkTextureArray; //PIMPLd
00059 class vtkPolyData;
00060 class vtkPolyDataMapper;
00061 class vtkAlgorithmOutput;
00062 class vtkTexture;
00063 class vtkFollower;
00064 
00065 class VTK_WIDGETS_EXPORT vtkTexturedButtonRepresentation : public vtkButtonRepresentation
00066 {
00067 public:
00069   static vtkTexturedButtonRepresentation *New();
00070 
00072 
00073   vtkTypeMacro(vtkTexturedButtonRepresentation,vtkButtonRepresentation);
00074   void PrintSelf(ostream& os, vtkIndent indent);
00076 
00078 
00079   void SetButtonGeometry(vtkPolyData *pd);
00080   void SetButtonGeometryConnection(vtkAlgorithmOutput* algOutput);
00081   vtkPolyData *GetButtonGeometry();
00083 
00085 
00087   vtkSetMacro(FollowCamera,int);
00088   vtkGetMacro(FollowCamera,int);
00089   vtkBooleanMacro(FollowCamera,int);
00091 
00093 
00095   virtual void SetProperty(vtkProperty *p);
00096   vtkGetObjectMacro(Property,vtkProperty);
00098 
00100 
00101   virtual void SetHoveringProperty(vtkProperty *p);
00102   vtkGetObjectMacro(HoveringProperty,vtkProperty);
00104 
00106 
00107   virtual void SetSelectingProperty(vtkProperty *p);
00108   vtkGetObjectMacro(SelectingProperty,vtkProperty);
00110 
00112 
00114   void SetButtonTexture(int i, vtkImageData *image);
00115   vtkImageData *GetButtonTexture(int i);
00117 
00124   virtual void PlaceWidget(double scale, double point[3], double normal[3]);
00125 
00127 
00129   virtual int ComputeInteractionState(int X, int Y, int modify=0);
00130   virtual void PlaceWidget(double bounds[6]);
00131   virtual void BuildRepresentation();
00132   virtual void Highlight(int state);
00134 
00136 
00137   virtual void ShallowCopy(vtkProp *prop);
00138   virtual double *GetBounds();
00139   virtual void GetActors(vtkPropCollection *pc);
00140   virtual void ReleaseGraphicsResources(vtkWindow*);
00141   virtual int RenderOpaqueGeometry(vtkViewport*);
00142   virtual int RenderTranslucentPolygonalGeometry(vtkViewport*);
00143   virtual int HasTranslucentPolygonalGeometry();
00145 
00146 protected:
00147   vtkTexturedButtonRepresentation();
00148   ~vtkTexturedButtonRepresentation();
00149 
00150   // Representing the button
00151   vtkActor          *Actor;
00152   vtkFollower       *Follower;
00153   vtkPolyDataMapper *Mapper;
00154   vtkTexture        *Texture;
00155 
00156   // Camera
00157   int FollowCamera;
00158 
00159   // Properties of the button
00160   vtkProperty *Property;
00161   vtkProperty *HoveringProperty;
00162   vtkProperty *SelectingProperty;
00163   void CreateDefaultProperties();
00164 
00165   // Keep track of the images (textures) associated with the N
00166   // states of the button. This is a PIMPLd stl map.
00167   vtkTextureArray *TextureArray;
00168 
00169   // For picking the button
00170   vtkCellPicker *Picker;
00171 
00172 private:
00173   vtkTexturedButtonRepresentation(const vtkTexturedButtonRepresentation&);  //Not implemented
00174   void operator=(const vtkTexturedButtonRepresentation&);  //Not implemented
00175 };
00176 
00177 #endif