00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00038 #ifndef __vtkFast2DLayoutStrategy_h
00039 #define __vtkFast2DLayoutStrategy_h
00040
00041 #include "vtkGraphLayoutStrategy.h"
00042
00043 #include "vtkSmartPointer.h"
00044
00045 class vtkFastSplatter;
00046 class vtkFloatArray;
00047 class vtkGraphToPolyData;
00048 class vtkImageData;
00049
00050 class VTK_INFOVIS_EXPORT vtkFast2DLayoutStrategy : public vtkGraphLayoutStrategy
00051 {
00052 public:
00053 static vtkFast2DLayoutStrategy *New();
00054
00055 vtkTypeRevisionMacro(vtkFast2DLayoutStrategy, vtkGraphLayoutStrategy);
00056 void PrintSelf(ostream& os, vtkIndent indent);
00057
00059
00062 vtkSetClampMacro(RandomSeed, int, 0, VTK_LARGE_INTEGER);
00063 vtkGetMacro(RandomSeed, int);
00065
00067
00072 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_LARGE_INTEGER);
00073 vtkGetMacro(MaxNumberOfIterations, int);
00075
00077
00081 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_LARGE_INTEGER);
00082 vtkGetMacro(IterationsPerLayout, int);
00084
00086
00089 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
00090 vtkGetMacro(InitialTemperature, float);
00092
00094
00098 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
00099 vtkGetMacro(CoolDownRate, double);
00101
00103
00105 vtkSetMacro(RestDistance, float);
00106 vtkGetMacro(RestDistance, float);
00108
00111 virtual void Initialize();
00112
00117 virtual void Layout();
00118
00121 virtual int IsLayoutComplete() {return this->LayoutComplete;}
00122
00123 protected:
00124 vtkFast2DLayoutStrategy();
00125 ~vtkFast2DLayoutStrategy();
00126
00127 int MaxNumberOfIterations;
00128 float InitialTemperature;
00129 float CoolDownRate;
00130
00131 private:
00132
00133
00134
00135
00136
00137 typedef struct
00138 {
00139 vtkIdType from;
00140 vtkIdType to;
00141 float weight;
00142 } vtkLayoutEdge;
00143
00144
00145 vtkSmartPointer<vtkGraphToPolyData> GraphToPoly;
00146 vtkSmartPointer<vtkFastSplatter> DensityGrid;
00147 vtkSmartPointer<vtkImageData> SplatImage;
00148 vtkSmartPointer<vtkFloatArray> RepulsionArray;
00149 vtkSmartPointer<vtkFloatArray> AttractionArray;
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
00161
00162 void GenerateCircularSplat(vtkImageData *splat, int x, int y);
00163 void GenerateGaussianSplat(vtkImageData *splat, int x, int y);
00164 void ResolveCoincidentVertices();
00165
00166 vtkFast2DLayoutStrategy(const vtkFast2DLayoutStrategy&);
00167 void operator=(const vtkFast2DLayoutStrategy&);
00168 };
00169
00170 #endif
00171