00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00035 #ifndef __vtkClustering2DLayoutStrategy_h
00036 #define __vtkClustering2DLayoutStrategy_h
00037
00038 #include "vtkGraphLayoutStrategy.h"
00039
00040 #include "vtkSmartPointer.h"
00041
00042 class vtkFastSplatter;
00043 class vtkImageData;
00044 class vtkIntArray;
00045 class vtkFloatArray;
00046
00047 class VTK_INFOVIS_EXPORT vtkClustering2DLayoutStrategy : public vtkGraphLayoutStrategy
00048 {
00049 public:
00050 static vtkClustering2DLayoutStrategy *New();
00051
00052 vtkTypeMacro(vtkClustering2DLayoutStrategy, vtkGraphLayoutStrategy);
00053 void PrintSelf(ostream& os, vtkIndent indent);
00054
00056
00059 vtkSetClampMacro(RandomSeed, int, 0, VTK_LARGE_INTEGER);
00060 vtkGetMacro(RandomSeed, int);
00062
00064
00069 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_LARGE_INTEGER);
00070 vtkGetMacro(MaxNumberOfIterations, int);
00072
00074
00078 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_LARGE_INTEGER);
00079 vtkGetMacro(IterationsPerLayout, int);
00081
00083
00086 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
00087 vtkGetMacro(InitialTemperature, float);
00089
00091
00095 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
00096 vtkGetMacro(CoolDownRate, double);
00098
00100
00102 vtkSetMacro(RestDistance, float);
00103 vtkGetMacro(RestDistance, float);
00105
00108 virtual void Initialize();
00109
00114 virtual void Layout();
00115
00118 virtual int IsLayoutComplete() {return this->LayoutComplete;}
00119
00120 protected:
00121 vtkClustering2DLayoutStrategy();
00122 ~vtkClustering2DLayoutStrategy();
00123
00124 int MaxNumberOfIterations;
00125 float InitialTemperature;
00126 float CoolDownRate;
00127
00128 private:
00129
00130
00131
00132
00133
00134 typedef struct
00135 {
00136 vtkIdType from;
00137 vtkIdType to;
00138 float weight;
00139 int dead_edge;
00140
00141
00142 } vtkLayoutEdge;
00143
00144
00145 vtkSmartPointer<vtkFastSplatter> DensityGrid;
00146 vtkSmartPointer<vtkImageData> SplatImage;
00147 vtkSmartPointer<vtkFloatArray> RepulsionArray;
00148 vtkSmartPointer<vtkFloatArray> AttractionArray;
00149 vtkSmartPointer<vtkIntArray> EdgeCountArray;
00150
00151
00152 vtkLayoutEdge *EdgeArray;
00153
00154 int RandomSeed;
00155 int IterationsPerLayout;
00156 int TotalIterations;
00157 int LayoutComplete;
00158 float Temp;
00159 float RestDistance;
00160 float CuttingThreshold;
00161
00162
00163 void GenerateCircularSplat(vtkImageData *splat, int x, int y);
00164 void GenerateGaussianSplat(vtkImageData *splat, int x, int y);
00165 void ResolveCoincidentVertices();
00166
00167 vtkClustering2DLayoutStrategy(const vtkClustering2DLayoutStrategy&);
00168 void operator=(const vtkClustering2DLayoutStrategy&);
00169 };
00170
00171 #endif
00172