• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Widgets/vtkConstrainedPointHandleRepresentation.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkConstrainedPointHandleRepresentation.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 __vtkConstrainedPointHandleRepresentation_h
00040 #define __vtkConstrainedPointHandleRepresentation_h
00041 
00042 #include "vtkHandleRepresentation.h"
00043 
00044 class vtkProperty;
00045 class vtkActor;
00046 class vtkPolyDataMapper;
00047 class vtkPolyData;
00048 class vtkGlyph3D;
00049 class vtkPoints;
00050 class vtkPolyData;
00051 class vtkPlane;
00052 class vtkPlaneCollection;
00053 class vtkPlanes;
00054 class vtkRenderer;
00055 
00056 class VTK_WIDGETS_EXPORT vtkConstrainedPointHandleRepresentation : public vtkHandleRepresentation
00057 {
00058 public:
00060   static vtkConstrainedPointHandleRepresentation *New();
00061 
00063 
00064   vtkTypeRevisionMacro(vtkConstrainedPointHandleRepresentation,vtkHandleRepresentation);
00065   void PrintSelf(ostream& os, vtkIndent indent);
00067 
00069 
00072   void SetCursorShape(vtkPolyData *cursorShape);
00073   vtkPolyData *GetCursorShape();
00075 
00077 
00080   void SetActiveCursorShape(vtkPolyData *activeShape);
00081   vtkPolyData *GetActiveCursorShape();
00083 
00085 
00088   vtkSetClampMacro(ProjectionNormal,int,
00089                    vtkConstrainedPointHandleRepresentation::XAxis,
00090                    vtkConstrainedPointHandleRepresentation::Oblique);
00091   vtkGetMacro(ProjectionNormal,int);
00093  
00094   void SetProjectionNormalToXAxis()
00095     { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::XAxis); }
00096   void SetProjectionNormalToYAxis()
00097     { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::YAxis); }
00098   void SetProjectionNormalToZAxis()
00099     { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::ZAxis); }
00100   void SetProjectionNormalToOblique()
00101     { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::Oblique); }
00102 
00104 
00106   void SetObliquePlane(vtkPlane *);
00107   vtkGetObjectMacro(ObliquePlane, vtkPlane);
00109 
00111 
00115   void SetProjectionPosition(double position);
00116   vtkGetMacro(ProjectionPosition, double);
00118 
00120 
00126   void AddBoundingPlane(vtkPlane *plane);
00127   void RemoveBoundingPlane(vtkPlane *plane);
00128   void RemoveAllBoundingPlanes();
00129   virtual void SetBoundingPlanes(vtkPlaneCollection*);
00130   vtkGetObjectMacro(BoundingPlanes,vtkPlaneCollection);
00131   void SetBoundingPlanes(vtkPlanes *planes);
00133   
00137   virtual int CheckConstraint(vtkRenderer *renderer, double pos[2]);
00138 
00140 
00143   void SetPosition(double x, double y, double z);
00144   void SetPosition(double xyz[3]);
00145   double* GetPosition();
00146   void GetPosition(double xyz[3]);
00148   
00150 
00152   vtkGetObjectMacro(Property,vtkProperty);
00154   
00156 
00158   vtkGetObjectMacro(SelectedProperty,vtkProperty);
00160   
00162 
00164   vtkGetObjectMacro(ActiveProperty,vtkProperty);
00166   
00168 
00171   virtual void SetRenderer(vtkRenderer *ren);
00172   virtual void BuildRepresentation();
00173   virtual void StartWidgetInteraction(double eventPos[2]);
00174   virtual void WidgetInteraction(double eventPos[2]);
00175   virtual int ComputeInteractionState(int X, int Y, int modify);
00177 
00180   virtual void SetDisplayPosition(double pos[3]);
00181 
00183 
00184   virtual void GetActors(vtkPropCollection *);
00185   virtual void ReleaseGraphicsResources(vtkWindow *);
00186   virtual int RenderOverlay(vtkViewport *viewport);
00187   virtual int RenderOpaqueGeometry(vtkViewport *viewport);
00188   virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
00189   virtual int HasTranslucentPolygonalGeometry();
00190   virtual void ShallowCopy(vtkProp* prop);
00192 
00193 //BTX
00194   enum {XAxis=0,YAxis,ZAxis,Oblique};
00195 //ETX
00196   
00197 protected:
00198   vtkConstrainedPointHandleRepresentation();
00199   ~vtkConstrainedPointHandleRepresentation();
00200 
00201   // Render the cursor
00202   vtkActor             *Actor;
00203   vtkPolyDataMapper    *Mapper;
00204   vtkGlyph3D           *Glypher;
00205   vtkPolyData          *CursorShape;
00206   vtkPolyData          *ActiveCursorShape;
00207   vtkPolyData          *FocalData;
00208   vtkPoints            *FocalPoint;
00209 
00210   // Support picking
00211   double LastPickPosition[3];
00212   double LastEventPosition[2];
00213   
00214   // Methods to manipulate the cursor
00215   void Translate(double eventPos[2]);
00216   void Scale(double eventPos[2]);
00217   void Highlight(int highlight);
00218 
00219   // Properties used to control the appearance of selected objects and
00220   // the manipulator in general.
00221   vtkProperty   *Property;
00222   vtkProperty   *SelectedProperty;
00223   vtkProperty   *ActiveProperty;
00224   void           CreateDefaultProperties();
00225   
00226   // Controlling vars
00227   int             ProjectionNormal;
00228   double          ProjectionPosition;
00229   int             ProjectToPlane;
00230   vtkPlane        *ObliquePlane;
00231 
00232   vtkPlaneCollection *BoundingPlanes;
00233 
00234   // Internal method for computing 3D location from 2D screen position
00235   int GetIntersectionPosition( double eventPos[2],
00236                                double worldPos[3],
00237                                double tolerance = 0.0,
00238                                vtkRenderer *renderer=0);
00239 
00240   // Internal method for getting the project normal as a vector
00241   void GetProjectionNormal( double normal[3] );
00242   
00243   // Internal method for getting the origin of the 
00244   // constraining plane as a 3-tuple
00245   void GetProjectionOrigin( double origin[3] );
00246   
00247   
00248   
00249   // Distance between where the mouse event happens and where the
00250   // widget is focused - maintain this distance during interaction.
00251   double InteractionOffset[2];
00252   
00253 private:
00254   vtkConstrainedPointHandleRepresentation(const vtkConstrainedPointHandleRepresentation&);  //Not implemented
00255   void operator=(const vtkConstrainedPointHandleRepresentation&);  //Not implemented
00256 };
00257 
00258 #endif

Generated by  doxygen 1.7.1