本文整理汇总了C#中Diagram.AutoLayoutShapeElements方法的典型用法代码示例。如果您正苦于以下问题:C# Diagram.AutoLayoutShapeElements方法的具体用法?C# Diagram.AutoLayoutShapeElements怎么用?C# Diagram.AutoLayoutShapeElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Diagram
的用法示例。
在下文中一共展示了Diagram.AutoLayoutShapeElements方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AutoLayout
public static void AutoLayout(IList shapes, Diagram diagram)
{
var store = diagram.Store;
List<ShapeElement> shapeElementCollection = new List<ShapeElement>();
List<ShapeElement> elements = new List<ShapeElement>();
List<ShapeElement> list3 = new List<ShapeElement>();
foreach (ShapeElement element in shapes)
{
var condition1 = (element is ClassShape) && ((element as ClassShape).ModelElement != null);
bool condition2 = false;
if (element is ClassShape)
{
var modelClass = (element as ClassShape).ModelElement as ModelClass;
condition2 = modelClass.Baseclass != null || shapes.OfType<ClassShape>()
.Any(cs => (cs.ModelElement as ModelClass).Baseclass == modelClass);
}
if (condition1 && condition2)
{
elements.Add(element);
}
else
{
if (element is InheritanceConnector)
{
shapeElementCollection.Add(element);
continue;
}
list3.Add(element);
}
}
using (Transaction transaction = store.TransactionManager.BeginTransaction("AutoLayout"))
{
using (new SaveLayoutFlags(elements, VGNodeFixedStates.PermeablePlace | VGNodeFixedStates.FixedPlace))
{
diagram.AutoLayoutShapeElements(shapes, VGRoutingStyle.VGRouteNetwork, PlacementValueStyle.VGPlaceWE, false);
}
using (new SaveLayoutFlags(list3, VGNodeFixedStates.FixedPlace))
{
diagram.AutoLayoutShapeElements(shapes, VGRoutingStyle.VGRouteOrgChartNS, PlacementValueStyle.VGPlaceSN, false);
}
using (new SaveLayoutFlags(shapes, VGNodeFixedStates.FixedPlace))
{
diagram.AutoLayoutShapeElements(shapeElementCollection, VGRoutingStyle.VGRouteRightAngle, PlacementValueStyle.VGPlaceUndirected, false);
}
RunHandleLineRouting(diagram);
transaction.Commit();
}
}