VTK
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 -------------------------------------------------------------------------*/
39 #ifndef vtkFast2DLayoutStrategy_h
40 #define vtkFast2DLayoutStrategy_h
41 
42 #include "vtkInfovisLayoutModule.h" // For export macro
43 #include "vtkGraphLayoutStrategy.h"
44 
45 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
46 
47 class vtkFastSplatter;
48 class vtkFloatArray;
49 class vtkGraphToPolyData;
50 class vtkImageData;
51 
52 class VTKINFOVISLAYOUT_EXPORT vtkFast2DLayoutStrategy : public vtkGraphLayoutStrategy
53 {
54 public:
56 
58  void PrintSelf(ostream& os, vtkIndent indent);
59 
61 
66  vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
67  vtkGetMacro(RandomSeed, int);
69 
71 
79  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
80  vtkGetMacro(MaxNumberOfIterations, int);
82 
84 
91  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
92  vtkGetMacro(IterationsPerLayout, int);
94 
96 
102  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
103  vtkGetMacro(InitialTemperature, float);
105 
107 
115  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
116  vtkGetMacro(CoolDownRate, double);
118 
120 
124  vtkSetMacro(RestDistance, float);
125  vtkGetMacro(RestDistance, float);
127 
132  virtual void Initialize();
133 
141  virtual void Layout();
142 
147  virtual int IsLayoutComplete() {return this->LayoutComplete;}
148 
149 protected:
152 
153  int MaxNumberOfIterations; //Maximum number of iterations.
155  float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate.
156 
157 private:
158 
159  // An edge consists of two vertices joined together.
160  // This struct acts as a "pointer" to those two vertices.
161  typedef struct
162  {
163  vtkIdType from;
164  vtkIdType to;
165  float weight;
166  } vtkLayoutEdge;
167 
168  // This class 'has a' vtkFastSplatter for the density grid
172  vtkSmartPointer<vtkFloatArray> RepulsionArray;
173  vtkSmartPointer<vtkFloatArray> AttractionArray;
174 
175  vtkLayoutEdge *EdgeArray;
176 
177  int RandomSeed;
178  int IterationsPerLayout;
179  int TotalIterations;
180  int LayoutComplete;
181  float Temp;
182  float RestDistance;
183 
184  // Private helper methods
185  void GenerateCircularSplat(vtkImageData *splat, int x, int y);
186  void GenerateGaussianSplat(vtkImageData *splat, int x, int y);
187  void ResolveCoincidentVertices();
188 
189  vtkFast2DLayoutStrategy(const vtkFast2DLayoutStrategy&) VTK_DELETE_FUNCTION;
190  void operator=(const vtkFast2DLayoutStrategy&) VTK_DELETE_FUNCTION;
191 };
192 
193 #endif
194 
vtkGraphToPolyData
convert a vtkGraph to vtkPolyData
Definition: vtkGraphToPolyData.h:48
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:153
vtkFast2DLayoutStrategy::New
static vtkFast2DLayoutStrategy * New()
vtkFast2DLayoutStrategy::Initialize
virtual void Initialize()
This strategy sets up some data structures for faster processing of each Layout() call.
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
vtkGraphLayoutStrategy
abstract superclass for all graph layout strategies
Definition: vtkGraphLayoutStrategy.h:46
vtkX3D::weight
@ weight
Definition: vtkX3D.h:532
vtkFast2DLayoutStrategy::Layout
virtual void Layout()
This is the layout method where the graph that was set in SetGraph() is laid out.
vtkSmartPointer< vtkGraphToPolyData >
vtkFast2DLayoutStrategy::IsLayoutComplete
virtual int IsLayoutComplete()
I'm an iterative layout so this method lets the caller know if I'm done laying out the graph.
Definition: vtkFast2DLayoutStrategy.h:147
vtkFast2DLayoutStrategy::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkFast2DLayoutStrategy::~vtkFast2DLayoutStrategy
~vtkFast2DLayoutStrategy()
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkSmartPointer.h
vtkFast2DLayoutStrategy::InitialTemperature
float InitialTemperature
Definition: vtkFast2DLayoutStrategy.h:154
vtkFastSplatter
A splatter optimized for splatting single kernels.
Definition: vtkFastSplatter.h:55
VTK_FLOAT_MAX
#define VTK_FLOAT_MAX
Definition: vtkType.h:161
vtkGraphLayoutStrategy.h
vtkFast2DLayoutStrategy::vtkFast2DLayoutStrategy
vtkFast2DLayoutStrategy()
vtkFast2DLayoutStrategy
a simple fast 2D graph layout
Definition: vtkFast2DLayoutStrategy.h:53
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkFast2DLayoutStrategy::MaxNumberOfIterations
int MaxNumberOfIterations
Definition: vtkFast2DLayoutStrategy.h:153
vtkFast2DLayoutStrategy::CoolDownRate
float CoolDownRate
Definition: vtkFast2DLayoutStrategy.h:155
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:163