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-------------------------------------------------------------------------*/
87#ifndef vtkSimple2DLayoutStrategy_h
88#define vtkSimple2DLayoutStrategy_h
89
91#include "vtkInfovisLayoutModule.h" // For export macro
92
93class vtkFloatArray;
94
95class VTKINFOVISLAYOUT_EXPORT vtkSimple2DLayoutStrategy : public vtkGraphLayoutStrategy
96{
97public:
99
101 void PrintSelf(ostream& os, vtkIndent indent) override;
102
104
109 vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
110 vtkGetMacro(RandomSeed, int);
112
114
122 vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
123 vtkGetMacro(MaxNumberOfIterations, int);
125
127
134 vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
135 vtkGetMacro(IterationsPerLayout, int);
137
139
145 vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
146 vtkGetMacro(InitialTemperature, float);
148
150
158 vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
159 vtkGetMacro(CoolDownRate, double);
161
163
170 vtkSetMacro(Jitter, bool);
171 vtkGetMacro(Jitter, bool);
173
175
179 vtkSetMacro(RestDistance, float);
180 vtkGetMacro(RestDistance, float);
182
187 void Initialize() override;
188
196 void Layout() override;
197
202 int IsLayoutComplete() override { return this->LayoutComplete; }
203
204protected:
207
208 int MaxNumberOfIterations; // Maximum number of iterations.
210 float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
211
212private:
213 // An edge consists of two vertices joined together.
214 // This struct acts as a "pointer" to those two vertices.
215 struct vtkLayoutEdge_t
216 {
217 vtkIdType from;
218 vtkIdType to;
219 float weight;
220 };
221 using vtkLayoutEdge = struct vtkLayoutEdge_t;
222
223 // These are for storage of repulsion and attraction
224 vtkFloatArray* RepulsionArray;
225 vtkFloatArray* AttractionArray;
226 vtkLayoutEdge* EdgeArray;
227
228 int RandomSeed;
229 int IterationsPerLayout;
230 int TotalIterations;
231 int LayoutComplete;
232 float Temp;
233 float RestDistance;
234 bool Jitter;
235
237 void operator=(const vtkSimple2DLayoutStrategy&) = delete;
238};
239
240#endif
dynamic, self-adjusting array of float
abstract superclass for all graph layout strategies
a simple class to control print indentation
Definition: vtkIndent.h:119
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.
@ weight
Definition: vtkX3D.h:538
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