VTK  9.1.0
vtkClustering2DLayoutStrategy.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkClustering2DLayoutStrategy.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15/*-------------------------------------------------------------------------
16 Copyright 2008 Sandia Corporation.
17 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18 the U.S. Government retains certain rights in this software.
19-------------------------------------------------------------------------*/
33#ifndef vtkClustering2DLayoutStrategy_h
34#define vtkClustering2DLayoutStrategy_h
35
37#include "vtkInfovisLayoutModule.h" // For export macro
38
39#include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
40
41class vtkFastSplatter;
42class vtkImageData;
43class vtkIntArray;
44class vtkFloatArray;
45
46class VTKINFOVISLAYOUT_EXPORT vtkClustering2DLayoutStrategy : public vtkGraphLayoutStrategy
47{
48public:
50
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
55
60 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
61 vtkGetMacro(RandomSeed, int);
63
65
73 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
74 vtkGetMacro(MaxNumberOfIterations, int);
76
78
85 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
86 vtkGetMacro(IterationsPerLayout, int);
88
90
96 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
97 vtkGetMacro(InitialTemperature, float);
99
101
109 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
110 vtkGetMacro(CoolDownRate, double);
112
114
118 vtkSetMacro(RestDistance, float);
119 vtkGetMacro(RestDistance, float);
121
126 void Initialize() override;
127
135 void Layout() override;
136
141 int IsLayoutComplete() override { return this->LayoutComplete; }
142
143protected:
146
147 int MaxNumberOfIterations; // Maximum number of iterations.
149 float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
150
151private:
152 // An edge consists of two vertices joined together.
153 // This struct acts as a "pointer" to those two vertices.
154 struct vtkLayoutEdge_t
155 {
156 vtkIdType from;
157 vtkIdType to;
158 float weight;
159 int dead_edge; // I'm making this an int so that the edge array is
160 // word boundary aligned... but I'm not sure what
161 // really happens in these days of magical compilers
162 };
163 using vtkLayoutEdge = struct vtkLayoutEdge_t;
164
165 // This class 'has a' vtkFastSplatter for the density grid
168 vtkSmartPointer<vtkFloatArray> RepulsionArray;
169 vtkSmartPointer<vtkFloatArray> AttractionArray;
170 vtkSmartPointer<vtkIntArray> EdgeCountArray;
171
172 vtkLayoutEdge* EdgeArray;
173
174 int RandomSeed;
175 int IterationsPerLayout;
176 int TotalIterations;
177 int LayoutComplete;
178 float Temp;
179 float RestDistance;
180 float CuttingThreshold;
181
182 // Private helper methods
183 void GenerateCircularSplat(vtkImageData* splat, int x, int y);
184 void GenerateGaussianSplat(vtkImageData* splat, int x, int y);
185 void ResolveCoincidentVertices();
186
188 void operator=(const vtkClustering2DLayoutStrategy&) = delete;
189};
190
191#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
Definition: vtkImageData.h:157
a simple class to control print indentation
Definition: vtkIndent.h:113
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:149
@ weight
Definition: vtkX3D.h:538
int vtkIdType
Definition: vtkType.h:332
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165
#define VTK_INT_MAX
Definition: vtkType.h:155
#define VTK_FLOAT_MAX
Definition: vtkType.h:163