00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00041 #ifndef __vtkFast2DLayoutStrategy_h
00042 #define __vtkFast2DLayoutStrategy_h
00043
00044 #include "vtkGraphLayoutStrategy.h"
00045
00046 #include "vtkSmartPointer.h"
00047
00048 class vtkFastSplatter;
00049 class vtkFloatArray;
00050 class vtkGraphToPolyData;
00051 class vtkImageData;
00052
00053 class VTK_INFOVIS_EXPORT vtkFast2DLayoutStrategy : public vtkGraphLayoutStrategy
00054 {
00055 public:
00056 static vtkFast2DLayoutStrategy *New();
00057
00058 vtkTypeMacro(vtkFast2DLayoutStrategy, vtkGraphLayoutStrategy);
00059 void PrintSelf(ostream& os, vtkIndent indent);
00060
00062
00065 vtkSetClampMacro(RandomSeed, int, 0, VTK_LARGE_INTEGER);
00066 vtkGetMacro(RandomSeed, int);
00068
00070
00075 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_LARGE_INTEGER);
00076 vtkGetMacro(MaxNumberOfIterations, int);
00078
00080
00084 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_LARGE_INTEGER);
00085 vtkGetMacro(IterationsPerLayout, int);
00087
00089
00092 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
00093 vtkGetMacro(InitialTemperature, float);
00095
00097
00101 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
00102 vtkGetMacro(CoolDownRate, double);
00104
00106
00108 vtkSetMacro(RestDistance, float);
00109 vtkGetMacro(RestDistance, float);
00111
00114 virtual void Initialize();
00115
00120 virtual void Layout();
00121
00124 virtual int IsLayoutComplete() {return this->LayoutComplete;}
00125
00126 protected:
00127 vtkFast2DLayoutStrategy();
00128 ~vtkFast2DLayoutStrategy();
00129
00130 int MaxNumberOfIterations;
00131 float InitialTemperature;
00132 float CoolDownRate;
00133
00134 private:
00135
00136
00137
00138
00139
00140 typedef struct
00141 {
00142 vtkIdType from;
00143 vtkIdType to;
00144 float weight;
00145 } vtkLayoutEdge;
00146
00147
00148 vtkSmartPointer<vtkGraphToPolyData> GraphToPoly;
00149 vtkSmartPointer<vtkFastSplatter> DensityGrid;
00150 vtkSmartPointer<vtkImageData> SplatImage;
00151 vtkSmartPointer<vtkFloatArray> RepulsionArray;
00152 vtkSmartPointer<vtkFloatArray> AttractionArray;
00153
00154
00155 vtkLayoutEdge *EdgeArray;
00156
00157 int RandomSeed;
00158 int IterationsPerLayout;
00159 int TotalIterations;
00160 int LayoutComplete;
00161 float Temp;
00162 float RestDistance;
00163
00164
00165 void GenerateCircularSplat(vtkImageData *splat, int x, int y);
00166 void GenerateGaussianSplat(vtkImageData *splat, int x, int y);
00167 void ResolveCoincidentVertices();
00168
00169 vtkFast2DLayoutStrategy(const vtkFast2DLayoutStrategy&);
00170 void operator=(const vtkFast2DLayoutStrategy&);
00171 };
00172
00173 #endif
00174