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 -------------------------------------------------------------------------*/
50 #ifndef vtkSimple2DLayoutStrategy_h
51 #define vtkSimple2DLayoutStrategy_h
52 
53 #include "vtkGraphLayoutStrategy.h"
54 #include "vtkInfovisLayoutModule.h" // For export macro
55 
56 class vtkFloatArray;
57 
58 class VTKINFOVISLAYOUT_EXPORT vtkSimple2DLayoutStrategy : public vtkGraphLayoutStrategy
59 {
60 public:
62 
64  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
67 
72  vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
73  vtkGetMacro(RandomSeed, int);
75 
77 
85  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
86  vtkGetMacro(MaxNumberOfIterations, int);
88 
90 
97  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
98  vtkGetMacro(IterationsPerLayout, int);
100 
102 
108  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
109  vtkGetMacro(InitialTemperature, float);
111 
113 
121  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
122  vtkGetMacro(CoolDownRate, double);
124 
126 
133  vtkSetMacro(Jitter, bool);
134  vtkGetMacro(Jitter, bool);
136 
138 
142  vtkSetMacro(RestDistance, float);
143  vtkGetMacro(RestDistance, float);
145 
150  void Initialize() override;
151 
159  void Layout() override;
160 
165  int IsLayoutComplete() override { return this->LayoutComplete; }
166 
167 protected:
170 
171  int MaxNumberOfIterations; // Maximum number of iterations.
173  float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
174 
175 private:
176  // An edge consists of two vertices joined together.
177  // This struct acts as a "pointer" to those two vertices.
178  struct vtkLayoutEdge_t
179  {
180  vtkIdType from;
181  vtkIdType to;
182  float weight;
183  };
184  using vtkLayoutEdge = struct vtkLayoutEdge_t;
185 
186  // These are for storage of repulsion and attraction
187  vtkFloatArray* RepulsionArray;
188  vtkFloatArray* AttractionArray;
189  vtkLayoutEdge* EdgeArray;
190 
191  int RandomSeed;
192  int IterationsPerLayout;
193  int TotalIterations;
194  int LayoutComplete;
195  float Temp;
196  float RestDistance;
197  bool Jitter;
198 
200  void operator=(const vtkSimple2DLayoutStrategy&) = delete;
201 };
202 
203 #endif
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:51
abstract superclass for all graph layout strategies
a simple class to control print indentation
Definition: vtkIndent.h:49
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Initialize() override
This strategy sets up some data structures for faster processing of each Layout() call.
static vtkSimple2DLayoutStrategy * New()
~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