VTK
dox/Interaction/Widgets/vtkOrientedGlyphFocalPlaneContourRepresentation.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkOrientedGlyphFocalPlaneContourRepresentation.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 =========================================================================*/
00030 #ifndef __vtkOrientedGlyphFocalPlaneContourRepresentation_h
00031 #define __vtkOrientedGlyphFocalPlaneContourRepresentation_h
00032 
00033 #include "vtkInteractionWidgetsModule.h" // For export macro
00034 #include "vtkFocalPlaneContourRepresentation.h"
00035 
00036 class vtkProperty2D;
00037 class vtkActor2D;
00038 class vtkPolyDataMapper2D;
00039 class vtkPolyData;
00040 class vtkGlyph2D;
00041 class vtkPoints;
00042 class vtkPolyData;
00043 
00044 class VTKINTERACTIONWIDGETS_EXPORT vtkOrientedGlyphFocalPlaneContourRepresentation :
00045   public vtkFocalPlaneContourRepresentation
00046 {
00047 public:
00049   static vtkOrientedGlyphFocalPlaneContourRepresentation *New();
00050 
00052 
00053   vtkTypeMacro(vtkOrientedGlyphFocalPlaneContourRepresentation,
00054                                     vtkFocalPlaneContourRepresentation);
00055   void PrintSelf(ostream& os, vtkIndent indent);
00057 
00059 
00062   void SetCursorShape(vtkPolyData *cursorShape);
00063   vtkPolyData *GetCursorShape();
00065 
00067 
00070   void SetActiveCursorShape(vtkPolyData *activeShape);
00071   vtkPolyData *GetActiveCursorShape();
00073 
00075 
00077   vtkGetObjectMacro(Property,vtkProperty2D);
00079 
00081 
00083   vtkGetObjectMacro(ActiveProperty,vtkProperty2D);
00085 
00087 
00088   vtkGetObjectMacro(LinesProperty,vtkProperty2D);
00090 
00092 
00095   virtual void SetRenderer(vtkRenderer *ren);
00096   virtual void BuildRepresentation();
00097   virtual void StartWidgetInteraction(double eventPos[2]);
00098   virtual void WidgetInteraction(double eventPos[2]);
00099   virtual int ComputeInteractionState(int X, int Y, int modified=0);
00101 
00103 
00104   virtual void GetActors2D(vtkPropCollection *);
00105   virtual void ReleaseGraphicsResources(vtkWindow *);
00106   virtual int RenderOverlay(vtkViewport *viewport);
00107   virtual int RenderOpaqueGeometry(vtkViewport *viewport);
00108   virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
00109   virtual int HasTranslucentPolygonalGeometry();
00111 
00113   virtual vtkPolyData * GetContourRepresentationAsPolyData();
00114 
00120   vtkMatrix4x4   *GetContourPlaneDirectionCosines(const double origin[3]);
00121 
00122 protected:
00123   vtkOrientedGlyphFocalPlaneContourRepresentation();
00124   ~vtkOrientedGlyphFocalPlaneContourRepresentation();
00125 
00126   // Render the cursor
00127   vtkActor2D           *Actor;
00128   vtkPolyDataMapper2D  *Mapper;
00129   vtkGlyph2D           *Glypher;
00130   vtkActor2D           *ActiveActor;
00131   vtkPolyDataMapper2D  *ActiveMapper;
00132   vtkGlyph2D           *ActiveGlypher;
00133   vtkPolyData          *CursorShape;
00134   vtkPolyData          *ActiveCursorShape;
00135   vtkPolyData          *FocalData;
00136   vtkPoints            *FocalPoint;
00137   vtkPolyData          *ActiveFocalData;
00138   vtkPoints            *ActiveFocalPoint;
00139 
00140   // The polydata represents the contour in display co-ordinates.
00141   vtkPolyData          *Lines;
00142   vtkPolyDataMapper2D  *LinesMapper;
00143   vtkActor2D           *LinesActor;
00144 
00145   // The polydata represents the contour in world coordinates. It is updated
00146   // (kept in sync with Lines) every time the GetContourRepresentationAsPolyData()
00147   // method is called.
00148   vtkPolyData          *LinesWorldCoordinates;
00149 
00150   // Support picking
00151   double LastPickPosition[3];
00152   double LastEventPosition[2];
00153 
00154   // Methods to manipulate the cursor
00155   void Translate(double eventPos[2]);
00156   void Scale(double eventPos[2]);
00157   void ShiftContour(double eventPos[2]);
00158   void ScaleContour(double eventPos[2]);
00159 
00160   void ComputeCentroid(double* ioCentroid);
00161 
00162   // Properties used to control the appearance of selected objects and
00163   // the manipulator in general.
00164   vtkProperty2D *Property;
00165   vtkProperty2D *ActiveProperty;
00166   vtkProperty2D *LinesProperty;
00167 
00168   vtkMatrix4x4  *ContourPlaneDirectionCosines;
00169 
00170   void           CreateDefaultProperties();
00171 
00172 
00173   // Distance between where the mouse event happens and where the
00174   // widget is focused - maintain this distance during interaction.
00175   double InteractionOffset[2];
00176 
00177   void BuildLines();
00178 
00179 private:
00180   vtkOrientedGlyphFocalPlaneContourRepresentation(const vtkOrientedGlyphFocalPlaneContourRepresentation&);  //Not implemented
00181   void operator=(const vtkOrientedGlyphFocalPlaneContourRepresentation&);  //Not implemented
00182 };
00183 
00184 #endif