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 "vtkFocalPlaneContourRepresentation.h" 00034 00035 class vtkProperty2D; 00036 class vtkActor2D; 00037 class vtkPolyDataMapper2D; 00038 class vtkPolyData; 00039 class vtkGlyph2D; 00040 class vtkPoints; 00041 class vtkPolyData; 00042 00043 class VTK_WIDGETS_EXPORT vtkOrientedGlyphFocalPlaneContourRepresentation : 00044 public vtkFocalPlaneContourRepresentation 00045 { 00046 public: 00048 static vtkOrientedGlyphFocalPlaneContourRepresentation *New(); 00049 00051 00052 vtkTypeMacro(vtkOrientedGlyphFocalPlaneContourRepresentation, 00053 vtkFocalPlaneContourRepresentation); 00054 void PrintSelf(ostream& os, vtkIndent indent); 00056 00058 00061 void SetCursorShape(vtkPolyData *cursorShape); 00062 vtkPolyData *GetCursorShape(); 00064 00066 00069 void SetActiveCursorShape(vtkPolyData *activeShape); 00070 vtkPolyData *GetActiveCursorShape(); 00072 00074 00076 vtkGetObjectMacro(Property,vtkProperty2D); 00078 00080 00082 vtkGetObjectMacro(ActiveProperty,vtkProperty2D); 00084 00086 00087 vtkGetObjectMacro(LinesProperty,vtkProperty2D); 00089 00091 00094 virtual void SetRenderer(vtkRenderer *ren); 00095 virtual void BuildRepresentation(); 00096 virtual void StartWidgetInteraction(double eventPos[2]); 00097 virtual void WidgetInteraction(double eventPos[2]); 00098 virtual int ComputeInteractionState(int X, int Y, int modified=0); 00100 00102 00103 virtual void GetActors2D(vtkPropCollection *); 00104 virtual void ReleaseGraphicsResources(vtkWindow *); 00105 virtual int RenderOverlay(vtkViewport *viewport); 00106 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 00107 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); 00108 virtual int HasTranslucentPolygonalGeometry(); 00110 00112 virtual vtkPolyData * GetContourRepresentationAsPolyData(); 00113 00119 vtkMatrix4x4 *GetContourPlaneDirectionCosines(const double origin[3]); 00120 00121 protected: 00122 vtkOrientedGlyphFocalPlaneContourRepresentation(); 00123 ~vtkOrientedGlyphFocalPlaneContourRepresentation(); 00124 00125 // Render the cursor 00126 vtkActor2D *Actor; 00127 vtkPolyDataMapper2D *Mapper; 00128 vtkGlyph2D *Glypher; 00129 vtkActor2D *ActiveActor; 00130 vtkPolyDataMapper2D *ActiveMapper; 00131 vtkGlyph2D *ActiveGlypher; 00132 vtkPolyData *CursorShape; 00133 vtkPolyData *ActiveCursorShape; 00134 vtkPolyData *FocalData; 00135 vtkPoints *FocalPoint; 00136 vtkPolyData *ActiveFocalData; 00137 vtkPoints *ActiveFocalPoint; 00138 00139 // The polydata represents the contour in display co-ordinates. 00140 vtkPolyData *Lines; 00141 vtkPolyDataMapper2D *LinesMapper; 00142 vtkActor2D *LinesActor; 00143 00144 // The polydata represents the contour in world coordinates. It is updated 00145 // (kept in sync with Lines) every time the GetContourRepresentationAsPolyData() 00146 // method is called. 00147 vtkPolyData *LinesWorldCoordinates; 00148 00149 // Support picking 00150 double LastPickPosition[3]; 00151 double LastEventPosition[2]; 00152 00153 // Methods to manipulate the cursor 00154 void Translate(double eventPos[2]); 00155 void Scale(double eventPos[2]); 00156 void ShiftContour(double eventPos[2]); 00157 void ScaleContour(double eventPos[2]); 00158 00159 void ComputeCentroid(double* ioCentroid); 00160 00161 // Properties used to control the appearance of selected objects and 00162 // the manipulator in general. 00163 vtkProperty2D *Property; 00164 vtkProperty2D *ActiveProperty; 00165 vtkProperty2D *LinesProperty; 00166 00167 vtkMatrix4x4 *ContourPlaneDirectionCosines; 00168 00169 void CreateDefaultProperties(); 00170 00171 00172 // Distance between where the mouse event happens and where the 00173 // widget is focused - maintain this distance during interaction. 00174 double InteractionOffset[2]; 00175 00176 void BuildLines(); 00177 00178 private: 00179 vtkOrientedGlyphFocalPlaneContourRepresentation(const vtkOrientedGlyphFocalPlaneContourRepresentation&); //Not implemented 00180 void operator=(const vtkOrientedGlyphFocalPlaneContourRepresentation&); //Not implemented 00181 }; 00182 00183 #endif