VTK  9.3.0
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
31#ifndef vtkSimple2DLayoutStrategy_h
32#define vtkSimple2DLayoutStrategy_h
33
35#include "vtkInfovisLayoutModule.h" // For export macro
36
37VTK_ABI_NAMESPACE_BEGIN
38class vtkFloatArray;
39
40class VTKINFOVISLAYOUT_EXPORT vtkSimple2DLayoutStrategy : public vtkGraphLayoutStrategy
41{
42public:
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
67 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
68 vtkGetMacro(MaxNumberOfIterations, int);
70
72
79 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
80 vtkGetMacro(IterationsPerLayout, int);
82
84
90 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
91 vtkGetMacro(InitialTemperature, float);
93
95
103 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
104 vtkGetMacro(CoolDownRate, double);
106
108
115 vtkSetMacro(Jitter, bool);
116 vtkGetMacro(Jitter, bool);
118
120
124 vtkSetMacro(RestDistance, float);
125 vtkGetMacro(RestDistance, float);
127
132 void Initialize() override;
133
141 void Layout() override;
142
147 int IsLayoutComplete() override { return this->LayoutComplete; }
148
149protected:
152
153 int MaxNumberOfIterations; // Maximum number of iterations.
155 float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
156
157private:
158 // An edge consists of two vertices joined together.
159 // This struct acts as a "pointer" to those two vertices.
160 struct vtkLayoutEdge_t
161 {
162 vtkIdType from;
163 vtkIdType to;
164 float weight;
165 };
166 using vtkLayoutEdge = struct vtkLayoutEdge_t;
167
168 // These are for storage of repulsion and attraction
169 vtkFloatArray* RepulsionArray;
170 vtkFloatArray* AttractionArray;
171 vtkLayoutEdge* EdgeArray;
172
173 int RandomSeed;
174 int IterationsPerLayout;
175 int TotalIterations;
176 int LayoutComplete;
177 float Temp;
178 float RestDistance;
179 bool Jitter;
180
182 void operator=(const vtkSimple2DLayoutStrategy&) = delete;
183};
184
185VTK_ABI_NAMESPACE_END
186#endif
dynamic, self-adjusting array of float
abstract superclass for all graph layout strategies
a simple class to control print indentation
Definition vtkIndent.h:38
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:315
#define VTK_DOUBLE_MAX
Definition vtkType.h:154
#define VTK_INT_MAX
Definition vtkType.h:144
#define VTK_FLOAT_MAX
Definition vtkType.h:152