VTK  9.3.20240329
vtkAttributeClustering2DLayoutStrategy.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 vtkAttributeClustering2DLayoutStrategy_h
21 #define vtkAttributeClustering2DLayoutStrategy_h
22 
23 #include "vtkGraphLayoutStrategy.h"
24 #include "vtkInfovisLayoutModule.h" // For export macro
25 
26 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
27 
28 VTK_ABI_NAMESPACE_BEGIN
29 class vtkFastSplatter;
30 class vtkImageData;
31 class vtkIntArray;
32 class vtkFloatArray;
33 
34 class VTKINFOVISLAYOUT_EXPORT vtkAttributeClustering2DLayoutStrategy : public vtkGraphLayoutStrategy
35 {
36 public:
38 
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
43 
47  vtkGetStringMacro(VertexAttribute);
48  void SetVertexAttribute(const char*);
50 
52 
57  vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
58  vtkGetMacro(RandomSeed, int);
60 
62 
70  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
71  vtkGetMacro(MaxNumberOfIterations, int);
73 
75 
82  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
83  vtkGetMacro(IterationsPerLayout, int);
85 
87 
93  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
94  vtkGetMacro(InitialTemperature, float);
96 
98 
106  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
107  vtkGetMacro(CoolDownRate, double);
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 
140 protected:
143 
144  int MaxNumberOfIterations; // Maximum number of iterations.
146  float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
147 
148 private:
149  // This class 'has a' vtkFastSplatter for the density grid
152  vtkSmartPointer<vtkFloatArray> RepulsionArray;
153  vtkSmartPointer<vtkFloatArray> AttractionArray;
154  vtkSmartPointer<vtkIntArray> EdgeCountArray;
155 
156  int RandomSeed;
157  int IterationsPerLayout;
158  int TotalIterations;
159  int LayoutComplete;
160  float Temp;
161  float RestDistance;
162  float CuttingThreshold;
163  char* VertexAttribute;
164 
165  // Private helper methods
166  void GenerateCircularSplat(vtkImageData* splat, int x, int y);
167  void GenerateGaussianSplat(vtkImageData* splat, int x, int y);
168  void ResolveCoincidentVertices();
169 
170  class Internals;
171  Internals* Implementation;
172 
174  void operator=(const vtkAttributeClustering2DLayoutStrategy&) = delete;
175 };
176 
177 VTK_ABI_NAMESPACE_END
178 #endif
void SetVertexAttribute(const char *)
The name of the array on the vertices, whose values will be used for determining clusters.
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.
static vtkAttributeClustering2DLayoutStrategy * New()
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.
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
Definition: vtkImageData.h:156
a simple class to control print indentation
Definition: vtkIndent.h:108
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:144
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154
#define VTK_INT_MAX
Definition: vtkType.h:144
#define VTK_FLOAT_MAX
Definition: vtkType.h:152