VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkPolygonalSurfacePointPlacer.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 =========================================================================*/ 00031 #ifndef __vtkPolygonalSurfacePointPlacer_h 00032 #define __vtkPolygonalSurfacePointPlacer_h 00033 00034 #include "vtkPolyDataPointPlacer.h" 00035 00036 class vtkPolyDataCollection; 00037 class vtkCellPicker; 00038 class vtkPolygonalSurfacePointPlacerInternals; 00039 class vtkPolyData; 00040 00041 //BTX 00042 // The Node stores information about the point. This information is used by 00043 // the interpolator. Reusing this information avoids the need for a second 00044 // pick operation to regenerate it. (Cellpickers are slow). 00045 struct vtkPolygonalSurfacePointPlacerNode 00046 { 00047 double WorldPosition[3]; 00048 double SurfaceWorldPosition[3]; 00049 vtkIdType CellId; 00050 vtkIdType PointId; 00051 double ParametricCoords[3]; // parametric coords within cell 00052 vtkPolyData *PolyData; 00053 }; 00054 //ETX 00055 00056 class VTK_WIDGETS_EXPORT vtkPolygonalSurfacePointPlacer 00057 : public vtkPolyDataPointPlacer 00058 { 00059 public: 00061 static vtkPolygonalSurfacePointPlacer *New(); 00062 00064 00065 vtkTypeMacro(vtkPolygonalSurfacePointPlacer,vtkPolyDataPointPlacer); 00066 void PrintSelf(ostream& os, vtkIndent indent); 00068 00069 // Descuription: 00070 // Add /remove a prop, to place points on 00071 virtual void AddProp( vtkProp * ); 00072 virtual void RemoveViewProp(vtkProp *prop); 00073 virtual void RemoveAllProps(); 00074 00076 00081 virtual int ComputeWorldPosition( vtkRenderer *ren, 00082 double displayPos[2], 00083 double worldPos[3], 00084 double worldOrient[9] ); 00086 00088 00091 virtual int ComputeWorldPosition( vtkRenderer *ren, 00092 double displayPos[2], 00093 double refWorldPos[3], 00094 double worldPos[3], 00095 double worldOrient[9] ); 00097 00100 virtual int ValidateWorldPosition( double worldPos[3] ); 00101 00103 00104 virtual int UpdateNodeWorldPosition( double worldPos[3], 00105 vtkIdType nodePointId ); 00107 00109 virtual int ValidateDisplayPosition( vtkRenderer *, double displayPos[2] ); 00110 00112 00114 virtual int ValidateWorldPosition( double worldPos[3], 00115 double worldOrient[9] ); 00117 00119 00120 vtkGetObjectMacro( CellPicker, vtkCellPicker ); 00122 00124 00126 vtkGetObjectMacro( Polys, vtkPolyDataCollection ); 00128 00130 00133 vtkSetMacro( DistanceOffset, double ); 00134 vtkGetMacro( DistanceOffset, double ); 00136 00138 00141 vtkSetMacro( SnapToClosestPoint, int ); 00142 vtkGetMacro( SnapToClosestPoint, int ); 00143 vtkBooleanMacro( SnapToClosestPoint, int ); 00145 00146 //BTX 00148 00149 typedef vtkPolygonalSurfacePointPlacerNode Node; 00150 Node *GetNodeAtWorldPosition( double worldPos[3] ); 00151 //ETX 00153 00154 protected: 00155 vtkPolygonalSurfacePointPlacer(); 00156 ~vtkPolygonalSurfacePointPlacer(); 00157 00158 // The props that represents the terrain data (one or more) in a rendered 00159 // scene 00160 vtkCellPicker *CellPicker; 00161 vtkPolyDataCollection *Polys; 00162 vtkPolygonalSurfacePointPlacerInternals *Internals; 00163 double DistanceOffset; 00164 int SnapToClosestPoint; 00165 00166 private: 00167 vtkPolygonalSurfacePointPlacer(const vtkPolygonalSurfacePointPlacer&); //Not implemented 00168 void operator=(const vtkPolygonalSurfacePointPlacer&); //Not implemented 00169 }; 00170 00171 #endif