VTK  9.2.6
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-------------------------------------------------------------------------*/
34#ifndef vtkForceDirectedLayoutStrategy_h
35#define vtkForceDirectedLayoutStrategy_h
36
38#include "vtkInfovisLayoutModule.h" // For export macro
39
40class VTKINFOVISLAYOUT_EXPORT vtkForceDirectedLayoutStrategy : public vtkGraphLayoutStrategy
41{
42public:
44
46 void PrintSelf(ostream& os, vtkIndent indent) override;
47
49
54 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
55 vtkGetMacro(RandomSeed, int);
57
59
64 vtkSetVector6Macro(GraphBounds, double);
65 vtkGetVectorMacro(GraphBounds, double, 6);
67
69
74 vtkSetMacro(AutomaticBoundsComputation, vtkTypeBool);
75 vtkGetMacro(AutomaticBoundsComputation, vtkTypeBool);
76 vtkBooleanMacro(AutomaticBoundsComputation, vtkTypeBool);
78
80
86 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
87 vtkGetMacro(MaxNumberOfIterations, int);
89
91
97 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
98 vtkGetMacro(IterationsPerLayout, int);
100
102
107 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
108 vtkGetMacro(CoolDownRate, double);
110
112
117 vtkSetMacro(ThreeDimensionalLayout, vtkTypeBool);
118 vtkGetMacro(ThreeDimensionalLayout, vtkTypeBool);
119 vtkBooleanMacro(ThreeDimensionalLayout, vtkTypeBool);
121
123
126 vtkSetMacro(RandomInitialPoints, vtkTypeBool);
127 vtkGetMacro(RandomInitialPoints, vtkTypeBool);
128 vtkBooleanMacro(RandomInitialPoints, vtkTypeBool);
130
132
136 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
137 vtkGetMacro(InitialTemperature, float);
139
144 void Initialize() override;
145
153 void Layout() override;
154
159 int IsLayoutComplete() override { return this->LayoutComplete; }
160
161protected:
164
165 double GraphBounds[6];
166 vtkTypeBool AutomaticBoundsComputation; // Boolean controls automatic bounds calc.
167 int MaxNumberOfIterations; // Maximum number of iterations.
168 double CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
170 vtkTypeBool ThreeDimensionalLayout; // Boolean for a third dimension.
171 vtkTypeBool RandomInitialPoints; // Boolean for having random points
172private:
173 // A vertex contains a position and a displacement.
174 struct vtkLayoutVertex_t
175 {
176 double x[3];
177 double d[3];
178 };
179 using vtkLayoutVertex = struct vtkLayoutVertex_t;
180
181 // An edge consists of two vertices joined together.
182 // This struct acts as a "pointer" to those two vertices.
183 struct vtkLayoutEdge_t
184 {
185 int t;
186 int u;
187 };
188 using vtkLayoutEdge = struct vtkLayoutEdge_t;
189
190 int RandomSeed;
191 int IterationsPerLayout;
192 int TotalIterations;
193 int LayoutComplete;
194 double Temp;
195 double optDist;
196 vtkLayoutVertex* v;
197 vtkLayoutEdge* e;
198
200 void operator=(const vtkForceDirectedLayoutStrategy&) = delete;
201};
202
203#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:34
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_DOUBLE_MAX
Definition vtkType.h:165
#define VTK_INT_MAX
Definition vtkType.h:155
#define VTK_FLOAT_MAX
Definition vtkType.h:163