This section describes segment operations
and their effects.
Complete or incomplete segment tree
Each end of a hyperedge has a segment that
is directly incident to the hyperedge end. You can obtain this
segment by calling:
seghyperedge.getEndSegment(hyperedgeEnd);
The segment tree is complete, if each end of the hyperedge is
reachable from each other end through a segment traversal. See
the method visit in section Method for traversal of incident segments
in any direction.
If this is not the case, the segment tree
is incomplete. For example, you have a disconnected forest of
segment trees.
To test whether a segment tree is
complete, call:
seghyperedge.isSegmentSetComplete();
Hyperedges with incomplete segment trees
can be displayed. Incomplete segment trees look wrong when
displayed. They do not convey information on which nodes are
connected by the hyperedge. Therefore, you are usually interested
only in complete segment trees.
The API of IlvSegmentedHyperEdge is flexible enough to
allow incomplete segment trees, which simplifies the task of
restructuring the segments of a hyperedge.
The segment tree can be made incomplete
temporarily, but for the final drawing you are recommended to
make the segment tree complete.
Therefore, it is necessary to distinguish
between primitive segment operations and safe segment operations.
Primitive operations can make the segment
tree incomplete.
Safe segment operations, when applied to a
complete segment tree, result in a complete segment tree.
Primitive segment operations
The API on IlvSegmentedHyperEdge.Segment allows you to
query the information of the segment, but not to manipulate the
segments. The manipulation must be done by the API on the
hyperedge itself. Any manipulation of the segment tree may change
the bounding box of the hyperedge. Therefore, an applyToObject session is usually necessary.
The following primitive segment operations allow you to change
the segment tree so that it becomes incomplete. The API of IlvSegmentedHyperEdge includes the methods
listed in the following table.
Method
|
Description
|
---|---|
Creates
a new segment that is incident to the hyperedge end. The new
segment has a fixed angle. |
|
Creates
a new segment that is incident to the hyperedge end. The new
segment has a variable angle. As long as the segment is not
terminated by any other segment, it uses the point (x, y) as
the other termination point of the segment. |
|
Creates
a new segment that is incident to both hyperedge ends. The
new segment has a variable angle. |
|
Creates
a new segment that is incident to the existing segment. The
new segment has a fixed angle. The input point (x,y)
determines the position of the segment. |
|
Creates
a new segment that is incident to the existing segment. The
new segment has a variable angle. The input points (x1,y1)
and (x2,y2) determine the start and end coordinates of the
new segment. |
|
Removes
a segment from the segment tree. This makes the segment tree
incomplete. Returns the segments that were formerly incident
to the removed segment. |
|
Connects
two segments so that they become incident. It is not possible
to connect segments in a way that would form a cycle in the
segment tree. The constraints on variable and fixed angle
segments must be observed. |
|
Disconnects
two segments so that they are no longer incident. This makes
the segment tree incomplete. |
|
Tests
whether two segments are connected. |
Safe segment operations
When hyperedge ends are added to or
removed from the hyperedge, the segment tree must change to
remain complete. The hyperedge has an autoconnect mode that does
this automatically.
The following code example shows how to
keep the segment tree complete.
Keeping the segment tree complete
IlvSegmentedHyperEdge seghyperedge = ... seghyperedge.setAutoConnect(true); // ... this will add segments automatically as necessary seghyperedge.addFrom(node); seghyperedge.addTo(node); // ... now the segment tree is complete // seghyperedge.isSegmentSetComplete() == true
The following code example shows how to
make the segment tree incomplete.
Making the segment tree incomplete
IlvSegmentedHyperEdge seghyperedge = ... seghyperedge.setAutoConnect(false); // ... this will not add any segments automatically seghyperedge.addFrom(node); seghyperedge.addTo(node); // ... now the segment tree is incomplete, since the new hyperedge ends // are not connected ... // seghyperedge.isSegmentSetComplete() == false
The autoconnect mode is enabled by
default.
The API of IlvSegmentedHyperEdge contains further
operations that keep the segment tree complete.
Method
|
Description
|
---|---|
Variants of this operation exist. They split a segment into a
sequence of segments, that is, a bend will occur at the
position where the segment was split. See the Java™ API reference manual for
information about the variants.
|
|
This
is the inverse of the split operation. It joins two segments,
so that instead of two, only one segment is used. This
operation removes a bend in the shape of the hyperedge. |
|
Changes
the angle of the input segment. If the input segment is
connected, this will work only if no incident segment is
colinear with the new angle. |
|
Changes
the angle of the segment that is incident to the input
hyperedge end. It reorganizes the segment tree so that the
desired angle is possible for the segment at the input end. |
See IlvSegmentedHyperEdge for more information
on segmented hyperedges.