VTK  9.4.20250114
vtkFast2DLayoutStrategy.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
23#ifndef vtkFast2DLayoutStrategy_h
24#define vtkFast2DLayoutStrategy_h
25
27#include "vtkInfovisLayoutModule.h" // For export macro
28
29#include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
30
31VTK_ABI_NAMESPACE_BEGIN
32class vtkFastSplatter;
33class vtkFloatArray;
35class vtkImageData;
36
37class VTKINFOVISLAYOUT_EXPORT vtkFast2DLayoutStrategy : public vtkGraphLayoutStrategy
38{
39public:
41
43 void PrintSelf(ostream& os, vtkIndent indent) override;
44
46
51 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
52 vtkGetMacro(RandomSeed, int);
54
56
64 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
65 vtkGetMacro(MaxNumberOfIterations, int);
67
69
76 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
77 vtkGetMacro(IterationsPerLayout, int);
79
81
87 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
88 vtkGetMacro(InitialTemperature, float);
90
92
100 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
101 vtkGetMacro(CoolDownRate, double);
103
105
109 vtkSetMacro(RestDistance, float);
110 vtkGetMacro(RestDistance, float);
112
117 void Initialize() override;
118
126 void Layout() override;
127
132 int IsLayoutComplete() override { return this->LayoutComplete; }
133
134protected:
137
138 int MaxNumberOfIterations; // Maximum number of iterations.
140 float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
141
142private:
143 // An edge consists of two vertices joined together.
144 // This struct acts as a "pointer" to those two vertices.
145 struct vtkLayoutEdge_t
146 {
147 vtkIdType from;
148 vtkIdType to;
149 float weight;
150 };
151 using vtkLayoutEdge = struct vtkLayoutEdge_t;
152
153 // This class 'has a' vtkFastSplatter for the density grid
157 vtkSmartPointer<vtkFloatArray> RepulsionArray;
158 vtkSmartPointer<vtkFloatArray> AttractionArray;
159
160 vtkLayoutEdge* EdgeArray;
161
162 int RandomSeed;
163 int IterationsPerLayout;
164 int TotalIterations;
165 int LayoutComplete;
166 float Temp;
167 float RestDistance;
168
169 // Private helper methods
170 void GenerateCircularSplat(vtkImageData* splat, int x, int y);
171 void GenerateGaussianSplat(vtkImageData* splat, int x, int y);
172 void ResolveCoincidentVertices();
173
175 void operator=(const vtkFast2DLayoutStrategy&) = delete;
176};
177
178VTK_ABI_NAMESPACE_END
179#endif
a simple fast 2D graph layout
static vtkFast2DLayoutStrategy * New()
void Layout() override
This is the layout method where the graph that was set in SetGraph() is laid out.
~vtkFast2DLayoutStrategy() override
int IsLayoutComplete() override
I'm an iterative layout so this method lets the caller know if I'm done laying out the graph.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Initialize() override
This strategy sets up some data structures for faster processing of each Layout() call.
A splatter optimized for splatting single kernels.
dynamic, self-adjusting array of float
abstract superclass for all graph layout strategies
convert a vtkGraph to vtkPolyData
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:108
Hold a reference to a vtkObjectBase instance.
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