LayoutHost Relative Shape Placement Methods
These methods place shapes relative to each other
SnapEdges(edge, edge_pos, to_edge, to_edge_pos);
Places one geometry object against another so the specified edges are parallel and points touching
Parameters:
Edge: Specifies both the object to be moved
and the edge to snap.
Edge_pos: The position on the source edge (the
object being moved) that is to be snapped to the target edge; specified
as LayoutHost.START, MID, or END (or a value < 0, 0, or > 0).
To_edge: Specifies the target object and edge
(this object is not moved)
To_edge_pos: The target snap point. The source
edge and position is snapped to this location; specified as LayoutHost.START,
MID, or END (or a value < 0, 0, or > 0).
Example:
// Snap 'rect' so as that edge 1 is placed against
edge 2 of 'rect2'
LayoutHost.SnapEdges(rect.Edge(1), LayoutHost.MID,
rect2.Edge(2), LayoutHost.MID);
SnapEdgesWithOffset(edge, edge_pos, to_edge, to_edge_pos,
x_off, y_off, rel_angle);
Same as for SnapEdges but the target snap point is specified
by an edge position with an offset and angle. Associated with the target
edge position is a normal vector and a tangent vector. The normal vector
is perpendicular to the edge and points outwards (to the right
in polylines). The tangent vector points in the direction of the edge.
These two vectors define the local coordinate system in which x_off,
y_off, and angle are specified.
Parameters:
Edge: Specifies both the object to be moved
and the edge to snap.
Edge_pos: The position on the source edge (the
object being moved) that is to be snapped to the target edge; specified
as LayoutHost.START, MID, or END (or a value < 0, 0, or > 0).
To_edge: Specifies the target object and edge
(this object is not moved)
To_edge_pos: The target snap point. The source
edge and position is snapped to this location; specified as LayoutHost.START,
MID, or END (or a value < 0, 0, or > 0).
X_off: An offset along the normal vector for
the target edge.
Y_off: An offset along the tangent vector for
the target edge.
Rel_angle: An additional rotation (specified
as a counter-clockwise rotation in radians) relative to the normal vector
for the target edge.
Example:
// Snap 'rect' so as that edge 1 is offset 1 unit from
edge 2 of 'rect2'
LayoutHost.SnapEdgesWithOffset(rect.Edge(1), LayoutHost.MID,
rect2.Edge(2), LayoutHost.MID, 1, 0, 0);