Skip to end of metadata
Go to start of metadata

Be aware that you are modifying the model when using this method. Please create a safety copy of your model before you start using it.


If an object is associated with a diagram (use hasDiagram to check this), and auto layout is supported, you may call the auto layout command on this diagram:

<object>.canAutoLayoutDiagram( [<request>[, <selectedObjects>]] )

<object>.autoLayoutDiagram( [<request>[, <selectedObjects>]] )


<object>

A value of type Object or an expression evaluating to a value of that type: an object associated with a diagram.

<request>

(Optional) A value of type Structure or an expression evaluating to a value of that type: a structure containing directives and settings to lay out the given object. The structure can have the following members:

Directives:

layoutAction: A string with one of two predefined values. "full" means the full view auto-layout command (F6) should be executed, while "relation" means that one of the three relation layout commands (F7) needs to be executed.

withSettingsDialog: A boolean. When true, the full view auto-layout command with the preceding settings window (Shift-F6) should be executed. Because the standard relation auto-layout commands (F7) do not support a settings dialog, this member currently is relevant only for full view layout command.

relationLayoutType: A string with one of three predefined values. "relationPoly" performs a layout with bends, "relationOrtho" a layout with right angles, and "relationStraight" means a layout with straight lines.

Settings:

fullLayoutType: A string with one of two predefined values. "fullHierarchical" results in a hierarchical layout, and "fullSpring" in a spring-type layout.

fullUseFixedNodeDimensions: A boolean, used by the hierarchical layout. It says whether or not the layout is allowed to change object dimensions to reach a better distribution.

fullSubgraphMargin: An integer, used by the hierarchical layout. Specifies the margin applied around sub-graphs (islands laid out separately). The value must be in the range [20,1000].

fullInterLayerDistance: An integer, used by the hierarchical layout. Specifies the vertical distance kept between objects in different (ArchiMate®) layers. The value must be in the range [20,1000].

fullInterNodeDistance: An integer, used by the hierarchical layout. Specifies the distance kept between objects within the same layer. The value must be in the range [20,1000].

fullEdgeConstant: A real, used by the spring layout. A constant used to influence the length of relations. The value must be in the range [0.1,10.0].

<selectedObjects>

(Optional) A list of objects. A subset of reference objects, present on the view that is laid out. The standard auto-layout commands support this parameter only for relation layouts. The effect is the same as when a subset of relation references is selected in the view before the standard relation layout command is executed: only those relations will be subject to laying out. When used in conjunction with a full hierarchical or spring layout this parameter is ignored.


Calling this method will reposition the objects on the diagram, just as if the automatic layout command on the toolbar was activated.

The given request is optional. If it is not provided, the method performs the automatic layout command using default or user-specified settings. The default settings are as follows:

"layoutAction": "full"
"withSettingsDialog": false
"relationLayoutType": "relationPoly"
"fullLayoutType": "fullHierarchical"
"fullUseFixedNodeDimensions": true
"fullSubgraphMargin": 90
"fullInterLayerDistance": 170
"fullInterNodeDistance": 170
"fullEdgeConstant": 0.75


By calling canAutoLayoutDiagram with the same request structure as you intend to use with autoLayoutDiagram, you may determine beforehand whether or not the layout action is supported (for this specific view and selected objects).


ArchiMate® is a registered trademark of The Open Group.