VTK  9.3.0
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
20#ifndef vtkFast2DLayoutStrategy_h
21#define vtkFast2DLayoutStrategy_h
22
24#include "vtkInfovisLayoutModule.h" // For export macro
25
26#include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
27
28VTK_ABI_NAMESPACE_BEGIN
29class vtkFastSplatter;
30class vtkFloatArray;
32class vtkImageData;
33
34class VTKINFOVISLAYOUT_EXPORT vtkFast2DLayoutStrategy : public vtkGraphLayoutStrategy
35{
36public:
38
40 void PrintSelf(ostream& os, vtkIndent indent) override;
41
43
48 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
49 vtkGetMacro(RandomSeed, int);
51
53
61 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
62 vtkGetMacro(MaxNumberOfIterations, int);
64
66
73 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
74 vtkGetMacro(IterationsPerLayout, int);
76
78
84 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
85 vtkGetMacro(InitialTemperature, float);
87
89
97 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
98 vtkGetMacro(CoolDownRate, double);
100
102
106 vtkSetMacro(RestDistance, float);
107 vtkGetMacro(RestDistance, float);
109
114 void Initialize() override;
115
123 void Layout() override;
124
129 int IsLayoutComplete() override { return this->LayoutComplete; }
130
131protected:
134
135 int MaxNumberOfIterations; // Maximum number of iterations.
137 float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
138
139private:
140 // An edge consists of two vertices joined together.
141 // This struct acts as a "pointer" to those two vertices.
142 struct vtkLayoutEdge_t
143 {
144 vtkIdType from;
145 vtkIdType to;
146 float weight;
147 };
148 using vtkLayoutEdge = struct vtkLayoutEdge_t;
149
150 // This class 'has a' vtkFastSplatter for the density grid
154 vtkSmartPointer<vtkFloatArray> RepulsionArray;
155 vtkSmartPointer<vtkFloatArray> AttractionArray;
156
157 vtkLayoutEdge* EdgeArray;
158
159 int RandomSeed;
160 int IterationsPerLayout;
161 int TotalIterations;
162 int LayoutComplete;
163 float Temp;
164 float RestDistance;
165
166 // Private helper methods
167 void GenerateCircularSplat(vtkImageData* splat, int x, int y);
168 void GenerateGaussianSplat(vtkImageData* splat, int x, int y);
169 void ResolveCoincidentVertices();
170
172 void operator=(const vtkFast2DLayoutStrategy&) = delete;
173};
174
175VTK_ABI_NAMESPACE_END
176#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:29
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