VTK  9.2.6
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-------------------------------------------------------------------------*/
37
38#ifndef vtkSimple2DLayoutStrategy_h
39#define vtkSimple2DLayoutStrategy_h
40
42#include "vtkInfovisLayoutModule.h" // For export macro
43
44class vtkFloatArray;
45
46class VTKINFOVISLAYOUT_EXPORT vtkSimple2DLayoutStrategy : public vtkGraphLayoutStrategy
47{
48public:
50
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
55
60 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
61 vtkGetMacro(RandomSeed, int);
63
65
73 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
74 vtkGetMacro(MaxNumberOfIterations, int);
76
78
85 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
86 vtkGetMacro(IterationsPerLayout, int);
88
90
96 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
97 vtkGetMacro(InitialTemperature, float);
99
101
109 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
110 vtkGetMacro(CoolDownRate, double);
112
114
121 vtkSetMacro(Jitter, bool);
122 vtkGetMacro(Jitter, bool);
124
126
130 vtkSetMacro(RestDistance, float);
131 vtkGetMacro(RestDistance, float);
133
138 void Initialize() override;
139
147 void Layout() override;
148
153 int IsLayoutComplete() override { return this->LayoutComplete; }
154
155protected:
158
159 int MaxNumberOfIterations; // Maximum number of iterations.
161 float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
162
163private:
164 // An edge consists of two vertices joined together.
165 // This struct acts as a "pointer" to those two vertices.
166 struct vtkLayoutEdge_t
167 {
168 vtkIdType from;
169 vtkIdType to;
170 float weight;
171 };
172 using vtkLayoutEdge = struct vtkLayoutEdge_t;
173
174 // These are for storage of repulsion and attraction
175 vtkFloatArray* RepulsionArray;
176 vtkFloatArray* AttractionArray;
177 vtkLayoutEdge* EdgeArray;
178
179 int RandomSeed;
180 int IterationsPerLayout;
181 int TotalIterations;
182 int LayoutComplete;
183 float Temp;
184 float RestDistance;
185 bool Jitter;
186
188 void operator=(const vtkSimple2DLayoutStrategy&) = delete;
189};
190
191#endif
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition vtkIndent.h:34
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkSimple2DLayoutStrategy * New()
void Initialize() override
This strategy sets up some data structures for faster processing of each Layout() call.
~vtkSimple2DLayoutStrategy() override
void Layout() override
This is the layout method where the graph that was set in SetGraph() is laid out.
int IsLayoutComplete() override
I'm an iterative layout so this method lets the caller know if I'm done laying out the graph.
int vtkIdType
Definition vtkType.h:332
#define VTK_DOUBLE_MAX
Definition vtkType.h:165
#define VTK_INT_MAX
Definition vtkType.h:155
#define VTK_FLOAT_MAX
Definition vtkType.h:163