VTK
dox/Graphics/vtkDijkstraGraphGeodesicPath.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDijkstraGraphGeodesicPath.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 =========================================================================*/
00037 #ifndef __vtkDijkstraGraphGeodesicPath_h
00038 #define __vtkDijkstraGraphGeodesicPath_h
00039 
00040 #include "vtkGraphGeodesicPath.h"
00041 
00042 class vtkDijkstraGraphInternals;
00043 class vtkIdList;
00044 
00045 class VTK_GRAPHICS_EXPORT vtkDijkstraGraphGeodesicPath :
00046                            public vtkGraphGeodesicPath
00047 {
00048 public:
00049   
00051   static vtkDijkstraGraphGeodesicPath *New();
00052 
00054 
00055   vtkTypeMacro(vtkDijkstraGraphGeodesicPath,vtkGraphGeodesicPath);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00058 
00060 
00061   vtkGetObjectMacro(IdList, vtkIdList);
00063   
00065 
00067   vtkSetMacro(StopWhenEndReached, int);
00068   vtkGetMacro(StopWhenEndReached, int);
00069   vtkBooleanMacro(StopWhenEndReached, int);
00071   
00073 
00074   vtkSetMacro(UseScalarWeights, int);
00075   vtkGetMacro(UseScalarWeights, int);
00076   vtkBooleanMacro(UseScalarWeights, int);
00078 
00080 
00081   vtkSetMacro(RepelPathFromVertices, int);
00082   vtkGetMacro(RepelPathFromVertices, int);
00083   vtkBooleanMacro(RepelPathFromVertices, int);
00085 
00087 
00088   virtual void SetRepelVertices(vtkPoints*);
00089   vtkGetObjectMacro(RepelVertices, vtkPoints);
00091 
00093   virtual double GetGeodesicLength() { return 0.0; }
00094 
00096   virtual void GetCumulativeWeights(vtkDoubleArray *weights);
00097   
00098 protected:
00099   vtkDijkstraGraphGeodesicPath();
00100   ~vtkDijkstraGraphGeodesicPath();
00101 
00102   virtual int RequestData(vtkInformation *, vtkInformationVector **, 
00103                           vtkInformationVector *);
00104 
00105   // Build a graph description of the input.
00106   virtual void BuildAdjacency( vtkDataSet *inData );
00107 
00108   vtkTimeStamp AdjacencyBuildTime;
00109   
00110   // The fixed cost going from vertex u to v.
00111   virtual double CalculateStaticEdgeCost( vtkDataSet *inData, vtkIdType u, vtkIdType v);
00112 
00113   // The cost going from vertex u to v that may depend on one or more vertices
00114   //that precede u.
00115   virtual double CalculateDynamicEdgeCost( vtkDataSet *, vtkIdType , vtkIdType )
00116   { return 0.0; }
00117 
00118   void Initialize( vtkDataSet *inData );
00119 
00120   void Reset();
00121 
00122   // Calculate shortest path from vertex startv to vertex endv.
00123   virtual void ShortestPath( vtkDataSet *inData, int startv, int endv );
00124   
00125   // Relax edge u,v with weight w.
00126   void Relax(const int& u, const int& v, const double& w);
00127 
00128   // Backtrace the shortest path
00129   void TraceShortestPath( vtkDataSet* inData, vtkPolyData* outPoly,
00130                vtkIdType startv, vtkIdType endv);
00131   
00132   // The number of vertices.
00133   int NumberOfVertices;
00134   
00135   // The vertex ids on the shortest path.
00136   vtkIdList *IdList;
00137   
00138   //Internalized STL containers.
00139   vtkDijkstraGraphInternals *Internals;
00140   
00141   int StopWhenEndReached;
00142   int UseScalarWeights;
00143   int RepelPathFromVertices;
00144 
00145   vtkPoints* RepelVertices;
00146 
00147 private:
00148   vtkDijkstraGraphGeodesicPath(const vtkDijkstraGraphGeodesicPath&);  // Not implemented.
00149   void operator=(const vtkDijkstraGraphGeodesicPath&);  // Not implemented.
00150 
00151 };
00152 
00153 #endif
00154