VTK
dox/Interaction/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 "vtkInteractionWidgetsModule.h" // For export macro
00053 #include "vtkButtonRepresentation.h"
00054 
00055 class vtkCellPicker;
00056 class vtkActor;
00057 class vtkProperty;
00058 class vtkImageData;
00059 class vtkTextureArray; //PIMPLd
00060 class vtkPolyData;
00061 class vtkPolyDataMapper;
00062 class vtkAlgorithmOutput;
00063 class vtkTexture;
00064 class vtkFollower;
00065 
00066 class VTKINTERACTIONWIDGETS_EXPORT vtkTexturedButtonRepresentation : public vtkButtonRepresentation
00067 {
00068 public:
00070   static vtkTexturedButtonRepresentation *New();
00071 
00073 
00074   vtkTypeMacro(vtkTexturedButtonRepresentation,vtkButtonRepresentation);
00075   void PrintSelf(ostream& os, vtkIndent indent);
00077 
00079 
00080   void SetButtonGeometry(vtkPolyData *pd);
00081   void SetButtonGeometryConnection(vtkAlgorithmOutput* algOutput);
00082   vtkPolyData *GetButtonGeometry();
00084 
00086 
00088   vtkSetMacro(FollowCamera,int);
00089   vtkGetMacro(FollowCamera,int);
00090   vtkBooleanMacro(FollowCamera,int);
00092 
00094 
00096   virtual void SetProperty(vtkProperty *p);
00097   vtkGetObjectMacro(Property,vtkProperty);
00099 
00101 
00102   virtual void SetHoveringProperty(vtkProperty *p);
00103   vtkGetObjectMacro(HoveringProperty,vtkProperty);
00105 
00107 
00108   virtual void SetSelectingProperty(vtkProperty *p);
00109   vtkGetObjectMacro(SelectingProperty,vtkProperty);
00111 
00113 
00115   void SetButtonTexture(int i, vtkImageData *image);
00116   vtkImageData *GetButtonTexture(int i);
00118 
00125   virtual void PlaceWidget(double scale, double point[3], double normal[3]);
00126 
00128 
00130   virtual int ComputeInteractionState(int X, int Y, int modify=0);
00131   virtual void PlaceWidget(double bounds[6]);
00132   virtual void BuildRepresentation();
00133   virtual void Highlight(int state);
00135 
00137 
00138   virtual void ShallowCopy(vtkProp *prop);
00139   virtual double *GetBounds();
00140   virtual void GetActors(vtkPropCollection *pc);
00141   virtual void ReleaseGraphicsResources(vtkWindow*);
00142   virtual int RenderOpaqueGeometry(vtkViewport*);
00143   virtual int RenderTranslucentPolygonalGeometry(vtkViewport*);
00144   virtual int HasTranslucentPolygonalGeometry();
00146 
00147 protected:
00148   vtkTexturedButtonRepresentation();
00149   ~vtkTexturedButtonRepresentation();
00150 
00151   // Representing the button
00152   vtkActor          *Actor;
00153   vtkFollower       *Follower;
00154   vtkPolyDataMapper *Mapper;
00155   vtkTexture        *Texture;
00156 
00157   // Camera
00158   int FollowCamera;
00159 
00160   // Properties of the button
00161   vtkProperty *Property;
00162   vtkProperty *HoveringProperty;
00163   vtkProperty *SelectingProperty;
00164   void CreateDefaultProperties();
00165 
00166   // Keep track of the images (textures) associated with the N
00167   // states of the button. This is a PIMPLd stl map.
00168   vtkTextureArray *TextureArray;
00169 
00170   // For picking the button
00171   vtkCellPicker *Picker;
00172 
00173   // Register internal Pickers within PickingManager
00174   virtual void RegisterPickers();
00175 
00176 private:
00177   vtkTexturedButtonRepresentation(const vtkTexturedButtonRepresentation&);  //Not implemented
00178   void operator=(const vtkTexturedButtonRepresentation&);  //Not implemented
00179 };
00180 
00181 #endif