VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Infovis/Layout/vtkClustering2DLayoutStrategy.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkClustering2DLayoutStrategy.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 -------------------------------------------------------------------------*/
00035 #ifndef vtkClustering2DLayoutStrategy_h
00036 #define vtkClustering2DLayoutStrategy_h
00037 
00038 #include "vtkInfovisLayoutModule.h" // For export macro
00039 #include "vtkGraphLayoutStrategy.h"
00040 
00041 #include "vtkSmartPointer.h"    // Required for smart pointer internal ivars.
00042 
00043 class vtkFastSplatter;
00044 class vtkImageData;
00045 class vtkIntArray;
00046 class vtkFloatArray;
00047 
00048 class VTKINFOVISLAYOUT_EXPORT vtkClustering2DLayoutStrategy : public vtkGraphLayoutStrategy
00049 {
00050 public:
00051   static vtkClustering2DLayoutStrategy *New();
00052 
00053   vtkTypeMacro(vtkClustering2DLayoutStrategy, vtkGraphLayoutStrategy);
00054   void PrintSelf(ostream& os, vtkIndent indent);
00055 
00057 
00060   vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
00061   vtkGetMacro(RandomSeed, int);
00063 
00065 
00070   vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
00071   vtkGetMacro(MaxNumberOfIterations, int);
00073 
00075 
00079   vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
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 
00101 
00103   vtkSetMacro(RestDistance, float);
00104   vtkGetMacro(RestDistance, float);
00106 
00109   virtual void Initialize();
00110 
00115   virtual void Layout();
00116 
00119   virtual int IsLayoutComplete() {return this->LayoutComplete;}
00120 
00121 protected:
00122   vtkClustering2DLayoutStrategy();
00123   ~vtkClustering2DLayoutStrategy();
00124 
00125   int    MaxNumberOfIterations;  //Maximum number of iterations.
00126   float  InitialTemperature;
00127   float  CoolDownRate;  //Cool-down rate.  Note:  Higher # = Slower rate.
00128 
00129 private:
00130 
00131   //BTX
00132 
00133   // An edge consists of two vertices joined together.
00134   // This struct acts as a "pointer" to those two vertices.
00135   typedef struct
00136   {
00137     vtkIdType from;
00138     vtkIdType to;
00139     float weight;
00140     int dead_edge; // I'm making this an int so that the edge array is
00141                    // word boundary aligned... but I'm not sure what
00142                    // really happens in these days of magical compilers
00143   } vtkLayoutEdge;
00144 
00145   // This class 'has a' vtkFastSplatter for the density grid
00146   vtkSmartPointer<vtkFastSplatter>        DensityGrid;
00147   vtkSmartPointer<vtkImageData>           SplatImage;
00148   vtkSmartPointer<vtkFloatArray>          RepulsionArray;
00149   vtkSmartPointer<vtkFloatArray>          AttractionArray;
00150   vtkSmartPointer<vtkIntArray>            EdgeCountArray;
00151   //ETX
00152 
00153   vtkLayoutEdge *EdgeArray;
00154 
00155   int RandomSeed;
00156   int IterationsPerLayout;
00157   int TotalIterations;
00158   int LayoutComplete;
00159   float Temp;
00160   float RestDistance;
00161   float CuttingThreshold;
00162 
00163   // Private helper methods
00164   void GenerateCircularSplat(vtkImageData *splat, int x, int y);
00165   void GenerateGaussianSplat(vtkImageData *splat, int x, int y);
00166   void ResolveCoincidentVertices();
00167 
00168   vtkClustering2DLayoutStrategy(const vtkClustering2DLayoutStrategy&);  // Not implemented.
00169   void operator=(const vtkClustering2DLayoutStrategy&);  // Not implemented.
00170 };
00171 
00172 #endif
00173