VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkAttributeClustering2DLayoutStrategy.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 -------------------------------------------------------------------------*/ 00035 #ifndef __vtkAttributeClustering2DLayoutStrategy_h 00036 #define __vtkAttributeClustering2DLayoutStrategy_h 00037 00038 #include "vtkGraphLayoutStrategy.h" 00039 00040 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars. 00041 00042 class vtkFastSplatter; 00043 class vtkImageData; 00044 class vtkIntArray; 00045 class vtkFloatArray; 00046 00047 class VTK_INFOVIS_EXPORT vtkAttributeClustering2DLayoutStrategy : public vtkGraphLayoutStrategy 00048 { 00049 public: 00050 static vtkAttributeClustering2DLayoutStrategy *New(); 00051 00052 vtkTypeMacro(vtkAttributeClustering2DLayoutStrategy, vtkGraphLayoutStrategy); 00053 void PrintSelf(ostream& os, vtkIndent indent); 00054 00056 00058 vtkGetStringMacro(VertexAttribute); 00059 void SetVertexAttribute(const char*); 00061 00063 00066 vtkSetClampMacro(RandomSeed, int, 0, VTK_LARGE_INTEGER); 00067 vtkGetMacro(RandomSeed, int); 00069 00071 00076 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_LARGE_INTEGER); 00077 vtkGetMacro(MaxNumberOfIterations, int); 00079 00081 00085 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_LARGE_INTEGER); 00086 vtkGetMacro(IterationsPerLayout, int); 00088 00090 00093 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX); 00094 vtkGetMacro(InitialTemperature, float); 00096 00098 00102 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX); 00103 vtkGetMacro(CoolDownRate, double); 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 00127 protected: 00128 vtkAttributeClustering2DLayoutStrategy(); 00129 ~vtkAttributeClustering2DLayoutStrategy(); 00130 00131 int MaxNumberOfIterations; //Maximum number of iterations. 00132 float InitialTemperature; 00133 float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate. 00134 00135 private: 00136 00137 //BTX 00138 // This class 'has a' vtkFastSplatter for the density grid 00139 vtkSmartPointer<vtkFastSplatter> DensityGrid; 00140 vtkSmartPointer<vtkImageData> SplatImage; 00141 vtkSmartPointer<vtkFloatArray> RepulsionArray; 00142 vtkSmartPointer<vtkFloatArray> AttractionArray; 00143 vtkSmartPointer<vtkIntArray> EdgeCountArray; 00144 //ETX 00145 00146 int RandomSeed; 00147 int IterationsPerLayout; 00148 int TotalIterations; 00149 int LayoutComplete; 00150 float Temp; 00151 float RestDistance; 00152 float CuttingThreshold; 00153 char* VertexAttribute; 00154 00155 // Private helper methods 00156 void GenerateCircularSplat(vtkImageData *splat, int x, int y); 00157 void GenerateGaussianSplat(vtkImageData *splat, int x, int y); 00158 void ResolveCoincidentVertices(); 00159 00160 //BTX 00161 class Internals; 00162 Internals* Implementation; 00163 //ETX 00164 00165 vtkAttributeClustering2DLayoutStrategy(const vtkAttributeClustering2DLayoutStrategy&); // Not implemented. 00166 void operator=(const vtkAttributeClustering2DLayoutStrategy&); // Not implemented. 00167 }; 00168 00169 #endif 00170