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 
53 class VTKINFOVISLAYOUT_EXPORT vtkConstrained2DLayoutStrategy : public vtkGraphLayoutStrategy
54 {
55 public:
57 
59  void PrintSelf(ostream& os, vtkIndent indent);
60 
62 
65  vtkSetClampMacro(RandomSeed, int, 0, VTK_LARGE_INTEGER);
66  vtkGetMacro(RandomSeed, int);
68 
70 
75  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_LARGE_INTEGER);
76  vtkGetMacro(MaxNumberOfIterations, int);
78 
80 
84  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_LARGE_INTEGER);
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