VTK  9.3.0
vtkConstrained2DLayoutStrategy.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 vtkConstrained2DLayoutStrategy_h
24#define vtkConstrained2DLayoutStrategy_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 vtkImageData;
34class vtkFloatArray;
35
36class VTKINFOVISLAYOUT_EXPORT vtkConstrained2DLayoutStrategy : public vtkGraphLayoutStrategy
37{
38public:
40
42 void PrintSelf(ostream& os, vtkIndent indent) override;
43
45
50 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
51 vtkGetMacro(RandomSeed, int);
53
55
63 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
64 vtkGetMacro(MaxNumberOfIterations, int);
66
68
75 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
76 vtkGetMacro(IterationsPerLayout, int);
78
80
86 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
87 vtkGetMacro(InitialTemperature, float);
89
91
99 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
100 vtkGetMacro(CoolDownRate, double);
102
104
108 vtkSetMacro(RestDistance, float);
109 vtkGetMacro(RestDistance, float);
111
116 void Initialize() override;
117
125 void Layout() override;
126
131 int IsLayoutComplete() override { return this->LayoutComplete; }
132
134
138 vtkSetStringMacro(InputArrayName);
139 vtkGetStringMacro(InputArrayName);
141
142protected:
145
146 int MaxNumberOfIterations; // Maximum number of iterations.
148 float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
149
150private:
151 // An edge consists of two vertices joined together.
152 // This struct acts as a "pointer" to those two vertices.
153 struct vtkLayoutEdge_t
154 {
155 vtkIdType from;
156 vtkIdType to;
157 float weight;
158 };
159 using vtkLayoutEdge = struct vtkLayoutEdge_t;
160
161 // This class 'has a' vtkFastSplatter for the density grid
164 vtkSmartPointer<vtkFloatArray> RepulsionArray;
165 vtkSmartPointer<vtkFloatArray> AttractionArray;
166
167 vtkLayoutEdge* EdgeArray;
168
169 int RandomSeed;
170 int IterationsPerLayout;
171 int TotalIterations;
172 int LayoutComplete;
173 float Temp;
174 float RestDistance;
175
176 char* InputArrayName;
177
178 // Private helper methods
179 void GenerateCircularSplat(vtkImageData* splat, int x, int y);
180 void GenerateGaussianSplat(vtkImageData* splat, int x, int y);
181 void ResolveCoincidentVertices();
182
184 void operator=(const vtkConstrained2DLayoutStrategy&) = delete;
185};
186
187VTK_ABI_NAMESPACE_END
188#endif
a simple fast 2D graph layout that looks for a 'constraint' array (vtkDoubleArray).
~vtkConstrained2DLayoutStrategy() override
static vtkConstrained2DLayoutStrategy * New()
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.
void Initialize() override
This strategy sets up some data structures for faster processing of each Layout() call.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
A splatter optimized for splatting single kernels.
dynamic, self-adjusting array of float
abstract superclass for all graph layout strategies
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