VTK  9.0.1
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 -------------------------------------------------------------------------*/
44 #ifndef vtkSimple2DLayoutStrategy_h
45 #define vtkSimple2DLayoutStrategy_h
46 
47 #include "vtkGraphLayoutStrategy.h"
48 #include "vtkInfovisLayoutModule.h" // For export macro
49 
50 class vtkFloatArray;
51 
52 class VTKINFOVISLAYOUT_EXPORT vtkSimple2DLayoutStrategy : public vtkGraphLayoutStrategy
53 {
54 public:
56 
58  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
61 
66  vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
67  vtkGetMacro(RandomSeed, int);
69 
71 
79  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
80  vtkGetMacro(MaxNumberOfIterations, int);
82 
84 
91  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
92  vtkGetMacro(IterationsPerLayout, int);
94 
96 
102  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
103  vtkGetMacro(InitialTemperature, float);
105 
107 
115  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
116  vtkGetMacro(CoolDownRate, double);
118 
120 
127  vtkSetMacro(Jitter, bool);
128  vtkGetMacro(Jitter, bool);
130 
132 
136  vtkSetMacro(RestDistance, float);
137  vtkGetMacro(RestDistance, float);
139 
144  void Initialize() override;
145 
153  void Layout() override;
154 
159  int IsLayoutComplete() override { return this->LayoutComplete; }
160 
161 protected:
163  ~vtkSimple2DLayoutStrategy() override;
164 
165  int MaxNumberOfIterations; // Maximum number of iterations.
167  float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
168 
169 private:
170  // An edge consists of two vertices joined together.
171  // This struct acts as a "pointer" to those two vertices.
172  typedef struct
173  {
174  vtkIdType from;
175  vtkIdType to;
176  float weight;
177  } vtkLayoutEdge;
178 
179  // These are for storage of repulsion and attraction
180  vtkFloatArray* RepulsionArray;
181  vtkFloatArray* AttractionArray;
182  vtkLayoutEdge* EdgeArray;
183 
184  int RandomSeed;
185  int IterationsPerLayout;
186  int TotalIterations;
187  int LayoutComplete;
188  float Temp;
189  float RestDistance;
190  bool Jitter;
191 
193  void operator=(const vtkSimple2DLayoutStrategy&) = delete;
194 };
195 
196 #endif
vtkSimple2DLayoutStrategy::InitialTemperature
float InitialTemperature
Definition: vtkSimple2DLayoutStrategy.h:166
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkSimple2DLayoutStrategy::CoolDownRate
float CoolDownRate
Definition: vtkSimple2DLayoutStrategy.h:167
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:35
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
@ weight
Definition: vtkX3D.h:538
vtkSimple2DLayoutStrategy
a simple 2D graph layout
Definition: vtkSimple2DLayoutStrategy.h:52
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:33
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:163
vtkGraphLayoutStrategy.h
vtkSimple2DLayoutStrategy::MaxNumberOfIterations
int MaxNumberOfIterations
Definition: vtkSimple2DLayoutStrategy.h:165
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:159
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165