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 -------------------------------------------------------------------------*/
36 #ifndef vtkAttributeClustering2DLayoutStrategy_h
37 #define vtkAttributeClustering2DLayoutStrategy_h
38 
39 #include "vtkGraphLayoutStrategy.h"
40 #include "vtkInfovisLayoutModule.h" // For export macro
41 
42 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
43 
44 class vtkFastSplatter;
45 class vtkImageData;
46 class vtkIntArray;
47 class vtkFloatArray;
48 
49 class VTKINFOVISLAYOUT_EXPORT vtkAttributeClustering2DLayoutStrategy : public vtkGraphLayoutStrategy
50 {
51 public:
53 
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58 
62  vtkGetStringMacro(VertexAttribute);
63  void SetVertexAttribute(const char*);
65 
67 
72  vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
73  vtkGetMacro(RandomSeed, int);
75 
77 
85  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
86  vtkGetMacro(MaxNumberOfIterations, int);
88 
90 
97  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
98  vtkGetMacro(IterationsPerLayout, int);
100 
102 
108  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
109  vtkGetMacro(InitialTemperature, float);
111 
113 
121  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
122  vtkGetMacro(CoolDownRate, double);
124 
126 
130  vtkSetMacro(RestDistance, float);
131  vtkGetMacro(RestDistance, float);
133 
138  void Initialize() override;
139 
147  void Layout() override;
148 
153  int IsLayoutComplete() override { return this->LayoutComplete; }
154 
155 protected:
158 
159  int MaxNumberOfIterations; // Maximum number of iterations.
161  float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
162 
163 private:
164  // This class 'has a' vtkFastSplatter for the density grid
167  vtkSmartPointer<vtkFloatArray> RepulsionArray;
168  vtkSmartPointer<vtkFloatArray> AttractionArray;
169  vtkSmartPointer<vtkIntArray> EdgeCountArray;
170 
171  int RandomSeed;
172  int IterationsPerLayout;
173  int TotalIterations;
174  int LayoutComplete;
175  float Temp;
176  float RestDistance;
177  float CuttingThreshold;
178  char* VertexAttribute;
179 
180  // Private helper methods
181  void GenerateCircularSplat(vtkImageData* splat, int x, int y);
182  void GenerateGaussianSplat(vtkImageData* splat, int x, int y);
183  void ResolveCoincidentVertices();
184 
185  class Internals;
186  Internals* Implementation;
187 
189  void operator=(const vtkAttributeClustering2DLayoutStrategy&) = delete;
190 };
191 
192 #endif
vtkAttributeClustering2DLayoutStrategy::InitialTemperature
float InitialTemperature
Definition: vtkAttributeClustering2DLayoutStrategy.h:160
vtkAttributeClustering2DLayoutStrategy::MaxNumberOfIterations
int MaxNumberOfIterations
Definition: vtkAttributeClustering2DLayoutStrategy.h:159
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:35
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkGraphLayoutStrategy
abstract superclass for all graph layout strategies
Definition: vtkGraphLayoutStrategy.h:45
vtkSmartPointer< vtkFastSplatter >
vtkAttributeClustering2DLayoutStrategy::CoolDownRate
float CoolDownRate
Definition: vtkAttributeClustering2DLayoutStrategy.h:161
vtkGraphLayoutStrategy::Layout
virtual void Layout()=0
This is the layout method where the graph that was set in SetGraph() is laid out.
vtkAttributeClustering2DLayoutStrategy
a simple fast 2D graph layout
Definition: vtkAttributeClustering2DLayoutStrategy.h:49
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:153
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkIntArray
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:39
vtkGraphLayoutStrategy::Initialize
virtual void Initialize()
This method allows the layout strategy to do initialization of data structures or whatever else it mi...
Definition: vtkGraphLayoutStrategy.h:61
vtkSmartPointer.h
vtkGraphLayoutStrategy::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkFastSplatter
A splatter optimized for splatting single kernels.
Definition: vtkFastSplatter.h:51
VTK_FLOAT_MAX
#define VTK_FLOAT_MAX
Definition: vtkType.h:163
vtkGraphLayoutStrategy.h
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165