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 
#define VTK_DOUBLE_MAX
Definition: vtkType.h:140
#define VTKINFOVISLAYOUT_EXPORT
#define VTK_INT_MAX
Definition: vtkType.h:130
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
int vtkIdType
Definition: vtkType.h:247
abstract superclass for all graph layout strategies
#define VTK_FLOAT_MAX
Definition: vtkType.h:138
A splatter optimized for splatting single kernels.
a simple class to control print indentation
Definition: vtkIndent.h:38
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
a simple fast 2D graph layout that looks for a 'constraint' array (vtkDoubleArray). Any entry in the constraint array will indicate the level of impedance a node has to the force calculations during the layout optimization. The array is assumed to be normalized between zero and one, with one being totally constrained, so no force will be applied to the node (i.e. no movement), and zero being full range of movement (no constraints).
static vtkObject * New()
virtual void Layout()=0
void PrintSelf(ostream &os, vtkIndent indent)