VTK
vtkSimple2DLayoutStrategy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSimple2DLayoutStrategy.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 -------------------------------------------------------------------------*/
43 #ifndef __vtkSimple2DLayoutStrategy_h
44 #define __vtkSimple2DLayoutStrategy_h
45 
46 #include "vtkGraphLayoutStrategy.h"
47 
48 class vtkFloatArray;
49 
51 {
52 public:
54 
56  void PrintSelf(ostream& os, vtkIndent indent);
57 
59 
62  vtkSetClampMacro(RandomSeed, int, 0, VTK_LARGE_INTEGER);
63  vtkGetMacro(RandomSeed, int);
65 
67 
72  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_LARGE_INTEGER);
73  vtkGetMacro(MaxNumberOfIterations, int);
75 
77 
81  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_LARGE_INTEGER);
82  vtkGetMacro(IterationsPerLayout, int);
84 
86 
89  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
90  vtkGetMacro(InitialTemperature, float);
92 
94 
98  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
99  vtkGetMacro(CoolDownRate, double);
101 
103 
106  vtkSetMacro(Jitter, bool);
107  vtkGetMacro(Jitter, bool);
109 
111 
113  vtkSetMacro(RestDistance, float);
114  vtkGetMacro(RestDistance, float);
116 
119  virtual void Initialize();
120 
125  virtual void Layout();
126 
129  virtual int IsLayoutComplete() {return this->LayoutComplete;}
130 
131 protected:
134 
135  int MaxNumberOfIterations; //Maximum number of iterations.
137  float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate.
138 
139 private:
140 
141  //BTX
142  // An edge consists of two vertices joined together.
143  // This struct acts as a "pointer" to those two vertices.
144  typedef struct
145  {
146  vtkIdType from;
147  vtkIdType to;
148  float weight;
149  } vtkLayoutEdge;
150 
151  // These are for storage of repulsion and attraction
152  vtkFloatArray *RepulsionArray;
153  vtkFloatArray *AttractionArray;
154  vtkLayoutEdge *EdgeArray;
155  //ETX
156 
157  int RandomSeed;
158  int IterationsPerLayout;
159  int TotalIterations;
160  int LayoutComplete;
161  float Temp;
162  float RestDistance;
163  bool Jitter;
164 
165  vtkSimple2DLayoutStrategy(const vtkSimple2DLayoutStrategy&); // Not implemented.
166  void operator=(const vtkSimple2DLayoutStrategy&); // Not implemented.
167 };
168 
169 #endif
170