As promised, we have made the necessary changes fo the AI to make use of the LayoutStyle parameter in the Project.LayoutDiagram() method.
Using this parameter, one can pass in all relevant layout options as would be found in the Diagram Properties->Set Layout Style dialog box using the constants defined in ConstLayoutStyles.
An example use of these parameters is shown below as a VB Function:
Private Function LayoutDiagram _
(ByRef oProj As EA.Project, _
ByVal sDiagramGUID As String) As Boolean
Dim lLayoutStyle As Long
If sDiagramGUID = "" Then
LayoutDiagram = False
Exit Function
End If
' Set some styles using ConstLayoutStyles values
' Depth First Search Cycle Removal, Optimal Link Length Layering
' Naive Initialize, Default Spacing, Up Layout Direction
' Aggressive crossing reduction (8 iterations)
lLayoutStyle = ConstLayoutStyles.lsCycleRemoveDFS Or _
ConstLayoutStyles.lsLayeringOptimalLinkLength Or _
ConstLayoutStyles.lsInitializeNaive Or _
ConstLayoutStyles.lsCrossReduceAggressive Or _
ConstLayoutStyles.lsLayoutDirectionDown Or _
ConstLayoutStyles.lsCrossReduceIteration Or _
CByte(8)
LayoutDiagram = oProj.LayoutDiagram(sDiagramGUID, lLayoutStyle)
End Function
A couple of points to be aware of:
- Using ConstLayoutStyles.lsDiagramDefault will layout the given diagram using the layout styles defined for it
- ConstLayoutStyles.lsProgramDefault will layout the given diagram using EA's layout defaults
- The three layout options requiring numerical values to be set are not mutually exclusive - ie: you can only set one numerical value to the parameter to define Layer Spacing, Column Spacing or the Cross Reduce Iterations values - this will be rectified in a later release of EA.
Hope this change proves useful for you in the meantime!
Best Regards
Sam Mancarella - Sparx Systems[/list]