VTK  9.1.0
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-------------------------------------------------------------------------*/
43#ifndef vtkForceDirectedLayoutStrategy_h
44#define vtkForceDirectedLayoutStrategy_h
45
47#include "vtkInfovisLayoutModule.h" // For export macro
48
49class VTKINFOVISLAYOUT_EXPORT vtkForceDirectedLayoutStrategy : public vtkGraphLayoutStrategy
50{
51public:
53
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56
58
63 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
64 vtkGetMacro(RandomSeed, int);
66
68
73 vtkSetVector6Macro(GraphBounds, double);
74 vtkGetVectorMacro(GraphBounds, double, 6);
76
78
83 vtkSetMacro(AutomaticBoundsComputation, vtkTypeBool);
84 vtkGetMacro(AutomaticBoundsComputation, vtkTypeBool);
85 vtkBooleanMacro(AutomaticBoundsComputation, vtkTypeBool);
87
89
95 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
96 vtkGetMacro(MaxNumberOfIterations, int);
98
100
106 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
107 vtkGetMacro(IterationsPerLayout, int);
109
111
116 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
117 vtkGetMacro(CoolDownRate, double);
119
121
126 vtkSetMacro(ThreeDimensionalLayout, vtkTypeBool);
127 vtkGetMacro(ThreeDimensionalLayout, vtkTypeBool);
128 vtkBooleanMacro(ThreeDimensionalLayout, vtkTypeBool);
130
132
135 vtkSetMacro(RandomInitialPoints, vtkTypeBool);
136 vtkGetMacro(RandomInitialPoints, vtkTypeBool);
137 vtkBooleanMacro(RandomInitialPoints, vtkTypeBool);
139
141
145 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
146 vtkGetMacro(InitialTemperature, float);
148
153 void Initialize() override;
154
162 void Layout() override;
163
168 int IsLayoutComplete() override { return this->LayoutComplete; }
169
170protected:
173
174 double GraphBounds[6];
175 vtkTypeBool AutomaticBoundsComputation; // Boolean controls automatic bounds calc.
176 int MaxNumberOfIterations; // Maximum number of iterations.
177 double CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
179 vtkTypeBool ThreeDimensionalLayout; // Boolean for a third dimension.
180 vtkTypeBool RandomInitialPoints; // Boolean for having random points
181private:
182 // A vertex contains a position and a displacement.
183 struct vtkLayoutVertex_t
184 {
185 double x[3];
186 double d[3];
187 };
188 using vtkLayoutVertex = struct vtkLayoutVertex_t;
189
190 // An edge consists of two vertices joined together.
191 // This struct acts as a "pointer" to those two vertices.
192 struct vtkLayoutEdge_t
193 {
194 int t;
195 int u;
196 };
197 using vtkLayoutEdge = struct vtkLayoutEdge_t;
198
199 int RandomSeed;
200 int IterationsPerLayout;
201 int TotalIterations;
202 int LayoutComplete;
203 double Temp;
204 double optDist;
205 vtkLayoutVertex* v;
206 vtkLayoutEdge* e;
207
209 void operator=(const vtkForceDirectedLayoutStrategy&) = delete;
210};
211
212#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:43
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