00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00037 #ifndef __vtkCommunity2DLayoutStrategy_h
00038 #define __vtkCommunity2DLayoutStrategy_h
00039
00040 #include "vtkGraphLayoutStrategy.h"
00041
00042 #include "vtkSmartPointer.h"
00043
00044 class vtkFastSplatter;
00045 class vtkImageData;
00046 class vtkFloatArray;
00047
00048 class VTK_INFOVIS_EXPORT vtkCommunity2DLayoutStrategy : public vtkGraphLayoutStrategy
00049 {
00050 public:
00051 static vtkCommunity2DLayoutStrategy *New();
00052
00053 vtkTypeMacro(vtkCommunity2DLayoutStrategy, vtkGraphLayoutStrategy);
00054 void PrintSelf(ostream& os, vtkIndent indent);
00055
00057
00060 vtkSetClampMacro(RandomSeed, int, 0, VTK_LARGE_INTEGER);
00061 vtkGetMacro(RandomSeed, int);
00063
00065
00070 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_LARGE_INTEGER);
00071 vtkGetMacro(MaxNumberOfIterations, int);
00073
00075
00079 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_LARGE_INTEGER);
00080 vtkGetMacro(IterationsPerLayout, int);
00082
00084
00087 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
00088 vtkGetMacro(InitialTemperature, float);
00090
00092
00096 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
00097 vtkGetMacro(CoolDownRate, double);
00099
00100
00102
00104 vtkSetMacro(RestDistance, float);
00105 vtkGetMacro(RestDistance, float);
00107
00110 virtual void Initialize();
00111
00116 virtual void Layout();
00117
00120 virtual int IsLayoutComplete() {return this->LayoutComplete;}
00121
00123
00124 vtkGetStringMacro(CommunityArrayName);
00125 vtkSetStringMacro(CommunityArrayName);
00127
00129
00133 vtkSetClampMacro(CommunityStrength, float, 0.1, 1.0);
00134 vtkGetMacro(CommunityStrength, float);
00136
00137 protected:
00138 vtkCommunity2DLayoutStrategy();
00139 ~vtkCommunity2DLayoutStrategy();
00140
00141 int MaxNumberOfIterations;
00142 float InitialTemperature;
00143 float CoolDownRate;
00144
00145 private:
00146
00147
00148
00149
00150
00151 typedef struct
00152 {
00153 vtkIdType from;
00154 vtkIdType to;
00155 float weight;
00156 } vtkLayoutEdge;
00157
00158
00159 vtkSmartPointer<vtkFastSplatter> DensityGrid;
00160 vtkSmartPointer<vtkImageData> SplatImage;
00161 vtkSmartPointer<vtkFloatArray> RepulsionArray;
00162 vtkSmartPointer<vtkFloatArray> AttractionArray;
00163
00164
00165 vtkLayoutEdge *EdgeArray;
00166
00167 int RandomSeed;
00168 int IterationsPerLayout;
00169 int TotalIterations;
00170 int LayoutComplete;
00171 float Temp;
00172 float RestDistance;
00173 float CommunityStrength;
00174
00176 char* CommunityArrayName;
00177
00178
00179 void GenerateCircularSplat(vtkImageData *splat, int x, int y);
00180 void GenerateGaussianSplat(vtkImageData *splat, int x, int y);
00181 void ResolveCoincidentVertices();
00182
00183 vtkCommunity2DLayoutStrategy(const vtkCommunity2DLayoutStrategy&);
00184 void operator=(const vtkCommunity2DLayoutStrategy&);
00185 };
00186
00187 #endif
00188