VTK
|
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 "vtkPolyDataAlgorithm.h" 00074 00075 class vtkPriorityQueue; 00076 class vtkImageData; 00077 class vtkEdgeList; 00078 class vtkPoints; 00079 00080 class VTK_HYBRID_EXPORT vtkProjectedTerrainPath : public vtkPolyDataAlgorithm 00081 { 00082 public: 00084 00085 vtkTypeMacro(vtkProjectedTerrainPath,vtkPolyDataAlgorithm); 00086 void PrintSelf(ostream& os, vtkIndent indent); 00088 00090 static vtkProjectedTerrainPath* New(); 00091 00093 00095 void SetSource(vtkImageData *source); 00096 vtkImageData *GetSource(); 00098 00099 //BTX 00100 enum {SIMPLE_PROJECTION=0,NONOCCLUDED_PROJECTION,HUG_PROJECTION}; 00101 //ETX 00102 00104 00110 vtkSetClampMacro(ProjectionMode,int,SIMPLE_PROJECTION,HUG_PROJECTION); 00111 vtkGetMacro(ProjectionMode,int); 00112 void SetProjectionModeToSimple() 00113 {this->SetProjectionMode(SIMPLE_PROJECTION);} 00114 void SetProjectionModeToNonOccluded() 00115 {this->SetProjectionMode(NONOCCLUDED_PROJECTION);} 00116 void SetProjectionModeToHug() 00117 {this->SetProjectionMode(HUG_PROJECTION);} 00119 00121 00124 vtkSetMacro(HeightOffset,double); 00125 vtkGetMacro(HeightOffset,double); 00127 00129 00132 vtkSetClampMacro(HeightTolerance,double,0.0,VTK_LARGE_FLOAT); 00133 vtkGetMacro(HeightTolerance,double); 00135 00137 00140 vtkSetClampMacro(MaximumNumberOfLines,vtkIdType,1,VTK_LARGE_ID); 00141 vtkGetMacro(MaximumNumberOfLines,vtkIdType); 00143 00144 protected: 00145 vtkProjectedTerrainPath(); 00146 ~vtkProjectedTerrainPath(); 00147 00148 virtual int RequestData(vtkInformation *, vtkInformationVector **, 00149 vtkInformationVector *); 00150 virtual int FillInputPortInformation(int port, vtkInformation *info); 00151 00152 // Supporting methods 00153 void GetImageIndex(double x[3], double loc[2], int ij[2]); 00154 double GetHeight(double loc[2], int ij[2]); 00155 void ComputeError(vtkIdType edgeId); 00156 void RemoveOcclusions(); 00157 void HugTerrain(); 00158 void SplitEdge(vtkIdType eId, double t); 00159 00160 //ivars that the API addresses 00161 int ProjectionMode; 00162 double HeightOffset; 00163 double HeightTolerance; 00164 vtkIdType MaximumNumberOfLines; 00165 00166 //Bookeeping arrays 00167 int Dimensions[3]; 00168 int Extent[6]; 00169 double Origin[3]; 00170 double Spacing[3]; 00171 vtkDataArray *Heights; 00172 vtkPoints *Points; 00173 vtkIdType NumLines; 00174 00175 //Errors above/below terrain. In both instances, negative values are 00176 //inserted because the priority queue puts smallest values on top. 00177 vtkPriorityQueue *PositiveLineError; //errors above terrain 00178 vtkPriorityQueue *NegativeLineError; //errors below terrain 00179 00180 //This is a PIMPL'd vector representing edges 00181 vtkEdgeList *EdgeList; 00182 00183 private: 00184 vtkProjectedTerrainPath(const vtkProjectedTerrainPath&); // Not implemented. 00185 void operator=(const vtkProjectedTerrainPath&); // Not implemented. 00186 00187 }; 00188 00189 #endif