VTK  9.2.6
vtkFast2DLayoutStrategy.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkFast2DLayoutStrategy.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-------------------------------------------------------------------------*/
35
36#ifndef vtkFast2DLayoutStrategy_h
37#define vtkFast2DLayoutStrategy_h
38
40#include "vtkInfovisLayoutModule.h" // For export macro
41
42#include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
43
44class vtkFastSplatter;
45class vtkFloatArray;
47class vtkImageData;
48
49class VTKINFOVISLAYOUT_EXPORT vtkFast2DLayoutStrategy : public vtkGraphLayoutStrategy
50{
51public:
53
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56
58
63 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
64 vtkGetMacro(RandomSeed, int);
66
68
76 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
77 vtkGetMacro(MaxNumberOfIterations, int);
79
81
88 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
89 vtkGetMacro(IterationsPerLayout, int);
91
93
99 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
100 vtkGetMacro(InitialTemperature, float);
102
104
112 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
113 vtkGetMacro(CoolDownRate, double);
115
117
121 vtkSetMacro(RestDistance, float);
122 vtkGetMacro(RestDistance, float);
124
129 void Initialize() override;
130
138 void Layout() override;
139
144 int IsLayoutComplete() override { return this->LayoutComplete; }
145
146protected:
149
150 int MaxNumberOfIterations; // Maximum number of iterations.
152 float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
153
154private:
155 // An edge consists of two vertices joined together.
156 // This struct acts as a "pointer" to those two vertices.
157 struct vtkLayoutEdge_t
158 {
159 vtkIdType from;
160 vtkIdType to;
161 float weight;
162 };
163 using vtkLayoutEdge = struct vtkLayoutEdge_t;
164
165 // This class 'has a' vtkFastSplatter for the density grid
169 vtkSmartPointer<vtkFloatArray> RepulsionArray;
170 vtkSmartPointer<vtkFloatArray> AttractionArray;
171
172 vtkLayoutEdge* EdgeArray;
173
174 int RandomSeed;
175 int IterationsPerLayout;
176 int TotalIterations;
177 int LayoutComplete;
178 float Temp;
179 float RestDistance;
180
181 // Private helper methods
182 void GenerateCircularSplat(vtkImageData* splat, int x, int y);
183 void GenerateGaussianSplat(vtkImageData* splat, int x, int y);
184 void ResolveCoincidentVertices();
185
187 void operator=(const vtkFast2DLayoutStrategy&) = delete;
188};
189
190#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
convert a vtkGraph to vtkPolyData
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:34
Hold a reference to a vtkObjectBase instance.
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