forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkStackedTreeLayoutStrategy.h
164 lines (140 loc) · 5.07 KB
/
vtkStackedTreeLayoutStrategy.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
152
153
154
155
156
157
158
159
160
161
162
163
164
/*=========================================================================
Program: Visualization Toolkit
Module: vtkStackedTreeLayoutStrategy.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 vtkStackedTreeLayoutStrategy
* @brief lays out tree in stacked boxes or rings
*
*
* Performs a tree ring layout or "icicle" layout on a tree.
* This involves assigning a sector region to each vertex in the tree,
* and placing that information in a data array with four components per
* tuple representing (innerRadius, outerRadius, startAngle, endAngle).
*
* This class may be assigned as the layout strategy to vtkAreaLayout.
*
* @par Thanks:
* Thanks to Jason Shepherd from Sandia National Laboratories
* for help developing this class.
*/
#ifndef vtkStackedTreeLayoutStrategy_h
#define vtkStackedTreeLayoutStrategy_h
#include "vtkAreaLayoutStrategy.h"
#include "vtkInfovisLayoutModule.h" // For export macro
class vtkTree;
class vtkDataArray;
class VTKINFOVISLAYOUT_EXPORT vtkStackedTreeLayoutStrategy : public vtkAreaLayoutStrategy
{
public:
static vtkStackedTreeLayoutStrategy* New();
vtkTypeMacro(vtkStackedTreeLayoutStrategy, vtkAreaLayoutStrategy);
void PrintSelf(ostream& os, vtkIndent indent) override;
/**
* Perform the layout of the input tree, and store the sector
* bounds of each vertex as a tuple
* (innerRadius, outerRadius, startAngle, endAngle)
* in a data array.
*/
void Layout(vtkTree* inputTree, vtkDataArray* sectorArray, vtkDataArray* sizeArray) override;
/**
* Fill edgeRoutingTree with points suitable for routing edges of
* an overlaid graph.
*/
void LayoutEdgePoints(vtkTree* inputTree, vtkDataArray* sectorArray, vtkDataArray* sizeArray,
vtkTree* edgeRoutingTree) override;
///@{
/**
* Define the tree ring's interior radius.
*/
vtkSetMacro(InteriorRadius, double);
vtkGetMacro(InteriorRadius, double);
///@}
///@{
/**
* Define the thickness of each of the tree rings.
*/
vtkSetMacro(RingThickness, double);
vtkGetMacro(RingThickness, double);
///@}
///@{
/**
* Define the start angle for the root node.
* NOTE: It is assumed that the root end angle is greater than the
* root start angle and subtends no more than 360 degrees.
*/
vtkSetMacro(RootStartAngle, double);
vtkGetMacro(RootStartAngle, double);
///@}
///@{
/**
* Define the end angle for the root node.
* NOTE: It is assumed that the root end angle is greater than the
* root start angle and subtends no more than 360 degrees.
*/
vtkSetMacro(RootEndAngle, double);
vtkGetMacro(RootEndAngle, double);
///@}
///@{
/**
* Define whether or not rectangular coordinates are being used
* (as opposed to polar coordinates).
*/
vtkSetMacro(UseRectangularCoordinates, bool);
vtkGetMacro(UseRectangularCoordinates, bool);
vtkBooleanMacro(UseRectangularCoordinates, bool);
///@}
///@{
/**
* Define whether to reverse the order of the tree stacks from
* low to high.
*/
vtkSetMacro(Reverse, bool);
vtkGetMacro(Reverse, bool);
vtkBooleanMacro(Reverse, bool);
///@}
///@{
/**
* The spacing of tree levels in the edge routing tree.
* 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(InteriorLogSpacingValue, double);
vtkGetMacro(InteriorLogSpacingValue, double);
///@}
/**
* Returns the vertex id that contains pnt (or -1 if no one contains it).
*/
vtkIdType FindVertex(vtkTree* tree, vtkDataArray* array, float pnt[2]) override;
protected:
vtkStackedTreeLayoutStrategy();
~vtkStackedTreeLayoutStrategy() override;
float InteriorRadius;
float RingThickness;
float RootStartAngle;
float RootEndAngle;
bool UseRectangularCoordinates;
bool Reverse;
double InteriorLogSpacingValue;
void ComputeEdgeRoutingPoints(vtkTree* inputTree, vtkDataArray* coordsArray, vtkTree* outputTree);
void LayoutChildren(vtkTree* tree, vtkDataArray* coordsArray, vtkDataArray* sizeArray,
vtkIdType nchildren, vtkIdType parent, vtkIdType begin, float parentInnerRad,
float parentOuterRad, float parentStartAng, float parentEndAng);
private:
vtkStackedTreeLayoutStrategy(const vtkStackedTreeLayoutStrategy&) = delete;
void operator=(const vtkStackedTreeLayoutStrategy&) = delete;
};
#endif