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
22#ifndef vtkSimple2DLayoutStrategy_h
23#define vtkSimple2DLayoutStrategy_h
24
26#include "vtkInfovisLayoutModule.h" // For export macro
27
28VTK_ABI_NAMESPACE_BEGIN
29class vtkFloatArray;
30
31class VTKINFOVISLAYOUT_EXPORT vtkSimple2DLayoutStrategy : public vtkGraphLayoutStrategy
32{
33public:
35
37 void PrintSelf(ostream& os, vtkIndent indent) override;
38
40
45 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
46 vtkGetMacro(RandomSeed, int);
48
50
58 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
59 vtkGetMacro(MaxNumberOfIterations, int);
61
63
70 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
71 vtkGetMacro(IterationsPerLayout, int);
73
75
81 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
82 vtkGetMacro(InitialTemperature, float);
84
86
94 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
95 vtkGetMacro(CoolDownRate, double);
97
99
106 vtkSetMacro(Jitter, bool);
107 vtkGetMacro(Jitter, bool);
109
111
115 vtkSetMacro(RestDistance, float);
116 vtkGetMacro(RestDistance, float);
118
123 void Initialize() override;
124
132 void Layout() override;
133
138 int IsLayoutComplete() override { return this->LayoutComplete; }
139
140protected:
143
144 int MaxNumberOfIterations; // Maximum number of iterations.
146 float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
147
148private:
149 // An edge consists of two vertices joined together.
150 // This struct acts as a "pointer" to those two vertices.
151 struct vtkLayoutEdge_t
152 {
153 vtkIdType from;
154 vtkIdType to;
155 float weight;
156 };
157 using vtkLayoutEdge = struct vtkLayoutEdge_t;
158
159 // These are for storage of repulsion and attraction
160 vtkFloatArray* RepulsionArray;
161 vtkFloatArray* AttractionArray;
162 vtkLayoutEdge* EdgeArray;
163
164 int RandomSeed;
165 int IterationsPerLayout;
166 int TotalIterations;
167 int LayoutComplete;
168 float Temp;
169 float RestDistance;
170 bool Jitter;
171
173 void operator=(const vtkSimple2DLayoutStrategy&) = delete;
174};
175
176VTK_ABI_NAMESPACE_END
177#endif
dynamic, self-adjusting array of float
abstract superclass for all graph layout strategies
a simple class to control print indentation
Definition vtkIndent.h:29
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