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 -------------------------------------------------------------------------*/
41 #ifndef vtkSimple2DLayoutStrategy_h
42 #define vtkSimple2DLayoutStrategy_h
43 
44 #include "vtkInfovisLayoutModule.h" // For export macro
45 #include "vtkGraphLayoutStrategy.h"
46 
47 class vtkFloatArray;
48 
49 class VTKINFOVISLAYOUT_EXPORT vtkSimple2DLayoutStrategy : public vtkGraphLayoutStrategy
50 {
51 public:
53 
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58 
63  vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
64  vtkGetMacro(RandomSeed, int);
66 
68 
76  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
77  vtkGetMacro(MaxNumberOfIterations, int);
79 
81 
88  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
89  vtkGetMacro(IterationsPerLayout, int);
91 
93 
99  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
100  vtkGetMacro(InitialTemperature, float);
102 
104 
112  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
113  vtkGetMacro(CoolDownRate, double);
115 
117 
124  vtkSetMacro(Jitter, bool);
125  vtkGetMacro(Jitter, bool);
127 
129 
133  vtkSetMacro(RestDistance, float);
134  vtkGetMacro(RestDistance, float);
136 
141  void Initialize() override;
142 
150  void Layout() override;
151 
156  int IsLayoutComplete() override {return this->LayoutComplete;}
157 
158 protected:
160  ~vtkSimple2DLayoutStrategy() override;
161 
162  int MaxNumberOfIterations; //Maximum number of iterations.
164  float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate.
165 
166 private:
167 
168  // An edge consists of two vertices joined together.
169  // This struct acts as a "pointer" to those two vertices.
170  typedef struct
171  {
172  vtkIdType from;
173  vtkIdType to;
174  float weight;
175  } vtkLayoutEdge;
176 
177  // These are for storage of repulsion and attraction
178  vtkFloatArray *RepulsionArray;
179  vtkFloatArray *AttractionArray;
180  vtkLayoutEdge *EdgeArray;
181 
182  int RandomSeed;
183  int IterationsPerLayout;
184  int TotalIterations;
185  int LayoutComplete;
186  float Temp;
187  float RestDistance;
188  bool Jitter;
189 
191  void operator=(const vtkSimple2DLayoutStrategy&) = delete;
192 };
193 
194 #endif
195 
vtkSimple2DLayoutStrategy::InitialTemperature
float InitialTemperature
Definition: vtkSimple2DLayoutStrategy.h:163
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:159
vtkSimple2DLayoutStrategy::CoolDownRate
float CoolDownRate
Definition: vtkSimple2DLayoutStrategy.h:164
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkGraphLayoutStrategy
abstract superclass for all graph layout strategies
Definition: vtkGraphLayoutStrategy.h:45
vtkX3D::weight
Definition: vtkX3D.h:532
vtkSimple2DLayoutStrategy
a simple 2D graph layout
Definition: vtkSimple2DLayoutStrategy.h:49
vtkGraphLayoutStrategy::Layout
virtual void Layout()=0
This is the layout method where the graph that was set in SetGraph() is laid out.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkGraphLayoutStrategy::Initialize
virtual void Initialize()
This method allows the layout strategy to do initialization of data structures or whatever else it mi...
Definition: vtkGraphLayoutStrategy.h:61
vtkGraphLayoutStrategy::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
VTK_FLOAT_MAX
#define VTK_FLOAT_MAX
Definition: vtkType.h:167
vtkGraphLayoutStrategy.h
vtkSimple2DLayoutStrategy::MaxNumberOfIterations
int MaxNumberOfIterations
Definition: vtkSimple2DLayoutStrategy.h:162
vtkSimple2DLayoutStrategy::IsLayoutComplete
int IsLayoutComplete() override
I'm an iterative layout so this method lets the caller know if I'm done laying out the graph.
Definition: vtkSimple2DLayoutStrategy.h:156
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:169