VTK
vtkConstrained2DLayoutStrategy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkConstrained2DLayoutStrategy.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 -------------------------------------------------------------------------*/
41 #ifndef vtkConstrained2DLayoutStrategy_h
42 #define vtkConstrained2DLayoutStrategy_h
43 
44 #include "vtkInfovisLayoutModule.h" // For export macro
45 #include "vtkGraphLayoutStrategy.h"
46 
47 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
48 
49 class vtkFastSplatter;
50 class vtkImageData;
51 class vtkFloatArray;
52 
54 {
55 public:
57 
59  void PrintSelf(ostream& os, vtkIndent indent);
60 
62 
65  vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
66  vtkGetMacro(RandomSeed, int);
68 
70 
75  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
76  vtkGetMacro(MaxNumberOfIterations, int);
78 
80 
84  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
85  vtkGetMacro(IterationsPerLayout, int);
87 
89 
92  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
93  vtkGetMacro(InitialTemperature, float);
95 
97 
101  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
102  vtkGetMacro(CoolDownRate, double);
104 
105 
107 
109  vtkSetMacro(RestDistance, float);
110  vtkGetMacro(RestDistance, float);
112 
115  virtual void Initialize();
116 
121  virtual void Layout();
122 
125  virtual int IsLayoutComplete() {return this->LayoutComplete;}
126 
128 
130  vtkSetStringMacro(InputArrayName);
131  vtkGetStringMacro(InputArrayName);
133 
134 protected:
137 
138  int MaxNumberOfIterations; //Maximum number of iterations.
140  float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate.
141 
142 private:
143 
144  //BTX
145 
146  // An edge consists of two vertices joined together.
147  // This struct acts as a "pointer" to those two vertices.
148  typedef struct
149  {
150  vtkIdType from;
151  vtkIdType to;
152  float weight;
153  } vtkLayoutEdge;
154 
155  // This class 'has a' vtkFastSplatter for the density grid
158  vtkSmartPointer<vtkFloatArray> RepulsionArray;
159  vtkSmartPointer<vtkFloatArray> AttractionArray;
160  //ETX
161 
162  vtkLayoutEdge *EdgeArray;
163 
164  int RandomSeed;
165  int IterationsPerLayout;
166  int TotalIterations;
167  int LayoutComplete;
168  float Temp;
169  float RestDistance;
170 
171  char* InputArrayName;
172 
173  // Private helper methods
174  void GenerateCircularSplat(vtkImageData *splat, int x, int y);
175  void GenerateGaussianSplat(vtkImageData *splat, int x, int y);
176  void ResolveCoincidentVertices();
177 
179  void operator=(const vtkConstrained2DLayoutStrategy&); // Not implemented.
180 };
181 
182 #endif
183 
vtkConstrained2DLayoutStrategy::vtkConstrained2DLayoutStrategy
vtkConstrained2DLayoutStrategy()
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:132
vtkConstrained2DLayoutStrategy::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkConstrained2DLayoutStrategy::IsLayoutComplete
virtual int IsLayoutComplete()
Definition: vtkConstrained2DLayoutStrategy.h:125
vtkConstrained2DLayoutStrategy::InitialTemperature
float InitialTemperature
Definition: vtkConstrained2DLayoutStrategy.h:139
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:49
vtkGraphLayoutStrategy
abstract superclass for all graph layout strategies
Definition: vtkGraphLayoutStrategy.h:45
vtkX3D::weight
@ weight
Definition: vtkX3D.h:532
vtkConstrained2DLayoutStrategy
a simple fast 2D graph layout that looks for a 'constraint' array (vtkDoubleArray)....
Definition: vtkConstrained2DLayoutStrategy.h:54
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkSmartPointer< vtkFastSplatter >
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkConstrained2DLayoutStrategy::New
static vtkConstrained2DLayoutStrategy * New()
vtkConstrained2DLayoutStrategy::CoolDownRate
float CoolDownRate
Definition: vtkConstrained2DLayoutStrategy.h:140
vtkSetClampMacro
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:143
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSetStringMacro
#define vtkSetStringMacro(name)
Definition: vtkSetGet.h:104
vtkSmartPointer.h
vtkConstrained2DLayoutStrategy::~vtkConstrained2DLayoutStrategy
~vtkConstrained2DLayoutStrategy()
vtkFastSplatter
A splatter optimized for splatting single kernels.
Definition: vtkFastSplatter.h:54
VTK_FLOAT_MAX
#define VTK_FLOAT_MAX
Definition: vtkType.h:140
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkGetStringMacro
vtkGetStringMacro(ExtensionsString)
VTKINFOVISLAYOUT_EXPORT
#define VTKINFOVISLAYOUT_EXPORT
Definition: vtkInfovisLayoutModule.h:15
vtkGraphLayoutStrategy.h
vtkInfovisLayoutModule.h
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkConstrained2DLayoutStrategy::Layout
virtual void Layout()
vtkConstrained2DLayoutStrategy::Initialize
virtual void Initialize()
vtkConstrained2DLayoutStrategy::MaxNumberOfIterations
int MaxNumberOfIterations
Definition: vtkConstrained2DLayoutStrategy.h:138
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:142