VTK
dox/Widgets/vtkPolygonalSurfacePointPlacer.h
Go to the documentation of this file.
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   double       ParametricCoords[3]; // parametric coords within cell
00051   vtkPolyData  *PolyData;
00052 };
00053 //ETX
00054 
00055 class VTK_WIDGETS_EXPORT vtkPolygonalSurfacePointPlacer 
00056                                   : public vtkPolyDataPointPlacer
00057 {
00058 public:
00060   static vtkPolygonalSurfacePointPlacer *New();
00061 
00063 
00064   vtkTypeMacro(vtkPolygonalSurfacePointPlacer,vtkPolyDataPointPlacer);
00065   void PrintSelf(ostream& os, vtkIndent indent);
00067 
00068   // Descuription:
00069   // Add /remove a prop, to place points on
00070   virtual void AddProp( vtkProp * );
00071   virtual void RemoveViewProp(vtkProp *prop);
00072   virtual void RemoveAllProps();
00073   
00075 
00080   virtual int ComputeWorldPosition( vtkRenderer *ren,
00081                                     double displayPos[2], 
00082                                     double worldPos[3],
00083                                     double worldOrient[9] );
00085   
00087 
00090   virtual int ComputeWorldPosition( vtkRenderer *ren,
00091                                     double displayPos[2], 
00092                                     double refWorldPos[3],
00093                                     double worldPos[3],
00094                                     double worldOrient[9] );
00096   
00099   virtual int ValidateWorldPosition( double worldPos[3] );
00100   
00102   virtual int ValidateDisplayPosition( vtkRenderer *, double displayPos[2] );
00103   
00105 
00107   virtual int ValidateWorldPosition( double worldPos[3],
00108                                      double worldOrient[9] );
00110 
00112 
00113   vtkGetObjectMacro( CellPicker, vtkCellPicker );
00115 
00117 
00119   vtkGetObjectMacro( Polys, vtkPolyDataCollection );
00121   
00123 
00126   vtkSetMacro( DistanceOffset, double ); 
00127   vtkGetMacro( DistanceOffset, double ); 
00129 
00130 //BTX
00132 
00133   typedef vtkPolygonalSurfacePointPlacerNode Node;
00134   Node *GetNodeAtWorldPosition( double worldPos[3] );
00135 //ETX
00137 
00138 protected:
00139   vtkPolygonalSurfacePointPlacer();
00140   ~vtkPolygonalSurfacePointPlacer();
00141 
00142   // The props that represents the terrain data (one or more) in a rendered 
00143   // scene
00144   vtkCellPicker                           *CellPicker;
00145   vtkPolyDataCollection                   *Polys;
00146   vtkPolygonalSurfacePointPlacerInternals *Internals;
00147   double                                   DistanceOffset;
00148   
00149 private:
00150   vtkPolygonalSurfacePointPlacer(const vtkPolygonalSurfacePointPlacer&);  //Not implemented
00151   void operator=(const vtkPolygonalSurfacePointPlacer&);  //Not implemented
00152 };
00153 
00154 #endif