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 "vtkGraphLayoutStrategy.h"
45 
46 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
47 
48 class vtkFastSplatter;
49 class vtkImageData;
50 class vtkFloatArray;
51 
53 {
54 public:
56 
58  void PrintSelf(ostream& os, vtkIndent indent);
59 
61 
64  vtkSetClampMacro(RandomSeed, int, 0, VTK_LARGE_INTEGER);
65  vtkGetMacro(RandomSeed, int);
67 
69 
74  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_LARGE_INTEGER);
75  vtkGetMacro(MaxNumberOfIterations, int);
77 
79 
83  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_LARGE_INTEGER);
84  vtkGetMacro(IterationsPerLayout, int);
86 
88 
91  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
92  vtkGetMacro(InitialTemperature, float);
94 
96 
100  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
101  vtkGetMacro(CoolDownRate, double);
103 
104 
106 
108  vtkSetMacro(RestDistance, float);
109  vtkGetMacro(RestDistance, float);
111 
114  virtual void Initialize();
115 
120  virtual void Layout();
121 
124  virtual int IsLayoutComplete() {return this->LayoutComplete;}
125 
127 
129  vtkSetStringMacro(InputArrayName);
130  vtkGetStringMacro(InputArrayName);
132 
133 protected:
136 
137  int MaxNumberOfIterations; //Maximum number of iterations.
139  float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate.
140 
141 private:
142 
143  //BTX
144 
145  // An edge consists of two vertices joined together.
146  // This struct acts as a "pointer" to those two vertices.
147  typedef struct
148  {
149  vtkIdType from;
150  vtkIdType to;
151  float weight;
152  } vtkLayoutEdge;
153 
154  // This class 'has a' vtkFastSplatter for the density grid
157  vtkSmartPointer<vtkFloatArray> RepulsionArray;
158  vtkSmartPointer<vtkFloatArray> AttractionArray;
159  //ETX
160 
161  vtkLayoutEdge *EdgeArray;
162 
163  int RandomSeed;
164  int IterationsPerLayout;
165  int TotalIterations;
166  int LayoutComplete;
167  float Temp;
168  float RestDistance;
169 
170  char* InputArrayName;
171 
172  // Private helper methods
173  void GenerateCircularSplat(vtkImageData *splat, int x, int y);
174  void GenerateGaussianSplat(vtkImageData *splat, int x, int y);
175  void ResolveCoincidentVertices();
176 
178  void operator=(const vtkConstrained2DLayoutStrategy&); // Not implemented.
179 };
180 
181 #endif
182 
#define VTK_DOUBLE_MAX
Definition: vtkType.h:133
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
int vtkIdType
Definition: vtkType.h:255
abstract superclass for all graph layout strategies
#define VTK_FLOAT_MAX
Definition: vtkType.h:131
A splatter optimized for splatting single kernels.
a simple class to control print indentation
Definition: vtkIndent.h:37
topologically and geometrically regular array of data
Definition: vtkImageData.h:43
a simple fast 2D graph layout that looks for a 'constraint' array (vtkDoubleArray). Any entry in the constraint array will indicate the level of impedence 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).
#define VTK_INFOVIS_EXPORT
#define VTK_LARGE_INTEGER
Definition: vtkType.h:148
static vtkObject * New()
virtual void Layout()=0
void PrintSelf(ostream &os, vtkIndent indent)