VTK  9.1.0
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 -------------------------------------------------------------------------*/
84 #ifndef vtkSimple2DLayoutStrategy_h
85 #define vtkSimple2DLayoutStrategy_h
86 
87 #include "vtkGraphLayoutStrategy.h"
88 #include "vtkInfovisLayoutModule.h" // For export macro
89 
90 class vtkFloatArray;
91 
92 class VTKINFOVISLAYOUT_EXPORT vtkSimple2DLayoutStrategy : public vtkGraphLayoutStrategy
93 {
94 public:
96 
98  void PrintSelf(ostream& os, vtkIndent indent) override;
99 
101 
106  vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
107  vtkGetMacro(RandomSeed, int);
109 
111 
119  vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
120  vtkGetMacro(MaxNumberOfIterations, int);
122 
124 
131  vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
132  vtkGetMacro(IterationsPerLayout, int);
134 
136 
142  vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
143  vtkGetMacro(InitialTemperature, float);
145 
147 
155  vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
156  vtkGetMacro(CoolDownRate, double);
158 
160 
167  vtkSetMacro(Jitter, bool);
168  vtkGetMacro(Jitter, bool);
170 
172 
176  vtkSetMacro(RestDistance, float);
177  vtkGetMacro(RestDistance, float);
179 
184  void Initialize() override;
185 
193  void Layout() override;
194 
199  int IsLayoutComplete() override { return this->LayoutComplete; }
200 
201 protected:
204 
205  int MaxNumberOfIterations; // Maximum number of iterations.
207  float CoolDownRate; // Cool-down rate. Note: Higher # = Slower rate.
208 
209 private:
210  // An edge consists of two vertices joined together.
211  // This struct acts as a "pointer" to those two vertices.
212  struct vtkLayoutEdge_t
213  {
214  vtkIdType from;
215  vtkIdType to;
216  float weight;
217  };
218  using vtkLayoutEdge = struct vtkLayoutEdge_t;
219 
220  // These are for storage of repulsion and attraction
221  vtkFloatArray* RepulsionArray;
222  vtkFloatArray* AttractionArray;
223  vtkLayoutEdge* EdgeArray;
224 
225  int RandomSeed;
226  int IterationsPerLayout;
227  int TotalIterations;
228  int LayoutComplete;
229  float Temp;
230  float RestDistance;
231  bool Jitter;
232 
234  void operator=(const vtkSimple2DLayoutStrategy&) = delete;
235 };
236 
237 #endif
dynamic, self-adjusting array of float
abstract superclass for all graph layout strategies
a simple class to control print indentation
Definition: vtkIndent.h:113
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