VTK  9.3.0
vtkForceDirectedLayoutStrategy.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3// SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
30#ifndef vtkForceDirectedLayoutStrategy_h
31#define vtkForceDirectedLayoutStrategy_h
32
34#include "vtkInfovisLayoutModule.h" // For export macro
35
36VTK_ABI_NAMESPACE_BEGIN
37class VTKINFOVISLAYOUT_EXPORT vtkForceDirectedLayoutStrategy : public vtkGraphLayoutStrategy
38{
39public:
41
43 void PrintSelf(ostream& os, vtkIndent indent) override;
44
46
51 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
52 vtkGetMacro(RandomSeed, int);
54
56
61 vtkSetVector6Macro(GraphBounds, double);
62 vtkGetVectorMacro(GraphBounds, double, 6);
64
66
71 vtkSetMacro(AutomaticBoundsComputation, vtkTypeBool);
72 vtkGetMacro(AutomaticBoundsComputation, vtkTypeBool);
73 vtkBooleanMacro(AutomaticBoundsComputation, vtkTypeBool);
75
77
83 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
84 vtkGetMacro(MaxNumberOfIterations, int);
86
88
94 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
95 vtkGetMacro(IterationsPerLayout, int);
97
99
104 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
105 vtkGetMacro(CoolDownRate, double);
107
109
114 vtkSetMacro(ThreeDimensionalLayout, vtkTypeBool);
115 vtkGetMacro(ThreeDimensionalLayout, vtkTypeBool);
116 vtkBooleanMacro(ThreeDimensionalLayout, vtkTypeBool);
118
120
123 vtkSetMacro(RandomInitialPoints, vtkTypeBool);
124 vtkGetMacro(RandomInitialPoints, vtkTypeBool);
125 vtkBooleanMacro(RandomInitialPoints, vtkTypeBool);
127
129
133 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
134 vtkGetMacro(InitialTemperature, float);
136
141 void Initialize() override;
142
150 void Layout() override;
151
156 int IsLayoutComplete() override { return this->LayoutComplete; }
157
158protected:
161
162 double GraphBounds[6];
163 vtkTypeBool AutomaticBoundsComputation; // Boolean controls automatic bounds calc.
164 int MaxNumberOfIterations; // Maximum number of iterations.
165 double CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
167 vtkTypeBool ThreeDimensionalLayout; // Boolean for a third dimension.
168 vtkTypeBool RandomInitialPoints; // Boolean for having random points
169private:
170 // A vertex contains a position and a displacement.
171 struct vtkLayoutVertex_t
172 {
173 double x[3];
174 double d[3];
175 };
176 using vtkLayoutVertex = struct vtkLayoutVertex_t;
177
178 // An edge consists of two vertices joined together.
179 // This struct acts as a "pointer" to those two vertices.
180 struct vtkLayoutEdge_t
181 {
182 int t;
183 int u;
184 };
185 using vtkLayoutEdge = struct vtkLayoutEdge_t;
186
187 int RandomSeed;
188 int IterationsPerLayout;
189 int TotalIterations;
190 int LayoutComplete;
191 double Temp;
192 double optDist;
193 vtkLayoutVertex* v;
194 vtkLayoutEdge* e;
195
197 void operator=(const vtkForceDirectedLayoutStrategy&) = delete;
198};
199
200VTK_ABI_NAMESPACE_END
201#endif
a force directed graph layout algorithm
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Layout() override
This is the layout method where the graph that was set in SetGraph() is laid out.
void Initialize() override
This strategy sets up some data structures for faster processing of each Layout() call.
~vtkForceDirectedLayoutStrategy() override
int IsLayoutComplete() override
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:38
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DOUBLE_MAX
Definition vtkType.h:154
#define VTK_INT_MAX
Definition vtkType.h:144
#define VTK_FLOAT_MAX
Definition vtkType.h:152