VTK  9.3.20240420
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
64#ifndef vtkSimple2DLayoutStrategy_h
65#define vtkSimple2DLayoutStrategy_h
66
68#include "vtkInfovisLayoutModule.h" // For export macro
69
70VTK_ABI_NAMESPACE_BEGIN
71class vtkFloatArray;
72
73class VTKINFOVISLAYOUT_EXPORT vtkSimple2DLayoutStrategy : public vtkGraphLayoutStrategy
74{
75public:
77
79 void PrintSelf(ostream& os, vtkIndent indent) override;
80
82
87 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
88 vtkGetMacro(RandomSeed, int);
90
92
100 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
101 vtkGetMacro(MaxNumberOfIterations, int);
103
105
112 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
113 vtkGetMacro(IterationsPerLayout, int);
115
117
123 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
124 vtkGetMacro(InitialTemperature, float);
126
128
136 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
137 vtkGetMacro(CoolDownRate, double);
139
141
148 vtkSetMacro(Jitter, bool);
149 vtkGetMacro(Jitter, bool);
151
153
157 vtkSetMacro(RestDistance, float);
158 vtkGetMacro(RestDistance, float);
160
165 void Initialize() override;
166
174 void Layout() override;
175
180 int IsLayoutComplete() override { return this->LayoutComplete; }
181
182protected:
185
186 int MaxNumberOfIterations; // Maximum number of iterations.
188 float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
189
190private:
191 // An edge consists of two vertices joined together.
192 // This struct acts as a "pointer" to those two vertices.
193 struct vtkLayoutEdge_t
194 {
195 vtkIdType from;
196 vtkIdType to;
197 float weight;
198 };
199 using vtkLayoutEdge = struct vtkLayoutEdge_t;
200
201 // These are for storage of repulsion and attraction
202 vtkFloatArray* RepulsionArray;
203 vtkFloatArray* AttractionArray;
204 vtkLayoutEdge* EdgeArray;
205
206 int RandomSeed;
207 int IterationsPerLayout;
208 int TotalIterations;
209 int LayoutComplete;
210 float Temp;
211 float RestDistance;
212 bool Jitter;
213
215 void operator=(const vtkSimple2DLayoutStrategy&) = delete;
216};
217
218VTK_ABI_NAMESPACE_END
219#endif
dynamic, self-adjusting array of float
abstract superclass for all graph layout strategies
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: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