VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkFast2DLayoutStrategy.h,v $ 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 -------------------------------------------------------------------------*/ 00038 #ifndef __vtkFast2DLayoutStrategy_h 00039 #define __vtkFast2DLayoutStrategy_h 00040 00041 #include "vtkGraphLayoutStrategy.h" 00042 00043 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars. 00044 00045 class vtkFastSplatter; 00046 class vtkFloatArray; 00047 class vtkGraphToPolyData; 00048 class vtkImageData; 00049 00050 class VTK_INFOVIS_EXPORT vtkFast2DLayoutStrategy : public vtkGraphLayoutStrategy 00051 { 00052 public: 00053 static vtkFast2DLayoutStrategy *New(); 00054 00055 vtkTypeRevisionMacro(vtkFast2DLayoutStrategy, 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 00105 vtkSetMacro(RestDistance, float); 00106 vtkGetMacro(RestDistance, float); 00108 00111 virtual void Initialize(); 00112 00117 virtual void Layout(); 00118 00121 virtual int IsLayoutComplete() {return this->LayoutComplete;} 00122 00123 protected: 00124 vtkFast2DLayoutStrategy(); 00125 ~vtkFast2DLayoutStrategy(); 00126 00127 int MaxNumberOfIterations; //Maximum number of iterations. 00128 float InitialTemperature; 00129 float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate. 00130 00131 private: 00132 00133 //BTX 00134 00135 // An edge consists of two vertices joined together. 00136 // This struct acts as a "pointer" to those two vertices. 00137 typedef struct 00138 { 00139 vtkIdType from; 00140 vtkIdType to; 00141 float weight; 00142 } vtkLayoutEdge; 00143 00144 // This class 'has a' vtkFastSplatter for the density grid 00145 vtkSmartPointer<vtkGraphToPolyData> GraphToPoly; 00146 vtkSmartPointer<vtkFastSplatter> DensityGrid; 00147 vtkSmartPointer<vtkImageData> SplatImage; 00148 vtkSmartPointer<vtkFloatArray> RepulsionArray; 00149 vtkSmartPointer<vtkFloatArray> AttractionArray; 00150 //ETX 00151 00152 vtkLayoutEdge *EdgeArray; 00153 00154 int RandomSeed; 00155 int IterationsPerLayout; 00156 int TotalIterations; 00157 int LayoutComplete; 00158 float Temp; 00159 float RestDistance; 00160 00161 // Private helper methods 00162 void GenerateCircularSplat(vtkImageData *splat, int x, int y); 00163 void GenerateGaussianSplat(vtkImageData *splat, int x, int y); 00164 void ResolveCoincidentVertices(); 00165 00166 vtkFast2DLayoutStrategy(const vtkFast2DLayoutStrategy&); // Not implemented. 00167 void operator=(const vtkFast2DLayoutStrategy&); // Not implemented. 00168 }; 00169 00170 #endif 00171