VTK
vtkClustering2DLayoutStrategy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkClustering2DLayoutStrategy.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
35 #ifndef vtkClustering2DLayoutStrategy_h
36 #define vtkClustering2DLayoutStrategy_h
37 
38 #include "vtkInfovisLayoutModule.h" // For export macro
39 #include "vtkGraphLayoutStrategy.h"
40 
41 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
42 
43 class vtkFastSplatter;
44 class vtkImageData;
45 class vtkIntArray;
46 class vtkFloatArray;
47 
49 {
50 public:
52 
54  void PrintSelf(ostream& os, vtkIndent indent);
55 
57 
60  vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
61  vtkGetMacro(RandomSeed, int);
63 
65 
70  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
71  vtkGetMacro(MaxNumberOfIterations, int);
73 
75 
79  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
80  vtkGetMacro(IterationsPerLayout, int);
82 
84 
87  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
88  vtkGetMacro(InitialTemperature, float);
90 
92 
96  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
97  vtkGetMacro(CoolDownRate, double);
99 
101 
103  vtkSetMacro(RestDistance, float);
104  vtkGetMacro(RestDistance, float);
106 
109  virtual void Initialize();
110 
115  virtual void Layout();
116 
119  virtual int IsLayoutComplete() {return this->LayoutComplete;}
120 
121 protected:
124 
125  int MaxNumberOfIterations; //Maximum number of iterations.
127  float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate.
128 
129 private:
130 
131  //BTX
132 
133  // An edge consists of two vertices joined together.
134  // This struct acts as a "pointer" to those two vertices.
135  typedef struct
136  {
137  vtkIdType from;
138  vtkIdType to;
139  float weight;
140  int dead_edge; // I'm making this an int so that the edge array is
141  // word boundary aligned... but I'm not sure what
142  // really happens in these days of magical compilers
143  } vtkLayoutEdge;
144 
145  // This class 'has a' vtkFastSplatter for the density grid
148  vtkSmartPointer<vtkFloatArray> RepulsionArray;
149  vtkSmartPointer<vtkFloatArray> AttractionArray;
150  vtkSmartPointer<vtkIntArray> EdgeCountArray;
151  //ETX
152 
153  vtkLayoutEdge *EdgeArray;
154 
155  int RandomSeed;
156  int IterationsPerLayout;
157  int TotalIterations;
158  int LayoutComplete;
159  float Temp;
160  float RestDistance;
161  float CuttingThreshold;
162 
163  // Private helper methods
164  void GenerateCircularSplat(vtkImageData *splat, int x, int y);
165  void GenerateGaussianSplat(vtkImageData *splat, int x, int y);
166  void ResolveCoincidentVertices();
167 
169  void operator=(const vtkClustering2DLayoutStrategy&); // Not implemented.
170 };
171 
172 #endif
173 
#define VTK_DOUBLE_MAX
Definition: vtkType.h:140
#define VTKINFOVISLAYOUT_EXPORT
#define VTK_INT_MAX
Definition: vtkType.h:130
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
int vtkIdType
Definition: vtkType.h:247
abstract superclass for all graph layout strategies
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:49
#define VTK_FLOAT_MAX
Definition: vtkType.h:138
A splatter optimized for splatting single kernels.
a simple class to control print indentation
Definition: vtkIndent.h:38
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
static vtkObject * New()
virtual void Layout()=0
void PrintSelf(ostream &os, vtkIndent indent)
a simple fast 2D graph layout