VTK  9.3.0
vtkClustering2DLayoutStrategy.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
17#ifndef vtkClustering2DLayoutStrategy_h
18#define vtkClustering2DLayoutStrategy_h
19
21#include "vtkInfovisLayoutModule.h" // For export macro
22
23#include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
24
25VTK_ABI_NAMESPACE_BEGIN
26class vtkFastSplatter;
27class vtkImageData;
28class vtkIntArray;
29class vtkFloatArray;
30
31class VTKINFOVISLAYOUT_EXPORT vtkClustering2DLayoutStrategy : 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
103 vtkSetMacro(RestDistance, float);
104 vtkGetMacro(RestDistance, float);
106
111 void Initialize() override;
112
120 void Layout() override;
121
126 int IsLayoutComplete() override { return this->LayoutComplete; }
127
128protected:
131
132 int MaxNumberOfIterations; // Maximum number of iterations.
134 float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
135
136private:
137 // An edge consists of two vertices joined together.
138 // This struct acts as a "pointer" to those two vertices.
139 struct vtkLayoutEdge_t
140 {
141 vtkIdType from;
142 vtkIdType to;
143 float weight;
144 int dead_edge; // I'm making this an int so that the edge array is
145 // word boundary aligned... but I'm not sure what
146 // really happens in these days of magical compilers
147 };
148 using vtkLayoutEdge = struct vtkLayoutEdge_t;
149
150 // This class 'has a' vtkFastSplatter for the density grid
153 vtkSmartPointer<vtkFloatArray> RepulsionArray;
154 vtkSmartPointer<vtkFloatArray> AttractionArray;
155 vtkSmartPointer<vtkIntArray> EdgeCountArray;
156
157 vtkLayoutEdge* EdgeArray;
158
159 int RandomSeed;
160 int IterationsPerLayout;
161 int TotalIterations;
162 int LayoutComplete;
163 float Temp;
164 float RestDistance;
165 float CuttingThreshold;
166
167 // Private helper methods
168 void GenerateCircularSplat(vtkImageData* splat, int x, int y);
169 void GenerateGaussianSplat(vtkImageData* splat, int x, int y);
170 void ResolveCoincidentVertices();
171
173 void operator=(const vtkClustering2DLayoutStrategy&) = delete;
174};
175
176VTK_ABI_NAMESPACE_END
177#endif
static vtkClustering2DLayoutStrategy * New()
~vtkClustering2DLayoutStrategy() override
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.
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.
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
dynamic, self-adjusting array of int
Definition vtkIntArray.h:35
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