VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkOrientedGlyphContourRepresentation.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 =========================================================================*/ 00030 #ifndef __vtkOrientedGlyphContourRepresentation_h 00031 #define __vtkOrientedGlyphContourRepresentation_h 00032 00033 #include "vtkContourRepresentation.h" 00034 00035 class vtkProperty; 00036 class vtkActor; 00037 class vtkPolyDataMapper; 00038 class vtkPolyData; 00039 class vtkGlyph3D; 00040 class vtkPoints; 00041 00042 class VTK_WIDGETS_EXPORT vtkOrientedGlyphContourRepresentation : public vtkContourRepresentation 00043 { 00044 public: 00046 static vtkOrientedGlyphContourRepresentation *New(); 00047 00049 00050 vtkTypeRevisionMacro(vtkOrientedGlyphContourRepresentation,vtkContourRepresentation); 00051 void PrintSelf(ostream& os, vtkIndent indent); 00053 00055 00058 void SetCursorShape(vtkPolyData *cursorShape); 00059 vtkPolyData *GetCursorShape(); 00061 00063 00066 void SetActiveCursorShape(vtkPolyData *activeShape); 00067 vtkPolyData *GetActiveCursorShape(); 00069 00071 00073 vtkGetObjectMacro(Property,vtkProperty); 00075 00077 00079 vtkGetObjectMacro(ActiveProperty,vtkProperty); 00081 00083 00084 vtkGetObjectMacro(LinesProperty,vtkProperty); 00086 00088 00091 virtual void SetRenderer(vtkRenderer *ren); 00092 virtual void BuildRepresentation(); 00093 virtual void StartWidgetInteraction(double eventPos[2]); 00094 virtual void WidgetInteraction(double eventPos[2]); 00095 virtual int ComputeInteractionState(int X, int Y, int modified=0); 00097 00099 00100 virtual void GetActors(vtkPropCollection *); 00101 virtual void ReleaseGraphicsResources(vtkWindow *); 00102 virtual int RenderOverlay(vtkViewport *viewport); 00103 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 00104 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); 00105 virtual int HasTranslucentPolygonalGeometry(); 00107 00109 virtual vtkPolyData * GetContourRepresentationAsPolyData(); 00110 00112 00116 vtkSetMacro( AlwaysOnTop, int ); 00117 vtkGetMacro( AlwaysOnTop, int ); 00118 vtkBooleanMacro( AlwaysOnTop, int ); 00120 00121 protected: 00122 vtkOrientedGlyphContourRepresentation(); 00123 ~vtkOrientedGlyphContourRepresentation(); 00124 00125 // Render the cursor 00126 vtkActor *Actor; 00127 vtkPolyDataMapper *Mapper; 00128 vtkGlyph3D *Glypher; 00129 vtkActor *ActiveActor; 00130 vtkPolyDataMapper *ActiveMapper; 00131 vtkGlyph3D *ActiveGlypher; 00132 vtkPolyData *CursorShape; 00133 vtkPolyData *ActiveCursorShape; 00134 vtkPolyData *FocalData; 00135 vtkPoints *FocalPoint; 00136 vtkPolyData *ActiveFocalData; 00137 vtkPoints *ActiveFocalPoint; 00138 00139 vtkPolyData *Lines; 00140 vtkPolyDataMapper *LinesMapper; 00141 vtkActor *LinesActor; 00142 00143 // Support picking 00144 double LastPickPosition[3]; 00145 double LastEventPosition[2]; 00146 00147 // Methods to manipulate the cursor 00148 void Translate(double eventPos[2]); 00149 void Scale(double eventPos[2]); 00150 void ShiftContour(double eventPos[2]); 00151 void ScaleContour(double eventPos[2]); 00152 00153 void ComputeCentroid(double* ioCentroid); 00154 00155 // Properties used to control the appearance of selected objects and 00156 // the manipulator in general. 00157 vtkProperty *Property; 00158 vtkProperty *ActiveProperty; 00159 vtkProperty *LinesProperty; 00160 void CreateDefaultProperties(); 00161 00162 00163 // Distance between where the mouse event happens and where the 00164 // widget is focused - maintain this distance during interaction. 00165 double InteractionOffset[2]; 00166 00167 int AlwaysOnTop; 00168 00169 void BuildLines(); 00170 00171 private: 00172 vtkOrientedGlyphContourRepresentation(const vtkOrientedGlyphContourRepresentation&); //Not implemented 00173 void operator=(const vtkOrientedGlyphContourRepresentation&); //Not implemented 00174 }; 00175 00176 #endif