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 "vtkInteractionWidgetsModule.h" // For export macro 00034 #include "vtkContourRepresentation.h" 00035 00036 class vtkProperty; 00037 class vtkActor; 00038 class vtkPolyDataMapper; 00039 class vtkPolyData; 00040 class vtkGlyph3D; 00041 class vtkPoints; 00042 00043 class VTKINTERACTIONWIDGETS_EXPORT vtkOrientedGlyphContourRepresentation : public vtkContourRepresentation 00044 { 00045 public: 00047 static vtkOrientedGlyphContourRepresentation *New(); 00048 00050 00051 vtkTypeMacro(vtkOrientedGlyphContourRepresentation,vtkContourRepresentation); 00052 void PrintSelf(ostream& os, vtkIndent indent); 00054 00056 00059 void SetCursorShape(vtkPolyData *cursorShape); 00060 vtkPolyData *GetCursorShape(); 00062 00064 00067 void SetActiveCursorShape(vtkPolyData *activeShape); 00068 vtkPolyData *GetActiveCursorShape(); 00070 00072 00074 vtkGetObjectMacro(Property,vtkProperty); 00076 00078 00080 vtkGetObjectMacro(ActiveProperty,vtkProperty); 00082 00084 00085 vtkGetObjectMacro(LinesProperty,vtkProperty); 00087 00089 00092 virtual void SetRenderer(vtkRenderer *ren); 00093 virtual void BuildRepresentation(); 00094 virtual void StartWidgetInteraction(double eventPos[2]); 00095 virtual void WidgetInteraction(double eventPos[2]); 00096 virtual int ComputeInteractionState(int X, int Y, int modified=0); 00098 00100 00101 virtual void GetActors(vtkPropCollection *); 00102 virtual void ReleaseGraphicsResources(vtkWindow *); 00103 virtual int RenderOverlay(vtkViewport *viewport); 00104 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 00105 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); 00106 virtual int HasTranslucentPolygonalGeometry(); 00108 00110 virtual vtkPolyData * GetContourRepresentationAsPolyData(); 00111 00113 00117 vtkSetMacro( AlwaysOnTop, int ); 00118 vtkGetMacro( AlwaysOnTop, int ); 00119 vtkBooleanMacro( AlwaysOnTop, int ); 00121 00124 void SetLineColor(double r, double g, double b); 00125 00128 virtual void SetShowSelectedNodes(int); 00129 00131 virtual double *GetBounds(); 00132 00133 protected: 00134 vtkOrientedGlyphContourRepresentation(); 00135 ~vtkOrientedGlyphContourRepresentation(); 00136 00137 // Render the cursor 00138 vtkActor *Actor; 00139 vtkPolyDataMapper *Mapper; 00140 vtkGlyph3D *Glypher; 00141 vtkActor *ActiveActor; 00142 vtkPolyDataMapper *ActiveMapper; 00143 vtkGlyph3D *ActiveGlypher; 00144 vtkPolyData *CursorShape; 00145 vtkPolyData *ActiveCursorShape; 00146 vtkPolyData *FocalData; 00147 vtkPoints *FocalPoint; 00148 vtkPolyData *ActiveFocalData; 00149 vtkPoints *ActiveFocalPoint; 00150 00151 vtkPolyData *SelectedNodesData; 00152 vtkPoints *SelectedNodesPoints; 00153 vtkActor *SelectedNodesActor; 00154 vtkPolyDataMapper *SelectedNodesMapper; 00155 vtkGlyph3D *SelectedNodesGlypher; 00156 vtkPolyData *SelectedNodesCursorShape; 00157 void CreateSelectedNodesRepresentation(); 00158 00159 vtkPolyData *Lines; 00160 vtkPolyDataMapper *LinesMapper; 00161 vtkActor *LinesActor; 00162 00163 // Support picking 00164 double LastPickPosition[3]; 00165 double LastEventPosition[2]; 00166 00167 // Methods to manipulate the cursor 00168 void Translate(double eventPos[2]); 00169 void Scale(double eventPos[2]); 00170 void ShiftContour(double eventPos[2]); 00171 void ScaleContour(double eventPos[2]); 00172 00173 void ComputeCentroid(double* ioCentroid); 00174 00175 // Properties used to control the appearance of selected objects and 00176 // the manipulator in general. 00177 vtkProperty *Property; 00178 vtkProperty *ActiveProperty; 00179 vtkProperty *LinesProperty; 00180 void CreateDefaultProperties(); 00181 00182 00183 // Distance between where the mouse event happens and where the 00184 // widget is focused - maintain this distance during interaction. 00185 double InteractionOffset[2]; 00186 00187 int AlwaysOnTop; 00188 00189 virtual void BuildLines(); 00190 00191 private: 00192 vtkOrientedGlyphContourRepresentation(const vtkOrientedGlyphContourRepresentation&); //Not implemented 00193 void operator=(const vtkOrientedGlyphContourRepresentation&); //Not implemented 00194 }; 00195 00196 #endif