VTK
dox/Filters/Hybrid/vtkProjectedTerrainPath.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkProjectedTerrainPath.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 =========================================================================*/
00070 #ifndef __vtkProjectedTerrainPath_h
00071 #define __vtkProjectedTerrainPath_h
00072 
00073 #include "vtkFiltersHybridModule.h" // For export macro
00074 #include "vtkPolyDataAlgorithm.h"
00075 
00076 class vtkPriorityQueue;
00077 class vtkImageData;
00078 class vtkEdgeList;
00079 class vtkPoints;
00080 
00081 class VTKFILTERSHYBRID_EXPORT vtkProjectedTerrainPath : public vtkPolyDataAlgorithm
00082 {
00083 public:
00085 
00086   vtkTypeMacro(vtkProjectedTerrainPath,vtkPolyDataAlgorithm);
00087   void PrintSelf(ostream& os, vtkIndent indent);
00089 
00091   static vtkProjectedTerrainPath* New();
00092 
00094 
00098   void SetSourceData(vtkImageData *source);
00099   vtkImageData *GetSource();
00101 
00104   void SetSourceConnection(vtkAlgorithmOutput* algOutput);
00105 
00106 //BTX
00107   enum {SIMPLE_PROJECTION=0,NONOCCLUDED_PROJECTION,HUG_PROJECTION};
00108 //ETX
00109 
00111 
00117   vtkSetClampMacro(ProjectionMode,int,SIMPLE_PROJECTION,HUG_PROJECTION);
00118   vtkGetMacro(ProjectionMode,int);
00119   void SetProjectionModeToSimple()
00120     {this->SetProjectionMode(SIMPLE_PROJECTION);}
00121   void SetProjectionModeToNonOccluded()
00122     {this->SetProjectionMode(NONOCCLUDED_PROJECTION);}
00123   void SetProjectionModeToHug()
00124     {this->SetProjectionMode(HUG_PROJECTION);}
00126 
00128 
00131   vtkSetMacro(HeightOffset,double);
00132   vtkGetMacro(HeightOffset,double);
00134 
00136 
00139   vtkSetClampMacro(HeightTolerance,double,0.0,VTK_FLOAT_MAX);
00140   vtkGetMacro(HeightTolerance,double);
00142 
00144 
00147   vtkSetClampMacro(MaximumNumberOfLines,vtkIdType,1,VTK_ID_MAX);
00148   vtkGetMacro(MaximumNumberOfLines,vtkIdType);
00150 
00151 protected:
00152   vtkProjectedTerrainPath();
00153   ~vtkProjectedTerrainPath();
00154 
00155   virtual int RequestData(vtkInformation *, vtkInformationVector **,
00156                           vtkInformationVector *);
00157   virtual int FillInputPortInformation(int port, vtkInformation *info);
00158 
00159   // Supporting methods
00160   void GetImageIndex(double x[3], double loc[2], int ij[2]);
00161   double GetHeight(double loc[2], int ij[2]);
00162   void ComputeError(vtkIdType edgeId);
00163   void RemoveOcclusions();
00164   void HugTerrain();
00165   void SplitEdge(vtkIdType eId, double t);
00166 
00167   //ivars that the API addresses
00168   int       ProjectionMode;
00169   double    HeightOffset;
00170   double    HeightTolerance;
00171   vtkIdType MaximumNumberOfLines;
00172 
00173   //Bookeeping arrays
00174   int          Dimensions[3];
00175   int          Extent[6];
00176   double       Origin[3];
00177   double       Spacing[3];
00178   vtkDataArray *Heights;
00179   vtkPoints    *Points;
00180   vtkIdType    NumLines;
00181 
00182   //Errors above/below terrain. In both instances, negative values are
00183   //inserted because the priority queue puts smallest values on top.
00184   vtkPriorityQueue *PositiveLineError; //errors above terrain
00185   vtkPriorityQueue *NegativeLineError; //errors below terrain
00186 
00187   //This is a PIMPL'd vector representing edges
00188   vtkEdgeList *EdgeList;
00189 
00190 private:
00191   vtkProjectedTerrainPath(const vtkProjectedTerrainPath&);  // Not implemented.
00192   void operator=(const vtkProjectedTerrainPath&);  // Not implemented.
00193 
00194 };
00195 
00196 #endif