VTK
vtkCommunity2DLayoutStrategy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCommunity2DLayoutStrategy.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 -------------------------------------------------------------------------*/
37 #ifndef vtkCommunity2DLayoutStrategy_h
38 #define vtkCommunity2DLayoutStrategy_h
39 
40 #include "vtkInfovisLayoutModule.h" // For export macro
41 #include "vtkGraphLayoutStrategy.h"
42 
43 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
44 
45 class vtkFastSplatter;
46 class vtkImageData;
47 class vtkFloatArray;
48 
50 {
51 public:
53 
55  void PrintSelf(ostream& os, vtkIndent indent);
56 
58 
61  vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
62  vtkGetMacro(RandomSeed, int);
64 
66 
71  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
72  vtkGetMacro(MaxNumberOfIterations, int);
74 
76 
80  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
81  vtkGetMacro(IterationsPerLayout, int);
83 
85 
88  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
89  vtkGetMacro(InitialTemperature, float);
91 
93 
97  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
98  vtkGetMacro(CoolDownRate, double);
100 
101 
103 
105  vtkSetMacro(RestDistance, float);
106  vtkGetMacro(RestDistance, float);
108 
111  virtual void Initialize();
112 
117  virtual void Layout();
118 
121  virtual int IsLayoutComplete() {return this->LayoutComplete;}
122 
124 
125  vtkGetStringMacro(CommunityArrayName);
126  vtkSetStringMacro(CommunityArrayName);
128 
130 
134  vtkSetClampMacro(CommunityStrength, float, 0.1, 1.0);
135  vtkGetMacro(CommunityStrength, float);
137 
138 protected:
141 
142  int MaxNumberOfIterations; //Maximum number of iterations.
144  float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate.
145 
146 private:
147 
148  //BTX
149 
150  // An edge consists of two vertices joined together.
151  // This struct acts as a "pointer" to those two vertices.
152  typedef struct
153  {
154  vtkIdType from;
155  vtkIdType to;
156  float weight;
157  } vtkLayoutEdge;
158 
159  // This class 'has a' vtkFastSplatter for the density grid
162  vtkSmartPointer<vtkFloatArray> RepulsionArray;
163  vtkSmartPointer<vtkFloatArray> AttractionArray;
164  //ETX
165 
166  vtkLayoutEdge *EdgeArray;
167 
168  int RandomSeed;
169  int IterationsPerLayout;
170  int TotalIterations;
171  int LayoutComplete;
172  float Temp;
173  float RestDistance;
174  float CommunityStrength;
175 
177  char* CommunityArrayName;
178 
179  // Private helper methods
180  void GenerateCircularSplat(vtkImageData *splat, int x, int y);
181  void GenerateGaussianSplat(vtkImageData *splat, int x, int y);
182  void ResolveCoincidentVertices();
183 
185  void operator=(const vtkCommunity2DLayoutStrategy&); // Not implemented.
186 };
187 
188 #endif
189 
#define VTK_DOUBLE_MAX
Definition: vtkType.h:142
#define VTKINFOVISLAYOUT_EXPORT
#define VTK_INT_MAX
Definition: vtkType.h:132
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
int vtkIdType
Definition: vtkType.h:275
abstract superclass for all graph layout strategies
#define VTK_FLOAT_MAX
Definition: vtkType.h:140
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 community array on it's input and strengthens edges wi...
static vtkObject * New()
virtual void Layout()=0
void PrintSelf(ostream &os, vtkIndent indent)