VTK
dox/Interaction/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 "vtkInteractionWidgetsModule.h" // For export macro
00035 #include "vtkPolyDataPointPlacer.h"
00036 
00037 class  vtkPolyDataCollection;
00038 class  vtkCellPicker;
00039 class  vtkPolygonalSurfacePointPlacerInternals;
00040 class  vtkPolyData;
00041 
00042 //BTX
00043 // The Node stores information about the point. This information is used by
00044 // the interpolator. Reusing this information avoids the need for a second
00045 // pick operation to regenerate it. (Cellpickers are slow).
00046 struct vtkPolygonalSurfacePointPlacerNode
00047 {
00048   double       WorldPosition[3];
00049   double       SurfaceWorldPosition[3];
00050   vtkIdType    CellId;
00051   vtkIdType    PointId;
00052   double       ParametricCoords[3]; // parametric coords within cell
00053   vtkPolyData  *PolyData;
00054 };
00055 //ETX
00056 
00057 class VTKINTERACTIONWIDGETS_EXPORT vtkPolygonalSurfacePointPlacer
00058                                   : public vtkPolyDataPointPlacer
00059 {
00060 public:
00062   static vtkPolygonalSurfacePointPlacer *New();
00063 
00065 
00066   vtkTypeMacro(vtkPolygonalSurfacePointPlacer,vtkPolyDataPointPlacer);
00067   void PrintSelf(ostream& os, vtkIndent indent);
00069 
00070   // Descuription:
00071   // Add /remove a prop, to place points on
00072   virtual void AddProp( vtkProp * );
00073   virtual void RemoveViewProp(vtkProp *prop);
00074   virtual void RemoveAllProps();
00075 
00077 
00082   virtual int ComputeWorldPosition( vtkRenderer *ren,
00083                                     double displayPos[2],
00084                                     double worldPos[3],
00085                                     double worldOrient[9] );
00087 
00089 
00092   virtual int ComputeWorldPosition( vtkRenderer *ren,
00093                                     double displayPos[2],
00094                                     double refWorldPos[3],
00095                                     double worldPos[3],
00096                                     double worldOrient[9] );
00098 
00101   virtual int ValidateWorldPosition( double worldPos[3] );
00102 
00104 
00105   virtual int UpdateNodeWorldPosition( double worldPos[3],
00106                                        vtkIdType nodePointId );
00108 
00110   virtual int ValidateDisplayPosition( vtkRenderer *, double displayPos[2] );
00111 
00113 
00115   virtual int ValidateWorldPosition( double worldPos[3],
00116                                      double worldOrient[9] );
00118 
00120 
00121   vtkGetObjectMacro( CellPicker, vtkCellPicker );
00123 
00125 
00127   vtkGetObjectMacro( Polys, vtkPolyDataCollection );
00129 
00131 
00134   vtkSetMacro( DistanceOffset, double );
00135   vtkGetMacro( DistanceOffset, double );
00137 
00139 
00142   vtkSetMacro( SnapToClosestPoint, int );
00143   vtkGetMacro( SnapToClosestPoint, int );
00144   vtkBooleanMacro( SnapToClosestPoint, int );
00146 
00147 //BTX
00149 
00150   typedef vtkPolygonalSurfacePointPlacerNode Node;
00151   Node *GetNodeAtWorldPosition( double worldPos[3] );
00152 //ETX
00154 
00155 protected:
00156   vtkPolygonalSurfacePointPlacer();
00157   ~vtkPolygonalSurfacePointPlacer();
00158 
00159   // The props that represents the terrain data (one or more) in a rendered
00160   // scene
00161   vtkCellPicker                           *CellPicker;
00162   vtkPolyDataCollection                   *Polys;
00163   vtkPolygonalSurfacePointPlacerInternals *Internals;
00164   double                                   DistanceOffset;
00165   int                                      SnapToClosestPoint;
00166 
00167 private:
00168   vtkPolygonalSurfacePointPlacer(const vtkPolygonalSurfacePointPlacer&);  //Not implemented
00169   void operator=(const vtkPolygonalSurfacePointPlacer&);  //Not implemented
00170 };
00171 
00172 #endif