00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00041 #ifndef __vtkConstrained2DLayoutStrategy_h
00042 #define __vtkConstrained2DLayoutStrategy_h
00043
00044 #include "vtkGraphLayoutStrategy.h"
00045
00046 #include "vtkSmartPointer.h"
00047
00048 class vtkFastSplatter;
00049 class vtkImageData;
00050 class vtkFloatArray;
00051
00052 class VTK_INFOVIS_EXPORT vtkConstrained2DLayoutStrategy : public vtkGraphLayoutStrategy
00053 {
00054 public:
00055 static vtkConstrained2DLayoutStrategy *New();
00056
00057 vtkTypeMacro(vtkConstrained2DLayoutStrategy, vtkGraphLayoutStrategy);
00058 void PrintSelf(ostream& os, vtkIndent indent);
00059
00061
00064 vtkSetClampMacro(RandomSeed, int, 0, VTK_LARGE_INTEGER);
00065 vtkGetMacro(RandomSeed, int);
00067
00069
00074 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_LARGE_INTEGER);
00075 vtkGetMacro(MaxNumberOfIterations, int);
00077
00079
00083 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_LARGE_INTEGER);
00084 vtkGetMacro(IterationsPerLayout, int);
00086
00088
00091 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
00092 vtkGetMacro(InitialTemperature, float);
00094
00096
00100 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
00101 vtkGetMacro(CoolDownRate, double);
00103
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
00127
00129 vtkSetStringMacro(InputArrayName);
00130 vtkGetStringMacro(InputArrayName);
00132
00133 protected:
00134 vtkConstrained2DLayoutStrategy();
00135 ~vtkConstrained2DLayoutStrategy();
00136
00137 int MaxNumberOfIterations;
00138 float InitialTemperature;
00139 float CoolDownRate;
00140
00141 private:
00142
00143
00144
00145
00146
00147 typedef struct
00148 {
00149 vtkIdType from;
00150 vtkIdType to;
00151 float weight;
00152 } vtkLayoutEdge;
00153
00154
00155 vtkSmartPointer<vtkFastSplatter> DensityGrid;
00156 vtkSmartPointer<vtkImageData> SplatImage;
00157 vtkSmartPointer<vtkFloatArray> RepulsionArray;
00158 vtkSmartPointer<vtkFloatArray> AttractionArray;
00159
00160
00161 vtkLayoutEdge *EdgeArray;
00162
00163 int RandomSeed;
00164 int IterationsPerLayout;
00165 int TotalIterations;
00166 int LayoutComplete;
00167 float Temp;
00168 float RestDistance;
00169
00170 char* InputArrayName;
00171
00172
00173 void GenerateCircularSplat(vtkImageData *splat, int x, int y);
00174 void GenerateGaussianSplat(vtkImageData *splat, int x, int y);
00175 void ResolveCoincidentVertices();
00176
00177 vtkConstrained2DLayoutStrategy(const vtkConstrained2DLayoutStrategy&);
00178 void operator=(const vtkConstrained2DLayoutStrategy&);
00179 };
00180
00181 #endif
00182