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 -------------------------------------------------------------------------*/
35 #ifndef vtkSimple2DLayoutStrategy_h
36 #define vtkSimple2DLayoutStrategy_h
37 
38 #include "vtkGraphLayoutStrategy.h"
39 #include "vtkInfovisLayoutModule.h" // For export macro
40 
41 class vtkFloatArray;
42 
43 class VTKINFOVISLAYOUT_EXPORT vtkSimple2DLayoutStrategy : public vtkGraphLayoutStrategy
44 {
45 public:
47 
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
52 
57  vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
58  vtkGetMacro(RandomSeed, int);
60 
62 
70  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
71  vtkGetMacro(MaxNumberOfIterations, int);
73 
75 
82  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
83  vtkGetMacro(IterationsPerLayout, int);
85 
87 
93  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
94  vtkGetMacro(InitialTemperature, float);
96 
98 
106  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
107  vtkGetMacro(CoolDownRate, double);
109 
111 
118  vtkSetMacro(Jitter, bool);
119  vtkGetMacro(Jitter, bool);
121 
123 
127  vtkSetMacro(RestDistance, float);
128  vtkGetMacro(RestDistance, float);
130 
135  void Initialize() override;
136 
144  void Layout() override;
145 
150  int IsLayoutComplete() override { return this->LayoutComplete; }
151 
152 protected:
155 
156  int MaxNumberOfIterations; // Maximum number of iterations.
158  float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
159 
160 private:
161  // An edge consists of two vertices joined together.
162  // This struct acts as a "pointer" to those two vertices.
163  typedef struct
164  {
165  vtkIdType from;
166  vtkIdType to;
167  float weight;
168  } vtkLayoutEdge;
169 
170  // These are for storage of repulsion and attraction
171  vtkFloatArray* RepulsionArray;
172  vtkFloatArray* AttractionArray;
173  vtkLayoutEdge* EdgeArray;
174 
175  int RandomSeed;
176  int IterationsPerLayout;
177  int TotalIterations;
178  int LayoutComplete;
179  float Temp;
180  float RestDistance;
181  bool Jitter;
182 
184  void operator=(const vtkSimple2DLayoutStrategy&) = delete;
185 };
186 
187 #endif
vtkSimple2DLayoutStrategy::vtkSimple2DLayoutStrategy
vtkSimple2DLayoutStrategy()
vtkSimple2DLayoutStrategy::InitialTemperature
float InitialTemperature
Definition: vtkSimple2DLayoutStrategy.h:157
vtkSimple2DLayoutStrategy::Layout
void Layout() override
This is the layout method where the graph that was set in SetGraph() is laid out.
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkSimple2DLayoutStrategy::~vtkSimple2DLayoutStrategy
~vtkSimple2DLayoutStrategy() override
vtkSimple2DLayoutStrategy::CoolDownRate
float CoolDownRate
Definition: vtkSimple2DLayoutStrategy.h:158
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:36
vtkGraphLayoutStrategy
abstract superclass for all graph layout strategies
Definition: vtkGraphLayoutStrategy.h:46
vtkX3D::weight
@ weight
Definition: vtkX3D.h:538
vtkSimple2DLayoutStrategy
a simple 2D graph layout
Definition: vtkSimple2DLayoutStrategy.h:44
vtkSimple2DLayoutStrategy::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
VTK_FLOAT_MAX
#define VTK_FLOAT_MAX
Definition: vtkType.h:163
vtkGraphLayoutStrategy.h
vtkSimple2DLayoutStrategy::Initialize
void Initialize() override
This strategy sets up some data structures for faster processing of each Layout() call.
vtkSimple2DLayoutStrategy::MaxNumberOfIterations
int MaxNumberOfIterations
Definition: vtkSimple2DLayoutStrategy.h:156
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:150
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165
vtkSimple2DLayoutStrategy::New
static vtkSimple2DLayoutStrategy * New()