VTK
vtkForceDirectedLayoutStrategy.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkForceDirectedLayoutStrategy.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-------------------------------------------------------------------------*/
37#ifndef vtkForceDirectedLayoutStrategy_h
38#define vtkForceDirectedLayoutStrategy_h
39
40#include "vtkInfovisLayoutModule.h" // For export macro
42
43class VTKINFOVISLAYOUT_EXPORT vtkForceDirectedLayoutStrategy : public vtkGraphLayoutStrategy
44{
45public:
47
49 void PrintSelf(ostream& os, vtkIndent indent);
50
52
57 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
58 vtkGetMacro(RandomSeed, int);
60
62
67 vtkSetVector6Macro(GraphBounds,double);
68 vtkGetVectorMacro(GraphBounds,double,6);
70
72
77 vtkSetMacro(AutomaticBoundsComputation, int);
78 vtkGetMacro(AutomaticBoundsComputation, int);
79 vtkBooleanMacro(AutomaticBoundsComputation, int);
81
83
89 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
90 vtkGetMacro(MaxNumberOfIterations, int);
92
94
100 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
101 vtkGetMacro(IterationsPerLayout, int);
103
105
110 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
111 vtkGetMacro(CoolDownRate, double);
113
115
120 vtkSetMacro(ThreeDimensionalLayout, int);
121 vtkGetMacro(ThreeDimensionalLayout, int);
122 vtkBooleanMacro(ThreeDimensionalLayout, int);
124
126
129 vtkSetMacro(RandomInitialPoints, int);
130 vtkGetMacro(RandomInitialPoints, int);
131 vtkBooleanMacro(RandomInitialPoints, int);
133
135
139 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
140 vtkGetMacro(InitialTemperature, float);
142
147 virtual void Initialize();
148
156 virtual void Layout();
157
162 virtual int IsLayoutComplete() {return this->LayoutComplete;}
163
164protected:
167
168 double GraphBounds[6];
169 int AutomaticBoundsComputation; //Boolean controls automatic bounds calc.
170 int MaxNumberOfIterations; //Maximum number of iterations.
171 double CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate.
173 int ThreeDimensionalLayout; //Boolean for a third dimension.
174 int RandomInitialPoints; //Boolean for having random points
175private:
176
177 // A vertex contains a position and a displacement.
178 typedef struct
179 {
180 double x[3];
181 double d[3];
182 } vtkLayoutVertex;
183
184 // An edge consists of two vertices joined together.
185 // This struct acts as a "pointer" to those two vertices.
186 typedef struct
187 {
188 int t;
189 int u;
190 } vtkLayoutEdge;
191
192 int RandomSeed;
193 int IterationsPerLayout;
194 int TotalIterations;
195 int LayoutComplete;
196 double Temp;
197 double optDist;
198 vtkLayoutVertex *v;
199 vtkLayoutEdge *e;
200
202 void operator=(const vtkForceDirectedLayoutStrategy&) VTK_DELETE_FUNCTION;
203};
204
205#endif
206
a force directed graph layout algorithm
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.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual int IsLayoutComplete()
I'm an iterative layout so this method lets the caller know if I'm done laying out the graph.
static vtkForceDirectedLayoutStrategy * New()
abstract superclass for all graph layout strategies
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
#define VTK_DOUBLE_MAX
Definition: vtkType.h:163
#define VTK_INT_MAX
Definition: vtkType.h:153
#define VTK_FLOAT_MAX
Definition: vtkType.h:161