VTK
dox/Infovis/vtkSimple2DLayoutStrategy.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkSimple2DLayoutStrategy.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 -------------------------------------------------------------------------*/
00043 #ifndef __vtkSimple2DLayoutStrategy_h
00044 #define __vtkSimple2DLayoutStrategy_h
00045 
00046 #include "vtkGraphLayoutStrategy.h"
00047 
00048 class vtkFloatArray;
00049 
00050 class VTK_INFOVIS_EXPORT vtkSimple2DLayoutStrategy : public vtkGraphLayoutStrategy 
00051 {
00052 public:
00053   static vtkSimple2DLayoutStrategy *New();
00054 
00055   vtkTypeMacro(vtkSimple2DLayoutStrategy, vtkGraphLayoutStrategy);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00057 
00059 
00062   vtkSetClampMacro(RandomSeed, int, 0, VTK_LARGE_INTEGER);
00063   vtkGetMacro(RandomSeed, int);
00065 
00067 
00072   vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_LARGE_INTEGER);
00073   vtkGetMacro(MaxNumberOfIterations, int);
00075   
00077 
00081   vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_LARGE_INTEGER);
00082   vtkGetMacro(IterationsPerLayout, int);
00084 
00086 
00089   vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
00090   vtkGetMacro(InitialTemperature, float);
00092   
00094 
00098   vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
00099   vtkGetMacro(CoolDownRate, double);
00101   
00103 
00106   vtkSetMacro(Jitter, bool);
00107   vtkGetMacro(Jitter, bool);
00109   
00111 
00113   vtkSetMacro(RestDistance, float);
00114   vtkGetMacro(RestDistance, float);
00116 
00119   virtual void Initialize();
00120   
00125   virtual void Layout();
00126   
00129   virtual int IsLayoutComplete() {return this->LayoutComplete;}
00130 
00131 protected:
00132   vtkSimple2DLayoutStrategy();
00133   ~vtkSimple2DLayoutStrategy();
00134 
00135   int    MaxNumberOfIterations;  //Maximum number of iterations.
00136   float  InitialTemperature;
00137   float  CoolDownRate;  //Cool-down rate.  Note:  Higher # = Slower rate.
00138 
00139 private:
00140 
00141   //BTX
00142   // An edge consists of two vertices joined together.
00143   // This struct acts as a "pointer" to those two vertices.
00144   typedef struct 
00145   {
00146     vtkIdType from;
00147     vtkIdType to;
00148     float weight;
00149   } vtkLayoutEdge;
00150   
00151   // These are for storage of repulsion and attraction
00152   vtkFloatArray *RepulsionArray;
00153   vtkFloatArray *AttractionArray;
00154   vtkLayoutEdge *EdgeArray;
00155   //ETX
00156   
00157   int RandomSeed;
00158   int IterationsPerLayout;
00159   int TotalIterations;
00160   int LayoutComplete;
00161   float Temp;
00162   float RestDistance;
00163   bool Jitter;
00164 
00165   vtkSimple2DLayoutStrategy(const vtkSimple2DLayoutStrategy&);  // Not implemented.
00166   void operator=(const vtkSimple2DLayoutStrategy&);  // Not implemented.
00167 };
00168 
00169 #endif
00170