forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkTreeLayoutStrategy.h
152 lines (130 loc) · 4.55 KB
/
vtkTreeLayoutStrategy.h
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
/*=========================================================================
Program: Visualization Toolkit
Module: vtkTreeLayoutStrategy.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 vtkTreeLayoutStrategy
* @brief hierarchical layout
*
*
* Assigns points to the nodes of a tree in either a standard or radial layout.
* The standard layout places each level on a horizontal line, while the
* radial layout places each level on a concentric circle.
* You may specify the sweep angle of the tree which constrains the tree
* to be contained within a wedge. Also, you may indicate the log scale of
* the tree, which diminishes the length of arcs at lower levels of the tree.
* Values near zero give a large proportion of the space to the tree levels
* near the root, while values near one give nearly equal proportions of space
* to all tree levels.
*
* The user may also specify an array to use to indicate the distance from the
* root, either vertically (for standard layout) or radially
* (for radial layout). You specify this with SetDistanceArrayName().
*
* If the input is not a tree but a general graph, this strategy first extracts
* a tree from the graph using a breadth-first search starting at vertex ID 0.
*/
#ifndef vtkTreeLayoutStrategy_h
#define vtkTreeLayoutStrategy_h
#include "vtkInfovisLayoutModule.h" // For export macro
#include "vtkGraphLayoutStrategy.h"
class VTKINFOVISLAYOUT_EXPORT vtkTreeLayoutStrategy : public vtkGraphLayoutStrategy
{
public:
static vtkTreeLayoutStrategy *New();
vtkTypeMacro(vtkTreeLayoutStrategy, vtkGraphLayoutStrategy);
void PrintSelf(ostream& os, vtkIndent indent);
/**
* Perform the tree layout.
*/
void Layout();
//@{
/**
* The sweep angle of the tree.
* For a standard tree layout, this should be between 0 and 180.
* For a radial tree layout, this can be between 0 and 360.
*/
vtkSetClampMacro(Angle, double, 0, 360);
vtkGetMacro(Angle, double);
//@}
//@{
/**
* If set, the tree is laid out with levels on concentric circles
* around the root. If unset (default), the tree is laid out with
* levels on horizontal lines.
*/
vtkSetMacro(Radial, bool);
vtkGetMacro(Radial, bool);
vtkBooleanMacro(Radial, bool);
//@}
//@{
/**
* The spacing of tree levels. Levels near zero give more space
* to levels near the root, while levels near one (the default)
* create evenly-spaced levels. Levels above one give more space
* to levels near the leaves.
*/
vtkSetMacro(LogSpacingValue, double);
vtkGetMacro(LogSpacingValue, double);
//@}
//@{
/**
* The spacing of leaves. Levels near one evenly space leaves
* with no gaps between subtrees. Levels near zero creates
* large gaps between subtrees.
*/
vtkSetClampMacro(LeafSpacing, double, 0.0, 1.0);
vtkGetMacro(LeafSpacing, double);
//@}
//@{
/**
* Get/Set the array to use to determine the distance from the
* root.
*/
vtkSetStringMacro(DistanceArrayName);
vtkGetStringMacro(DistanceArrayName);
//@}
//@{
/**
* The amount of counter-clockwise rotation to apply after the
* layout.
*/
vtkSetMacro(Rotation, double);
vtkGetMacro(Rotation, double);
//@}
//@{
/**
* If set and the input is not a tree but a general graph, the filter
* will reverse the edges on the graph before extracting a tree using
* breadth first search.
*/
vtkSetMacro(ReverseEdges, bool);
vtkGetMacro(ReverseEdges, bool);
vtkBooleanMacro(ReverseEdges, bool);
//@}
protected:
vtkTreeLayoutStrategy();
~vtkTreeLayoutStrategy();
double Angle;
bool Radial;
double LogSpacingValue;
double LeafSpacing;
char *DistanceArrayName;
double Rotation;
bool ReverseEdges;
private:
vtkTreeLayoutStrategy(const vtkTreeLayoutStrategy&) VTK_DELETE_FUNCTION;
void operator=(const vtkTreeLayoutStrategy&) VTK_DELETE_FUNCTION;
};
#endif