VTK
|
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 "vtkInfovisLayoutModule.h" // For export macro 00047 #include "vtkGraphLayoutStrategy.h" 00048 00049 class vtkFloatArray; 00050 00051 class VTKINFOVISLAYOUT_EXPORT vtkSimple2DLayoutStrategy : public vtkGraphLayoutStrategy 00052 { 00053 public: 00054 static vtkSimple2DLayoutStrategy *New(); 00055 00056 vtkTypeMacro(vtkSimple2DLayoutStrategy, vtkGraphLayoutStrategy); 00057 void PrintSelf(ostream& os, vtkIndent indent); 00058 00060 00063 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX); 00064 vtkGetMacro(RandomSeed, int); 00066 00068 00073 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX); 00074 vtkGetMacro(MaxNumberOfIterations, int); 00076 00078 00082 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX); 00083 vtkGetMacro(IterationsPerLayout, int); 00085 00087 00090 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX); 00091 vtkGetMacro(InitialTemperature, float); 00093 00095 00099 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX); 00100 vtkGetMacro(CoolDownRate, double); 00102 00104 00107 vtkSetMacro(Jitter, bool); 00108 vtkGetMacro(Jitter, bool); 00110 00112 00114 vtkSetMacro(RestDistance, float); 00115 vtkGetMacro(RestDistance, float); 00117 00120 virtual void Initialize(); 00121 00126 virtual void Layout(); 00127 00130 virtual int IsLayoutComplete() {return this->LayoutComplete;} 00131 00132 protected: 00133 vtkSimple2DLayoutStrategy(); 00134 ~vtkSimple2DLayoutStrategy(); 00135 00136 int MaxNumberOfIterations; //Maximum number of iterations. 00137 float InitialTemperature; 00138 float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate. 00139 00140 private: 00141 00142 //BTX 00143 // An edge consists of two vertices joined together. 00144 // This struct acts as a "pointer" to those two vertices. 00145 typedef struct 00146 { 00147 vtkIdType from; 00148 vtkIdType to; 00149 float weight; 00150 } vtkLayoutEdge; 00151 00152 // These are for storage of repulsion and attraction 00153 vtkFloatArray *RepulsionArray; 00154 vtkFloatArray *AttractionArray; 00155 vtkLayoutEdge *EdgeArray; 00156 //ETX 00157 00158 int RandomSeed; 00159 int IterationsPerLayout; 00160 int TotalIterations; 00161 int LayoutComplete; 00162 float Temp; 00163 float RestDistance; 00164 bool Jitter; 00165 00166 vtkSimple2DLayoutStrategy(const vtkSimple2DLayoutStrategy&); // Not implemented. 00167 void operator=(const vtkSimple2DLayoutStrategy&); // Not implemented. 00168 }; 00169 00170 #endif 00171