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