VTK
vtkFast2DLayoutStrategy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkFast2DLayoutStrategy.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 -------------------------------------------------------------------------*/
41 #ifndef vtkFast2DLayoutStrategy_h
42 #define vtkFast2DLayoutStrategy_h
43 
44 #include "vtkInfovisLayoutModule.h" // For export macro
45 #include "vtkGraphLayoutStrategy.h"
46 
47 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
48 
49 class vtkFastSplatter;
50 class vtkFloatArray;
51 class vtkGraphToPolyData;
52 class vtkImageData;
53 
55 {
56 public:
57  static vtkFast2DLayoutStrategy *New();
58 
60  void PrintSelf(ostream& os, vtkIndent indent);
61 
63 
66  vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
67  vtkGetMacro(RandomSeed, int);
69 
71 
76  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
77  vtkGetMacro(MaxNumberOfIterations, int);
79 
81 
85  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
86  vtkGetMacro(IterationsPerLayout, int);
88 
90 
93  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
94  vtkGetMacro(InitialTemperature, float);
96 
98 
102  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
103  vtkGetMacro(CoolDownRate, double);
105 
107 
109  vtkSetMacro(RestDistance, float);
110  vtkGetMacro(RestDistance, float);
112 
115  virtual void Initialize();
116 
121  virtual void Layout();
122 
125  virtual int IsLayoutComplete() {return this->LayoutComplete;}
126 
127 protected:
130 
131  int MaxNumberOfIterations; //Maximum number of iterations.
133  float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate.
134 
135 private:
136 
137  //BTX
138 
139  // An edge consists of two vertices joined together.
140  // This struct acts as a "pointer" to those two vertices.
141  typedef struct
142  {
143  vtkIdType from;
144  vtkIdType to;
145  float weight;
146  } vtkLayoutEdge;
147 
148  // This class 'has a' vtkFastSplatter for the density grid
152  vtkSmartPointer<vtkFloatArray> RepulsionArray;
153  vtkSmartPointer<vtkFloatArray> AttractionArray;
154  //ETX
155 
156  vtkLayoutEdge *EdgeArray;
157 
158  int RandomSeed;
159  int IterationsPerLayout;
160  int TotalIterations;
161  int LayoutComplete;
162  float Temp;
163  float RestDistance;
164 
165  // Private helper methods
166  void GenerateCircularSplat(vtkImageData *splat, int x, int y);
167  void GenerateGaussianSplat(vtkImageData *splat, int x, int y);
168  void ResolveCoincidentVertices();
169 
170  vtkFast2DLayoutStrategy(const vtkFast2DLayoutStrategy&); // Not implemented.
171  void operator=(const vtkFast2DLayoutStrategy&); // Not implemented.
172 };
173 
174 #endif
175 
#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
convert a vtkGraph to vtkPolyData
#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
a simple fast 2D graph layout
static vtkObject * New()
virtual void Layout()=0
void PrintSelf(ostream &os, vtkIndent indent)