VTK  9.5.2
vtkSimple2DLayoutStrategy.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3// SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
60
61#ifndef vtkSimple2DLayoutStrategy_h
62#define vtkSimple2DLayoutStrategy_h
63
65#include "vtkInfovisLayoutModule.h" // For export macro
66
67VTK_ABI_NAMESPACE_BEGIN
68class vtkFloatArray;
69
70class VTKINFOVISLAYOUT_EXPORT vtkSimple2DLayoutStrategy : public vtkGraphLayoutStrategy
71{
72public:
74
76 void PrintSelf(ostream& os, vtkIndent indent) override;
77
79
84 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
85 vtkGetMacro(RandomSeed, int);
87
89
97 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
98 vtkGetMacro(MaxNumberOfIterations, int);
100
102
109 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
110 vtkGetMacro(IterationsPerLayout, int);
112
114
120 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
121 vtkGetMacro(InitialTemperature, float);
123
125
133 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
134 vtkGetMacro(CoolDownRate, double);
136
138
145 vtkSetMacro(Jitter, bool);
146 vtkGetMacro(Jitter, bool);
148
150
154 vtkSetMacro(RestDistance, float);
155 vtkGetMacro(RestDistance, float);
157
162 void Initialize() override;
163
171 void Layout() override;
172
177 int IsLayoutComplete() override { return this->LayoutComplete; }
178
179protected:
182
183 int MaxNumberOfIterations; // Maximum number of iterations.
185 float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
186
187private:
188 // An edge consists of two vertices joined together.
189 // This struct acts as a "pointer" to those two vertices.
190 struct vtkLayoutEdge_t
191 {
192 vtkIdType from;
193 vtkIdType to;
194 float weight;
195 };
196 using vtkLayoutEdge = struct vtkLayoutEdge_t;
197
198 // These are for storage of repulsion and attraction
199 vtkFloatArray* RepulsionArray;
200 vtkFloatArray* AttractionArray;
201 vtkLayoutEdge* EdgeArray;
202
203 int RandomSeed;
204 int IterationsPerLayout;
205 int TotalIterations;
206 int LayoutComplete;
207 float Temp;
208 float RestDistance;
209 bool Jitter;
210
212 void operator=(const vtkSimple2DLayoutStrategy&) = delete;
213};
214
215VTK_ABI_NAMESPACE_END
216#endif
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition vtkIndent.h:108
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkSimple2DLayoutStrategy * New()
void Initialize() override
This strategy sets up some data structures for faster processing of each Layout() call.
~vtkSimple2DLayoutStrategy() override
void Layout() override
This is the layout method where the graph that was set in SetGraph() is laid out.
int IsLayoutComplete() override
I'm an iterative layout so this method lets the caller know if I'm done laying out the graph.
int vtkIdType
Definition vtkType.h:332
#define VTK_DOUBLE_MAX
Definition vtkType.h:171
#define VTK_INT_MAX
Definition vtkType.h:161
#define VTK_FLOAT_MAX
Definition vtkType.h:169