本文整理汇总了C#中DomNode.UpdateGroupPinInfo方法的典型用法代码示例。如果您正苦于以下问题:C# DomNode.UpdateGroupPinInfo方法的具体用法?C# DomNode.UpdateGroupPinInfo怎么用?C# DomNode.UpdateGroupPinInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DomNode
的用法示例。
在下文中一共展示了DomNode.UpdateGroupPinInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateGroup
private void CreateGroup(ISelectionContext selectionContext, ViewingContext viewingContext)
{
// build the group
var newGroup = new DomNode(GroupType).As<Group>();
newGroup.DefaultPinOrder = DefaultPinOrderStyle;
newGroup.DomNode.Type.SetTag<ICircuitElementType>(newGroup);
newGroup.Id = "Group".Localize("a noun");
newGroup.Name = newGroup.Id;
newGroup.ShowExpandedGroupPins = CircuitDefaultStyle.ShowExpandedGroupPins;
var selected = selectionContext.LastSelected.As<DomNode>();
var doc = selected.GetRoot().Cast<DomDocument>();
var subGraphValidator = doc.Cast<CircuitValidator>();
subGraphValidator.Suspended = true;
var circuitEditingContext = selected.Parent.Cast<CircuitEditingContext>();
// Place the circuit group before the elements get repositioned to the group's local coordinate system.
if (Placement == PlacementMode.Center)
{
// position it at center of grouped modules
Rectangle bounds = viewingContext.GetBounds(selectionContext.Selection.AsIEnumerable<Element>());
circuitEditingContext.Center(new object[] { newGroup }, new Point(
bounds.X + bounds.Width / 2,
bounds.Y + bounds.Height / 2));
}
else
{
// find upper-left corner of the subnodes
Point minLocation = new Point(int.MaxValue, int.MaxValue);
foreach (var module in selectionContext.Selection.AsIEnumerable<Element>())
{
if (minLocation.X > module.Bounds.Location.X)
minLocation.X = module.Bounds.Location.X;
if (minLocation.Y > module.Bounds.Location.Y)
minLocation.Y = module.Bounds.Location.Y;
}
// position it at upper-left conner of grouped modules
newGroup.Bounds = new Rectangle(minLocation.X, minLocation.Y, newGroup.Bounds.Width, newGroup.Bounds.Height);
newGroup.Position = newGroup.Bounds.Location;
}
CreateGroup(newGroup, selectionContext.Selection, circuitEditingContext.CircuitContainer);
if (CreationOptions == GroupCreationOptions.HideUnconnectedPins)
{
newGroup.UpdateGroupPinInfo();
foreach (var grpPin in newGroup.InputGroupPins)
grpPin.Visible = grpPin.Info.ExternalConnected;
foreach (var grpPin in newGroup.OutputGroupPins)
grpPin.Visible = grpPin.Info.ExternalConnected;
}
// select the newly created group
circuitEditingContext.Selection.Set(newGroup);
subGraphValidator.Suspended = false;
}