VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkConstrained2DLayoutStrategy.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 -------------------------------------------------------------------------*/ 00041 #ifndef vtkConstrained2DLayoutStrategy_h 00042 #define vtkConstrained2DLayoutStrategy_h 00043 00044 #include "vtkInfovisLayoutModule.h" // For export macro 00045 #include "vtkGraphLayoutStrategy.h" 00046 00047 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars. 00048 00049 class vtkFastSplatter; 00050 class vtkImageData; 00051 class vtkFloatArray; 00052 00053 class VTKINFOVISLAYOUT_EXPORT vtkConstrained2DLayoutStrategy : public vtkGraphLayoutStrategy 00054 { 00055 public: 00056 static vtkConstrained2DLayoutStrategy *New(); 00057 00058 vtkTypeMacro(vtkConstrained2DLayoutStrategy, vtkGraphLayoutStrategy); 00059 void PrintSelf(ostream& os, vtkIndent indent); 00060 00062 00065 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX); 00066 vtkGetMacro(RandomSeed, int); 00068 00070 00075 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX); 00076 vtkGetMacro(MaxNumberOfIterations, int); 00078 00080 00084 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX); 00085 vtkGetMacro(IterationsPerLayout, int); 00087 00089 00092 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX); 00093 vtkGetMacro(InitialTemperature, float); 00095 00097 00101 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX); 00102 vtkGetMacro(CoolDownRate, double); 00104 00105 00107 00109 vtkSetMacro(RestDistance, float); 00110 vtkGetMacro(RestDistance, float); 00112 00115 virtual void Initialize(); 00116 00121 virtual void Layout(); 00122 00125 virtual int IsLayoutComplete() {return this->LayoutComplete;} 00126 00128 00130 vtkSetStringMacro(InputArrayName); 00131 vtkGetStringMacro(InputArrayName); 00133 00134 protected: 00135 vtkConstrained2DLayoutStrategy(); 00136 ~vtkConstrained2DLayoutStrategy(); 00137 00138 int MaxNumberOfIterations; //Maximum number of iterations. 00139 float InitialTemperature; 00140 float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate. 00141 00142 private: 00143 00144 //BTX 00145 00146 // An edge consists of two vertices joined together. 00147 // This struct acts as a "pointer" to those two vertices. 00148 typedef struct 00149 { 00150 vtkIdType from; 00151 vtkIdType to; 00152 float weight; 00153 } vtkLayoutEdge; 00154 00155 // This class 'has a' vtkFastSplatter for the density grid 00156 vtkSmartPointer<vtkFastSplatter> DensityGrid; 00157 vtkSmartPointer<vtkImageData> SplatImage; 00158 vtkSmartPointer<vtkFloatArray> RepulsionArray; 00159 vtkSmartPointer<vtkFloatArray> AttractionArray; 00160 //ETX 00161 00162 vtkLayoutEdge *EdgeArray; 00163 00164 int RandomSeed; 00165 int IterationsPerLayout; 00166 int TotalIterations; 00167 int LayoutComplete; 00168 float Temp; 00169 float RestDistance; 00170 00171 char* InputArrayName; 00172 00173 // Private helper methods 00174 void GenerateCircularSplat(vtkImageData *splat, int x, int y); 00175 void GenerateGaussianSplat(vtkImageData *splat, int x, int y); 00176 void ResolveCoincidentVertices(); 00177 00178 vtkConstrained2DLayoutStrategy(const vtkConstrained2DLayoutStrategy&); // Not implemented. 00179 void operator=(const vtkConstrained2DLayoutStrategy&); // Not implemented. 00180 }; 00181 00182 #endif 00183