VTK
vtkCommunity2DLayoutStrategy.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkCommunity2DLayoutStrategy.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 vtkCommunity2DLayoutStrategy_h
36#define vtkCommunity2DLayoutStrategy_h
37
38#include "vtkInfovisLayoutModule.h" // For export macro
40
41#include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
42
43class vtkFastSplatter;
44class vtkImageData;
45class vtkFloatArray;
46
47class VTKINFOVISLAYOUT_EXPORT vtkCommunity2DLayoutStrategy : public vtkGraphLayoutStrategy
48{
49public:
51
53 void PrintSelf(ostream& os, vtkIndent indent);
54
56
61 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
62 vtkGetMacro(RandomSeed, int);
64
66
74 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
75 vtkGetMacro(MaxNumberOfIterations, int);
77
79
86 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
87 vtkGetMacro(IterationsPerLayout, int);
89
91
97 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
98 vtkGetMacro(InitialTemperature, float);
100
102
110 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
111 vtkGetMacro(CoolDownRate, double);
113
114
116
120 vtkSetMacro(RestDistance, float);
121 vtkGetMacro(RestDistance, float);
123
128 virtual void Initialize();
129
137 virtual void Layout();
138
143 virtual int IsLayoutComplete() {return this->LayoutComplete;}
144
146
149 vtkGetStringMacro(CommunityArrayName);
150 vtkSetStringMacro(CommunityArrayName);
152
154
160 vtkSetClampMacro(CommunityStrength, float, 0.1, 1.0);
161 vtkGetMacro(CommunityStrength, float);
163
164protected:
167
168 int MaxNumberOfIterations; //Maximum number of iterations.
170 float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate.
171
172private:
173
174 // An edge consists of two vertices joined together.
175 // This struct acts as a "pointer" to those two vertices.
176 typedef struct
177 {
178 vtkIdType from;
179 vtkIdType to;
180 float weight;
181 } vtkLayoutEdge;
182
183 // This class 'has a' vtkFastSplatter for the density grid
186 vtkSmartPointer<vtkFloatArray> RepulsionArray;
187 vtkSmartPointer<vtkFloatArray> AttractionArray;
188
189 vtkLayoutEdge *EdgeArray;
190
191 int RandomSeed;
192 int IterationsPerLayout;
193 int TotalIterations;
194 int LayoutComplete;
195 float Temp;
196 float RestDistance;
197 float CommunityStrength;
198
202 char* CommunityArrayName;
203
204 // Private helper methods
205 void GenerateCircularSplat(vtkImageData *splat, int x, int y);
206 void GenerateGaussianSplat(vtkImageData *splat, int x, int y);
207 void ResolveCoincidentVertices();
208
210 void operator=(const vtkCommunity2DLayoutStrategy&) VTK_DELETE_FUNCTION;
211};
212
213#endif
214
a simple fast 2D graph layout that looks for a community array on it's input and strengthens edges wi...
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
static vtkCommunity2DLayoutStrategy * New()
virtual int IsLayoutComplete()
I'm an iterative layout so this method lets the caller know if I'm done laying out the graph.
virtual void Initialize()
This strategy sets up some data structures for faster processing of each Layout() call.
virtual void Layout()
This is the layout method where the graph that was set in SetGraph() is laid out.
A splatter optimized for splatting single kernels.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
abstract superclass for all graph layout strategies
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
a simple class to control print indentation
Definition: vtkIndent.h:40
@ weight
Definition: vtkX3D.h:532
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
int vtkIdType
Definition: vtkType.h:287
#define VTK_DOUBLE_MAX
Definition: vtkType.h:163
#define VTK_INT_MAX
Definition: vtkType.h:153
#define VTK_FLOAT_MAX
Definition: vtkType.h:161