/usr/include/vtk-7.1/vtkSimple2DLayoutStrategy.h is in libvtk7-dev 7.1.1+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkSimple2DLayoutStrategy.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*-------------------------------------------------------------------------
Copyright 2008 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
/**
* @class vtkSimple2DLayoutStrategy
* @brief a simple 2D graph layout
*
*
* This class is an implementation of the work presented in:
* Fruchterman & Reingold "Graph Drawing by Force-directed Placement"
* Software-Practice and Experience 21(11) 1991).
* The class includes some optimizations but nothing too fancy.
*
* @par Thanks:
* Thanks to Brian Wylie from Sandia National Laboratories for creating this
* class.
*/
#ifndef vtkSimple2DLayoutStrategy_h
#define vtkSimple2DLayoutStrategy_h
#include "vtkInfovisLayoutModule.h" // For export macro
#include "vtkGraphLayoutStrategy.h"
class vtkFloatArray;
class VTKINFOVISLAYOUT_EXPORT vtkSimple2DLayoutStrategy : public vtkGraphLayoutStrategy
{
public:
static vtkSimple2DLayoutStrategy *New();
vtkTypeMacro(vtkSimple2DLayoutStrategy, vtkGraphLayoutStrategy);
void PrintSelf(ostream& os, vtkIndent indent);
//@{
/**
* Seed the random number generator used to jitter point positions.
* This has a significant effect on their final positions when
* the layout is complete.
*/
vtkSetClampMacro(RandomSeed, int, 0, VTK_INT_MAX);
vtkGetMacro(RandomSeed, int);
//@}
//@{
/**
* Set/Get the maximum number of iterations to be used.
* The higher this number, the more iterations through the algorithm
* is possible, and thus, the more the graph gets modified.
* The default is '100' for no particular reason
* Note: The strong recommendation is that you do not change
* this parameter. :)
*/
vtkSetClampMacro(MaxNumberOfIterations, int, 0, VTK_INT_MAX);
vtkGetMacro(MaxNumberOfIterations, int);
//@}
//@{
/**
* Set/Get the number of iterations per layout.
* The only use for this ivar is for the application
* to do visualizations of the layout before it's complete.
* The default is '100' to match the default 'MaxNumberOfIterations'
* Note: Changing this parameter is just fine :)
*/
vtkSetClampMacro(IterationsPerLayout, int, 0, VTK_INT_MAX);
vtkGetMacro(IterationsPerLayout, int);
//@}
//@{
/**
* Set the initial temperature. The temperature default is '5'
* for no particular reason
* Note: The strong recommendation is that you do not change
* this parameter. :)
*/
vtkSetClampMacro(InitialTemperature, float, 0.0, VTK_FLOAT_MAX);
vtkGetMacro(InitialTemperature, float);
//@}
//@{
/**
* Set/Get the Cool-down rate.
* The higher this number is, the longer it will take to "cool-down",
* and thus, the more the graph will be modified. The default is '10'
* for no particular reason.
* Note: The strong recommendation is that you do not change
* this parameter. :)
*/
vtkSetClampMacro(CoolDownRate, double, 0.01, VTK_DOUBLE_MAX);
vtkGetMacro(CoolDownRate, double);
//@}
//@{
/**
* Set Random jitter of the nodes at initialization
* to on or off.
* Note: It's strongly recommendation to have jitter ON
* even if you have initial coordinates in your graph.
* Default is ON
*/
vtkSetMacro(Jitter, bool);
vtkGetMacro(Jitter, bool);
//@}
//@{
/**
* Manually set the resting distance. Otherwise the
* distance is computed automatically.
*/
vtkSetMacro(RestDistance, float);
vtkGetMacro(RestDistance, float);
//@}
/**
* This strategy sets up some data structures
* for faster processing of each Layout() call
*/
virtual void Initialize();
/**
* This is the layout method where the graph that was
* set in SetGraph() is laid out. The method can either
* entirely layout the graph or iteratively lay out the
* graph. If you have an iterative layout please implement
* the IsLayoutComplete() method.
*/
virtual void Layout();
/**
* I'm an iterative layout so this method lets the caller
* know if I'm done laying out the graph
*/
virtual int IsLayoutComplete() {return this->LayoutComplete;}
protected:
vtkSimple2DLayoutStrategy();
~vtkSimple2DLayoutStrategy();
int MaxNumberOfIterations; //Maximum number of iterations.
float InitialTemperature;
float CoolDownRate; //Cool-down rate. Note: Higher # = Slower rate.
private:
// An edge consists of two vertices joined together.
// This struct acts as a "pointer" to those two vertices.
typedef struct
{
vtkIdType from;
vtkIdType to;
float weight;
} vtkLayoutEdge;
// These are for storage of repulsion and attraction
vtkFloatArray *RepulsionArray;
vtkFloatArray *AttractionArray;
vtkLayoutEdge *EdgeArray;
int RandomSeed;
int IterationsPerLayout;
int TotalIterations;
int LayoutComplete;
float Temp;
float RestDistance;
bool Jitter;
vtkSimple2DLayoutStrategy(const vtkSimple2DLayoutStrategy&) VTK_DELETE_FUNCTION;
void operator=(const vtkSimple2DLayoutStrategy&) VTK_DELETE_FUNCTION;
};
#endif
|