VTK
dox/Infovis/Layout/vtkForceDirectedLayoutStrategy.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkForceDirectedLayoutStrategy.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 -------------------------------------------------------------------------*/
00036 #ifndef __vtkForceDirectedLayoutStrategy_h
00037 #define __vtkForceDirectedLayoutStrategy_h
00038 
00039 #include "vtkInfovisLayoutModule.h" // For export macro
00040 #include "vtkGraphLayoutStrategy.h"
00041 
00042 class VTKINFOVISLAYOUT_EXPORT vtkForceDirectedLayoutStrategy : public vtkGraphLayoutStrategy
00043 {
00044 public:
00045   static vtkForceDirectedLayoutStrategy *New();
00046 
00047   vtkTypeMacro(vtkForceDirectedLayoutStrategy, vtkGraphLayoutStrategy);
00048   void PrintSelf(ostream& os, vtkIndent indent);
00049 
00051 
00054   vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
00055   vtkGetMacro(RandomSeed, int);
00057 
00059 
00062   vtkSetVector6Macro(GraphBounds,double);
00063   vtkGetVectorMacro(GraphBounds,double,6);
00065 
00067 
00070   vtkSetMacro(AutomaticBoundsComputation, int);
00071   vtkGetMacro(AutomaticBoundsComputation, int);
00072   vtkBooleanMacro(AutomaticBoundsComputation, int);
00074 
00076 
00080   vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
00081   vtkGetMacro(MaxNumberOfIterations, int);
00083 
00085 
00089   vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
00090   vtkGetMacro(IterationsPerLayout, int);
00092 
00094 
00097   vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
00098   vtkGetMacro(CoolDownRate, double);
00100 
00102 
00105   vtkSetMacro(ThreeDimensionalLayout, int);
00106   vtkGetMacro(ThreeDimensionalLayout, int);
00107   vtkBooleanMacro(ThreeDimensionalLayout, int);
00109 
00111 
00113   vtkSetMacro(RandomInitialPoints, int);
00114   vtkGetMacro(RandomInitialPoints, int);
00115   vtkBooleanMacro(RandomInitialPoints, int);
00117 
00119 
00121   vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
00122   vtkGetMacro(InitialTemperature, float);
00124 
00127   virtual void Initialize();
00128 
00133   virtual void Layout();
00134 
00137   virtual int IsLayoutComplete() {return this->LayoutComplete;}
00138 
00139 protected:
00140   vtkForceDirectedLayoutStrategy();
00141   ~vtkForceDirectedLayoutStrategy();
00142 
00143   double GraphBounds[6];
00144   int   AutomaticBoundsComputation;  //Boolean controls automatic bounds calc.
00145   int   MaxNumberOfIterations;  //Maximum number of iterations.
00146   double CoolDownRate;  //Cool-down rate.  Note:  Higher # = Slower rate.
00147   double InitialTemperature;
00148   int   ThreeDimensionalLayout;  //Boolean for a third dimension.
00149   int RandomInitialPoints; //Boolean for having random points
00150 private:
00151 
00152   //BTX
00153   // A vertex contains a position and a displacement.
00154   typedef struct
00155   {
00156     double x[3];
00157     double d[3];
00158   } vtkLayoutVertex;
00159 
00160   // An edge consists of two vertices joined together.
00161   // This struct acts as a "pointer" to those two vertices.
00162   typedef struct
00163   {
00164     int t;
00165     int u;
00166   } vtkLayoutEdge;
00167   //ETX
00168 
00169   int RandomSeed;
00170   int IterationsPerLayout;
00171   int TotalIterations;
00172   int LayoutComplete;
00173   double Temp;
00174   double optDist;
00175   vtkLayoutVertex *v;
00176   vtkLayoutEdge *e;
00177 
00178   vtkForceDirectedLayoutStrategy(const vtkForceDirectedLayoutStrategy&);  // Not implemented.
00179   void operator=(const vtkForceDirectedLayoutStrategy&);  // Not implemented.
00180 };
00181 
00182 #endif
00183