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 "vtkInfovisLayoutModule.h" // For export macro 00039 #include "vtkGraphLayoutStrategy.h" 00040 00041 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars. 00042 00043 class vtkFastSplatter; 00044 class vtkImageData; 00045 class vtkIntArray; 00046 class vtkFloatArray; 00047 00048 class VTKINFOVISLAYOUT_EXPORT vtkAttributeClustering2DLayoutStrategy : public vtkGraphLayoutStrategy 00049 { 00050 public: 00051 static vtkAttributeClustering2DLayoutStrategy *New(); 00052 00053 vtkTypeMacro(vtkAttributeClustering2DLayoutStrategy, vtkGraphLayoutStrategy); 00054 void PrintSelf(ostream& os, vtkIndent indent); 00055 00057 00059 vtkGetStringMacro(VertexAttribute); 00060 void SetVertexAttribute(const char*); 00062 00064 00067 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX); 00068 vtkGetMacro(RandomSeed, int); 00070 00072 00077 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX); 00078 vtkGetMacro(MaxNumberOfIterations, int); 00080 00082 00086 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX); 00087 vtkGetMacro(IterationsPerLayout, int); 00089 00091 00094 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX); 00095 vtkGetMacro(InitialTemperature, float); 00097 00099 00103 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX); 00104 vtkGetMacro(CoolDownRate, double); 00106 00108 00110 vtkSetMacro(RestDistance, float); 00111 vtkGetMacro(RestDistance, float); 00113 00116 virtual void Initialize(); 00117 00122 virtual void Layout(); 00123 00126 virtual int IsLayoutComplete() {return this->LayoutComplete;} 00127 00128 protected: 00129 vtkAttributeClustering2DLayoutStrategy(); 00130 ~vtkAttributeClustering2DLayoutStrategy(); 00131 00132 int MaxNumberOfIterations; //Maximum number of iterations. 00133 float InitialTemperature; 00134 float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate. 00135 00136 private: 00137 00138 //BTX 00139 // This class 'has a' vtkFastSplatter for the density grid 00140 vtkSmartPointer<vtkFastSplatter> DensityGrid; 00141 vtkSmartPointer<vtkImageData> SplatImage; 00142 vtkSmartPointer<vtkFloatArray> RepulsionArray; 00143 vtkSmartPointer<vtkFloatArray> AttractionArray; 00144 vtkSmartPointer<vtkIntArray> EdgeCountArray; 00145 //ETX 00146 00147 int RandomSeed; 00148 int IterationsPerLayout; 00149 int TotalIterations; 00150 int LayoutComplete; 00151 float Temp; 00152 float RestDistance; 00153 float CuttingThreshold; 00154 char* VertexAttribute; 00155 00156 // Private helper methods 00157 void GenerateCircularSplat(vtkImageData *splat, int x, int y); 00158 void GenerateGaussianSplat(vtkImageData *splat, int x, int y); 00159 void ResolveCoincidentVertices(); 00160 00161 //BTX 00162 class Internals; 00163 Internals* Implementation; 00164 //ETX 00165 00166 vtkAttributeClustering2DLayoutStrategy(const vtkAttributeClustering2DLayoutStrategy&); // Not implemented. 00167 void operator=(const vtkAttributeClustering2DLayoutStrategy&); // Not implemented. 00168 }; 00169 00170 #endif 00171