VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkOrientedGlyphContourRepresentation.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 __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 vtkTypeMacro(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 00123 void SetLineColor(double r, double g, double b); 00124 00127 virtual void SetShowSelectedNodes(int); 00128 00130 virtual double *GetBounds(); 00131 00132 protected: 00133 vtkOrientedGlyphContourRepresentation(); 00134 ~vtkOrientedGlyphContourRepresentation(); 00135 00136 // Render the cursor 00137 vtkActor *Actor; 00138 vtkPolyDataMapper *Mapper; 00139 vtkGlyph3D *Glypher; 00140 vtkActor *ActiveActor; 00141 vtkPolyDataMapper *ActiveMapper; 00142 vtkGlyph3D *ActiveGlypher; 00143 vtkPolyData *CursorShape; 00144 vtkPolyData *ActiveCursorShape; 00145 vtkPolyData *FocalData; 00146 vtkPoints *FocalPoint; 00147 vtkPolyData *ActiveFocalData; 00148 vtkPoints *ActiveFocalPoint; 00149 00150 vtkPolyData *SelectedNodesData; 00151 vtkPoints *SelectedNodesPoints; 00152 vtkActor *SelectedNodesActor; 00153 vtkPolyDataMapper *SelectedNodesMapper; 00154 vtkGlyph3D *SelectedNodesGlypher; 00155 vtkPolyData *SelectedNodesCursorShape; 00156 void CreateSelectedNodesRepresentation(); 00157 00158 vtkPolyData *Lines; 00159 vtkPolyDataMapper *LinesMapper; 00160 vtkActor *LinesActor; 00161 00162 // Support picking 00163 double LastPickPosition[3]; 00164 double LastEventPosition[2]; 00165 00166 // Methods to manipulate the cursor 00167 void Translate(double eventPos[2]); 00168 void Scale(double eventPos[2]); 00169 void ShiftContour(double eventPos[2]); 00170 void ScaleContour(double eventPos[2]); 00171 00172 void ComputeCentroid(double* ioCentroid); 00173 00174 // Properties used to control the appearance of selected objects and 00175 // the manipulator in general. 00176 vtkProperty *Property; 00177 vtkProperty *ActiveProperty; 00178 vtkProperty *LinesProperty; 00179 void CreateDefaultProperties(); 00180 00181 00182 // Distance between where the mouse event happens and where the 00183 // widget is focused - maintain this distance during interaction. 00184 double InteractionOffset[2]; 00185 00186 int AlwaysOnTop; 00187 00188 virtual void BuildLines(); 00189 00190 private: 00191 vtkOrientedGlyphContourRepresentation(const vtkOrientedGlyphContourRepresentation&); //Not implemented 00192 void operator=(const vtkOrientedGlyphContourRepresentation&); //Not implemented 00193 }; 00194 00195 #endif