blob: 8ba16ddd147903c500de6288b0d7e3c7d5c89c17 (
plain)
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
|
/**
* $Id: mxGraphHierarchyEdge.js,v 1.15 2012-06-12 20:23:14 david Exp $
* Copyright (c) 2006-2010, JGraph Ltd
*/
/**
* Class: mxGraphHierarchyEdge
*
* An abstraction of a hierarchical edge for the hierarchy layout
*
* Constructor: mxGraphHierarchyEdge
*
* Constructs a hierarchy edge
*
* Arguments:
*
* edges - a list of real graph edges this abstraction represents
*/
function mxGraphHierarchyEdge(edges)
{
mxGraphAbstractHierarchyCell.apply(this, arguments);
this.edges = edges;
};
/**
* Extends mxGraphAbstractHierarchyCell.
*/
mxGraphHierarchyEdge.prototype = new mxGraphAbstractHierarchyCell();
mxGraphHierarchyEdge.prototype.constructor = mxGraphHierarchyEdge;
/**
* Variable: edges
*
* The graph edge(s) this object represents. Parallel edges are all grouped
* together within one hierarchy edge.
*/
mxGraphHierarchyEdge.prototype.edges = null;
/**
* Variable: source
*
* The node this edge is sourced at
*/
mxGraphHierarchyEdge.prototype.source = null;
/**
* Variable: target
*
* The node this edge targets
*/
mxGraphHierarchyEdge.prototype.target = null;
/**
* Variable: isReversed
*
* Whether or not the direction of this edge has been reversed
* internally to create a DAG for the hierarchical layout
*/
mxGraphHierarchyEdge.prototype.isReversed = false;
/**
* Function: invert
*
* Inverts the direction of this internal edge(s)
*/
mxGraphHierarchyEdge.prototype.invert = function(layer)
{
var temp = this.source;
this.source = this.target;
this.target = temp;
this.isReversed = !this.isReversed;
};
/**
* Function: getNextLayerConnectedCells
*
* Returns the cells this cell connects to on the next layer up
*/
mxGraphHierarchyEdge.prototype.getNextLayerConnectedCells = function(layer)
{
if (this.nextLayerConnectedCells == null)
{
this.nextLayerConnectedCells = [];
for (var i = 0; i < this.temp.length; i++)
{
this.nextLayerConnectedCells[i] = [];
if (i == this.temp.length - 1)
{
this.nextLayerConnectedCells[i].push(this.source);
}
else
{
this.nextLayerConnectedCells[i].push(this);
}
}
}
return this.nextLayerConnectedCells[layer - this.minRank - 1];
};
/**
* Function: getPreviousLayerConnectedCells
*
* Returns the cells this cell connects to on the next layer down
*/
mxGraphHierarchyEdge.prototype.getPreviousLayerConnectedCells = function(layer)
{
if (this.previousLayerConnectedCells == null)
{
this.previousLayerConnectedCells = [];
for (var i = 0; i < this.temp.length; i++)
{
this.previousLayerConnectedCells[i] = [];
if (i == 0)
{
this.previousLayerConnectedCells[i].push(this.target);
}
else
{
this.previousLayerConnectedCells[i].push(this);
}
}
}
return this.previousLayerConnectedCells[layer - this.minRank - 1];
};
/**
* Function: isEdge
*
* Returns true.
*/
mxGraphHierarchyEdge.prototype.isEdge = function()
{
return true;
};
/**
* Function: getGeneralPurposeVariable
*
* Gets the value of temp for the specified layer
*/
mxGraphHierarchyEdge.prototype.getGeneralPurposeVariable = function(layer)
{
return this.temp[layer - this.minRank - 1];
};
/**
* Function: setGeneralPurposeVariable
*
* Set the value of temp for the specified layer
*/
mxGraphHierarchyEdge.prototype.setGeneralPurposeVariable = function(layer, value)
{
this.temp[layer - this.minRank - 1] = value;
};
/**
* Function: getCoreCell
*
* Gets the first core edge associated with this wrapper
*/
mxGraphHierarchyEdge.prototype.getCoreCell = function()
{
if (this.edges != null && this.edges.length > 0)
{
return this.edges[0];
}
return null;
};
|