VTK
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:
163  ~vtkForceDirectedLayoutStrategy() override;
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
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:161
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkGraphLayoutStrategy
abstract superclass for all graph layout strategies
Definition: vtkGraphLayoutStrategy.h:45
vtkForceDirectedLayoutStrategy
a force directed graph layout algorithm
Definition: vtkForceDirectedLayoutStrategy.h:40
vtkForceDirectedLayoutStrategy::IsLayoutComplete
int IsLayoutComplete() override
I'm an iterative layout so this method lets the caller know if I'm done laying out the graph.
Definition: vtkForceDirectedLayoutStrategy.h:159
vtkGraphLayoutStrategy::Layout
virtual void Layout()=0
This is the layout method where the graph that was set in SetGraph() is laid out.
vtkForceDirectedLayoutStrategy::RandomInitialPoints
vtkTypeBool RandomInitialPoints
Definition: vtkForceDirectedLayoutStrategy.h:171
vtkForceDirectedLayoutStrategy::CoolDownRate
double CoolDownRate
Definition: vtkForceDirectedLayoutStrategy.h:168
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkGraphLayoutStrategy::Initialize
virtual void Initialize()
This method allows the layout strategy to do initialization of data structures or whatever else it mi...
Definition: vtkGraphLayoutStrategy.h:61
vtkForceDirectedLayoutStrategy::ThreeDimensionalLayout
vtkTypeBool ThreeDimensionalLayout
Definition: vtkForceDirectedLayoutStrategy.h:170
vtkGraphLayoutStrategy::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkForceDirectedLayoutStrategy::AutomaticBoundsComputation
vtkTypeBool AutomaticBoundsComputation
Definition: vtkForceDirectedLayoutStrategy.h:166
VTK_FLOAT_MAX
#define VTK_FLOAT_MAX
Definition: vtkType.h:169
vtkGraphLayoutStrategy.h
vtkForceDirectedLayoutStrategy::InitialTemperature
double InitialTemperature
Definition: vtkForceDirectedLayoutStrategy.h:169
vtkForceDirectedLayoutStrategy::MaxNumberOfIterations
int MaxNumberOfIterations
Definition: vtkForceDirectedLayoutStrategy.h:167
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:171
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69