VTK  9.0.1
vtkAttributeClustering2DLayoutStrategy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAttributeClustering2DLayoutStrategy.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 vtkAttributeClustering2DLayoutStrategy_h
34 #define vtkAttributeClustering2DLayoutStrategy_h
35 
36 #include "vtkGraphLayoutStrategy.h"
37 #include "vtkInfovisLayoutModule.h" // For export macro
38 
39 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
40 
41 class vtkFastSplatter;
42 class vtkImageData;
43 class vtkIntArray;
44 class vtkFloatArray;
45 
46 class VTKINFOVISLAYOUT_EXPORT vtkAttributeClustering2DLayoutStrategy : public vtkGraphLayoutStrategy
47 {
48 public:
50 
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
55 
59  vtkGetStringMacro(VertexAttribute);
60  void SetVertexAttribute(const char*);
62 
64 
69  vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
70  vtkGetMacro(RandomSeed, int);
72 
74 
82  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
83  vtkGetMacro(MaxNumberOfIterations, int);
85 
87 
94  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
95  vtkGetMacro(IterationsPerLayout, int);
97 
99 
105  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
106  vtkGetMacro(InitialTemperature, float);
108 
110 
118  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
119  vtkGetMacro(CoolDownRate, double);
121 
123 
127  vtkSetMacro(RestDistance, float);
128  vtkGetMacro(RestDistance, float);
130 
135  void Initialize() override;
136 
144  void Layout() override;
145 
150  int IsLayoutComplete() override { return this->LayoutComplete; }
151 
152 protected:
155 
156  int MaxNumberOfIterations; // Maximum number of iterations.
158  float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
159 
160 private:
161  // This class 'has a' vtkFastSplatter for the density grid
164  vtkSmartPointer<vtkFloatArray> RepulsionArray;
165  vtkSmartPointer<vtkFloatArray> AttractionArray;
166  vtkSmartPointer<vtkIntArray> EdgeCountArray;
167 
168  int RandomSeed;
169  int IterationsPerLayout;
170  int TotalIterations;
171  int LayoutComplete;
172  float Temp;
173  float RestDistance;
174  float CuttingThreshold;
175  char* VertexAttribute;
176 
177  // Private helper methods
178  void GenerateCircularSplat(vtkImageData* splat, int x, int y);
179  void GenerateGaussianSplat(vtkImageData* splat, int x, int y);
180  void ResolveCoincidentVertices();
181 
182  class Internals;
183  Internals* Implementation;
184 
186  void operator=(const vtkAttributeClustering2DLayoutStrategy&) = delete;
187 };
188 
189 #endif
vtkAttributeClustering2DLayoutStrategy::InitialTemperature
float InitialTemperature
Definition: vtkAttributeClustering2DLayoutStrategy.h:157
vtkAttributeClustering2DLayoutStrategy::MaxNumberOfIterations
int MaxNumberOfIterations
Definition: vtkAttributeClustering2DLayoutStrategy.h:156
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:36
vtkGraphLayoutStrategy
abstract superclass for all graph layout strategies
Definition: vtkGraphLayoutStrategy.h:46
vtkSmartPointer< vtkFastSplatter >
vtkAttributeClustering2DLayoutStrategy::CoolDownRate
float CoolDownRate
Definition: vtkAttributeClustering2DLayoutStrategy.h:158
vtkAttributeClustering2DLayoutStrategy::Layout
void Layout() override
This is the layout method where the graph that was set in SetGraph() is laid out.
vtkAttributeClustering2DLayoutStrategy::Initialize
void Initialize() override
This strategy sets up some data structures for faster processing of each Layout() call.
vtkAttributeClustering2DLayoutStrategy
a simple fast 2D graph layout
Definition: vtkAttributeClustering2DLayoutStrategy.h:47
vtkAttributeClustering2DLayoutStrategy::New
static vtkAttributeClustering2DLayoutStrategy * New()
vtkAttributeClustering2DLayoutStrategy::IsLayoutComplete
int IsLayoutComplete() override
I'm an iterative layout so this method lets the caller know if I'm done laying out the graph.
Definition: vtkAttributeClustering2DLayoutStrategy.h:150
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkIntArray
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:40
vtkSmartPointer.h
vtkFastSplatter
A splatter optimized for splatting single kernels.
Definition: vtkFastSplatter.h:52
VTK_FLOAT_MAX
#define VTK_FLOAT_MAX
Definition: vtkType.h:163
vtkGraphLayoutStrategy.h
vtkAttributeClustering2DLayoutStrategy::vtkAttributeClustering2DLayoutStrategy
vtkAttributeClustering2DLayoutStrategy()
vtkAttributeClustering2DLayoutStrategy::SetVertexAttribute
void SetVertexAttribute(const char *)
vtkAttributeClustering2DLayoutStrategy::~vtkAttributeClustering2DLayoutStrategy
~vtkAttributeClustering2DLayoutStrategy() override
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165
vtkAttributeClustering2DLayoutStrategy::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.