*/
private void computeLabelsFromDepths() {
for (Iterator it = edgeList.iterator(); it.hasNext();) {
Edge e = (Edge) it.next();
Label lbl = e.getLabel();
Depth depth = e.getDepth();
/**
* Only check edges for which there were duplicates, since these are
* the only ones which might be the result of dimensional collapses.
*/
if (!depth.isNull()) {
depth.normalize();
for (int i = 0; i < 2; i++) {
if (!lbl.isNull(i) && lbl.isArea() && !depth.isNull(i)) {
/**
* if the depths are equal, this edge is the result of
* the dimensional collapse of two or more edges. It has
* the same location on both sides of the edge, so it
* has collapsed to a line.
*/
if (depth.getDelta(i) == 0) {
lbl.toLine(i);
} else {
/**
* This edge may be the result of a dimensional
* collapse, but it still has different locations on
* both sides. The label of the edge must be updated
* to reflect the resultant side locations indicated
* by the depth values.
*/
Assert
.isTrue(!depth.isNull(i, Position.LEFT),
"depth of LEFT side has not been initialized");
lbl.setLocation(i, Position.LEFT, depth
.getLocation(i, Position.LEFT));
Assert
.isTrue(!depth.isNull(i, Position.RIGHT),
"depth of RIGHT side has not been initialized");
lbl.setLocation(i, Position.RIGHT, depth
.getLocation(i, Position.RIGHT));
}
}
}
}