VTK
|
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 "vtkGraphLayoutStrategy.h" 00040 00041 class VTK_INFOVIS_EXPORT vtkForceDirectedLayoutStrategy : public vtkGraphLayoutStrategy 00042 { 00043 public: 00044 static vtkForceDirectedLayoutStrategy *New(); 00045 00046 vtkTypeMacro(vtkForceDirectedLayoutStrategy, vtkGraphLayoutStrategy); 00047 void PrintSelf(ostream& os, vtkIndent indent); 00048 00050 00053 vtkSetClampMacro(RandomSeed, int, 0, VTK_LARGE_INTEGER); 00054 vtkGetMacro(RandomSeed, int); 00056 00058 00061 vtkSetVector6Macro(GraphBounds,double); 00062 vtkGetVectorMacro(GraphBounds,double,6); 00064 00066 00069 vtkSetMacro(AutomaticBoundsComputation, int); 00070 vtkGetMacro(AutomaticBoundsComputation, int); 00071 vtkBooleanMacro(AutomaticBoundsComputation, int); 00073 00075 00079 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_LARGE_INTEGER); 00080 vtkGetMacro(MaxNumberOfIterations, int); 00082 00084 00088 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_LARGE_INTEGER); 00089 vtkGetMacro(IterationsPerLayout, int); 00091 00093 00096 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX); 00097 vtkGetMacro(CoolDownRate, double); 00099 00101 00104 vtkSetMacro(ThreeDimensionalLayout, int); 00105 vtkGetMacro(ThreeDimensionalLayout, int); 00106 vtkBooleanMacro(ThreeDimensionalLayout, int); 00108 00110 00112 vtkSetMacro(RandomInitialPoints, int); 00113 vtkGetMacro(RandomInitialPoints, int); 00114 vtkBooleanMacro(RandomInitialPoints, int); 00116 00118 00120 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX); 00121 vtkGetMacro(InitialTemperature, float); 00123 00126 virtual void Initialize(); 00127 00132 virtual void Layout(); 00133 00136 virtual int IsLayoutComplete() {return this->LayoutComplete;} 00137 00138 protected: 00139 vtkForceDirectedLayoutStrategy(); 00140 ~vtkForceDirectedLayoutStrategy(); 00141 00142 double GraphBounds[6]; 00143 int AutomaticBoundsComputation; //Boolean controls automatic bounds calc. 00144 int MaxNumberOfIterations; //Maximum number of iterations. 00145 double CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate. 00146 double InitialTemperature; 00147 int ThreeDimensionalLayout; //Boolean for a third dimension. 00148 int RandomInitialPoints; //Boolean for having random points 00149 private: 00150 00151 //BTX 00152 // A vertex contains a position and a displacement. 00153 typedef struct 00154 { 00155 double x[3]; 00156 double d[3]; 00157 } vtkLayoutVertex; 00158 00159 // An edge consists of two vertices joined together. 00160 // This struct acts as a "pointer" to those two vertices. 00161 typedef struct 00162 { 00163 int t; 00164 int u; 00165 } vtkLayoutEdge; 00166 //ETX 00167 00168 int RandomSeed; 00169 int IterationsPerLayout; 00170 int TotalIterations; 00171 int LayoutComplete; 00172 double Temp; 00173 double optDist; 00174 vtkLayoutVertex *v; 00175 vtkLayoutEdge *e; 00176 00177 vtkForceDirectedLayoutStrategy(const vtkForceDirectedLayoutStrategy&); // Not implemented. 00178 void operator=(const vtkForceDirectedLayoutStrategy&); // Not implemented. 00179 }; 00180 00181 #endif 00182