VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Infovis/Layout/vtkCommunity2DLayoutStrategy.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkCommunity2DLayoutStrategy.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00037 #ifndef vtkCommunity2DLayoutStrategy_h
00038 #define vtkCommunity2DLayoutStrategy_h
00039 
00040 #include "vtkInfovisLayoutModule.h" // For export macro
00041 #include "vtkGraphLayoutStrategy.h"
00042 
00043 #include "vtkSmartPointer.h"    // Required for smart pointer internal ivars.
00044 
00045 class vtkFastSplatter;
00046 class vtkImageData;
00047 class vtkFloatArray;
00048 
00049 class VTKINFOVISLAYOUT_EXPORT vtkCommunity2DLayoutStrategy : public vtkGraphLayoutStrategy
00050 {
00051 public:
00052   static vtkCommunity2DLayoutStrategy *New();
00053 
00054   vtkTypeMacro(vtkCommunity2DLayoutStrategy, vtkGraphLayoutStrategy);
00055   void PrintSelf(ostream& os, vtkIndent indent);
00056 
00058 
00061   vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
00062   vtkGetMacro(RandomSeed, int);
00064 
00066 
00071   vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
00072   vtkGetMacro(MaxNumberOfIterations, int);
00074 
00076 
00080   vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
00081   vtkGetMacro(IterationsPerLayout, int);
00083 
00085 
00088   vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
00089   vtkGetMacro(InitialTemperature, float);
00091 
00093 
00097   vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
00098   vtkGetMacro(CoolDownRate, double);
00100 
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 
00124 
00125   vtkGetStringMacro(CommunityArrayName);
00126   vtkSetStringMacro(CommunityArrayName);
00128 
00130 
00134   vtkSetClampMacro(CommunityStrength, float, 0.1, 1.0);
00135   vtkGetMacro(CommunityStrength, float);
00137 
00138 protected:
00139   vtkCommunity2DLayoutStrategy();
00140   ~vtkCommunity2DLayoutStrategy();
00141 
00142   int    MaxNumberOfIterations;  //Maximum number of iterations.
00143   float  InitialTemperature;
00144   float  CoolDownRate;  //Cool-down rate.  Note:  Higher # = Slower rate.
00145 
00146 private:
00147 
00148   //BTX
00149 
00150   // An edge consists of two vertices joined together.
00151   // This struct acts as a "pointer" to those two vertices.
00152   typedef struct
00153   {
00154     vtkIdType from;
00155     vtkIdType to;
00156     float weight;
00157   } vtkLayoutEdge;
00158 
00159   // This class 'has a' vtkFastSplatter for the density grid
00160   vtkSmartPointer<vtkFastSplatter>        DensityGrid;
00161   vtkSmartPointer<vtkImageData>           SplatImage;
00162   vtkSmartPointer<vtkFloatArray>          RepulsionArray;
00163   vtkSmartPointer<vtkFloatArray>          AttractionArray;
00164   //ETX
00165 
00166   vtkLayoutEdge *EdgeArray;
00167 
00168   int RandomSeed;
00169   int IterationsPerLayout;
00170   int TotalIterations;
00171   int LayoutComplete;
00172   float Temp;
00173   float RestDistance;
00174   float CommunityStrength;
00175 
00177   char* CommunityArrayName;
00178 
00179   // Private helper methods
00180   void GenerateCircularSplat(vtkImageData *splat, int x, int y);
00181   void GenerateGaussianSplat(vtkImageData *splat, int x, int y);
00182   void ResolveCoincidentVertices();
00183 
00184   vtkCommunity2DLayoutStrategy(const vtkCommunity2DLayoutStrategy&);  // Not implemented.
00185   void operator=(const vtkCommunity2DLayoutStrategy&);  // Not implemented.
00186 };
00187 
00188 #endif
00189