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-------------------------------------------------------------------------*/
93#ifndef vtkForceDirectedLayoutStrategy_h
94#define vtkForceDirectedLayoutStrategy_h
95
97#include "vtkInfovisLayoutModule.h" // For export macro
98
99class VTKINFOVISLAYOUT_EXPORT vtkForceDirectedLayoutStrategy : public vtkGraphLayoutStrategy
100{
101public:
103
105 void PrintSelf(ostream& os, vtkIndent indent) override;
106
108
113 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
114 vtkGetMacro(RandomSeed, int);
116
118
123 vtkSetVector6Macro(GraphBounds, double);
124 vtkGetVectorMacro(GraphBounds, double, 6);
126
128
133 vtkSetMacro(AutomaticBoundsComputation, vtkTypeBool);
134 vtkGetMacro(AutomaticBoundsComputation, vtkTypeBool);
135 vtkBooleanMacro(AutomaticBoundsComputation, vtkTypeBool);
137
139
145 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
146 vtkGetMacro(MaxNumberOfIterations, int);
148
150
156 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
157 vtkGetMacro(IterationsPerLayout, int);
159
161
166 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
167 vtkGetMacro(CoolDownRate, double);
169
171
176 vtkSetMacro(ThreeDimensionalLayout, vtkTypeBool);
177 vtkGetMacro(ThreeDimensionalLayout, vtkTypeBool);
178 vtkBooleanMacro(ThreeDimensionalLayout, vtkTypeBool);
180
182
185 vtkSetMacro(RandomInitialPoints, vtkTypeBool);
186 vtkGetMacro(RandomInitialPoints, vtkTypeBool);
187 vtkBooleanMacro(RandomInitialPoints, vtkTypeBool);
189
191
195 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
196 vtkGetMacro(InitialTemperature, float);
198
203 void Initialize() override;
204
212 void Layout() override;
213
218 int IsLayoutComplete() override { return this->LayoutComplete; }
219
220protected:
223
224 double GraphBounds[6];
225 vtkTypeBool AutomaticBoundsComputation; // Boolean controls automatic bounds calc.
226 int MaxNumberOfIterations; // Maximum number of iterations.
227 double CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
229 vtkTypeBool ThreeDimensionalLayout; // Boolean for a third dimension.
230 vtkTypeBool RandomInitialPoints; // Boolean for having random points
231private:
232 // A vertex contains a position and a displacement.
233 struct vtkLayoutVertex_t
234 {
235 double x[3];
236 double d[3];
237 };
238 using vtkLayoutVertex = struct vtkLayoutVertex_t;
239
240 // An edge consists of two vertices joined together.
241 // This struct acts as a "pointer" to those two vertices.
242 struct vtkLayoutEdge_t
243 {
244 int t;
245 int u;
246 };
247 using vtkLayoutEdge = struct vtkLayoutEdge_t;
248
249 int RandomSeed;
250 int IterationsPerLayout;
251 int TotalIterations;
252 int LayoutComplete;
253 double Temp;
254 double optDist;
255 vtkLayoutVertex* v;
256 vtkLayoutEdge* e;
257
259 void operator=(const vtkForceDirectedLayoutStrategy&) = delete;
260};
261
262#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:113
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