VTK  9.0.3
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 
37 #include "vtkGraphLayoutStrategy.h"
38 #include "vtkInfovisLayoutModule.h" // For export macro
39 
40 class VTKINFOVISLAYOUT_EXPORT vtkForceDirectedLayoutStrategy : public vtkGraphLayoutStrategy
41 {
42 public:
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 
161 protected:
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
172 private:
173  // A vertex contains a position and a displacement.
174  typedef struct
175  {
176  double x[3];
177  double d[3];
178  } vtkLayoutVertex;
179 
180  // An edge consists of two vertices joined together.
181  // This struct acts as a "pointer" to those two vertices.
182  typedef struct
183  {
184  int t;
185  int u;
186  } vtkLayoutEdge;
187 
188  int RandomSeed;
189  int IterationsPerLayout;
190  int TotalIterations;
191  int LayoutComplete;
192  double Temp;
193  double optDist;
194  vtkLayoutVertex* v;
195  vtkLayoutEdge* e;
196 
198  void operator=(const vtkForceDirectedLayoutStrategy&) = delete;
199 };
200 
201 #endif
a force directed graph layout algorithm
static vtkForceDirectedLayoutStrategy * New()
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.
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