-
Notifications
You must be signed in to change notification settings - Fork 35
Visual Connections
Note
Attributes and methods described in this section are available only on Diagram Connections
.addRelativeBendpoint()
.deleteAllBendpoints()
.deleteBendpoint()
.labelVisible
.relativeBendpoints
.setRelativeBendpoint
.source
.specialization
.style
.target
Add a bendpoint to a relative position on a connection at index position.
connection.addRelativeBendpoint(bendpoint, index)
Example:
// New bendpoint 1
var bp1 = {
startX: 200,
startY: 200,
endX: 10,
endY: 10
}
// New bendpoint 2
var bp2 = {
startX: 100,
startY: 100,
endX: 20,
endY: 30
}
// Select the first connection in an opened View
var connection = selection.filter("relationship").first();
// Add bendpoints at index positions
connection.addRelativeBendpoint(bp1, 0);
connection.addRelativeBendpoint(bp2, 1);
Delete all bendpoints on a connection.
connection.deleteAllBendpoints()
Delete a bendpoint at index position on a connection.
connection.deleteBendpoint(index);
Throws an ArchiScriptException
if index position is out of bounds.
Get/set the visibility of a connection label.
connection.labelVisible = false;
var isVisible = connection.labelVisible;
Get the relative bendpoint positions of a connection.
Returns an array list of bendpoints in this format:
endY:
endX:
startY:
startX:
connection.relativeBendpoints
Example:
var bendpoints = connection.getRelativeBendpoints();
var bendpoints = connection.relativeBendpoints;
Set a connection's existing bendpoint to a new position.
connection.setRelativeBendpoint(bendpoint, index)
Example:
// New bendpoint position
var bp = {
startX: 200,
startY: 200,
endX: 10,
endY: 10
}
// Select a connection which has some bendpoints
var connection = ...;
// Set the bendpoint at index position 0 to new bendpoint
// Will throw an exception if index is out of range
connection.setRelativeBendpoint(bp, 0);
Get the source of a Connection.
connection.source // => return the diagram object/connection which is the source of the connection
See .specialization
Set the style of a non-ArchiMate Connection.
connection.style = styleBits;
Allowed values are defined as constants and can be OR'd together with the |
operator:
CONNECTION_STYLE.LINE_SOLID (value of 0)
CONNECTION_STYLE.ARROW_FILL_TARGET (value of 1)
CONNECTION_STYLE.LINE_DASHED (value of 2)
CONNECTION_STYLE.LINE_DOTTED (value of 4)
CONNECTION_STYLE.ARROW_NONE (value of 0)
CONNECTION_STYLE.ARROW_FILL_SOURCE (value of 8)
CONNECTION_STYLE.ARROW_HOLLOW_TARGET (value of 16)
CONNECTION_STYLE.ARROW_HOLLOW_SOURCE (value of 32)
CONNECTION_STYLE.ARROW_LINE_TARGET (value of 64)
CONNECTION_STYLE.ARROW_LINE_SOURCE (value of 128)
Example:
connection.style = CONNECTION_STYLE.LINE_DASHED | CONNECTION_STYLE.ARROW_HOLLOW_SOURCE | CONNECTION_STYLE.ARROW_FILL_TARGET;
Get the target of a Connection.
connection.target // => return the diagram object/connection which is the target of the connection
If you value and use Archi please consider making a donation. Thanks!