本文整理汇总了C#中Link.InvalidateRelationships方法的典型用法代码示例。如果您正苦于以下问题:C# Link.InvalidateRelationships方法的具体用法?C# Link.InvalidateRelationships怎么用?C# Link.InvalidateRelationships使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Link
的用法示例。
在下文中一共展示了Link.InvalidateRelationships方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateLinkBundleRemove
private void UpdateLinkBundleRemove(Link link) {
if (link == null) return;
// see if there's an existing LinkBundle for this link
LinkBundle bundle = link.Bundle;
if (bundle != null) {
int oldindex = link.BundleIndex;
link.Bundle = null;
link.BundleIndex = 0;
link.InvalidateRelationships("curviness");
bundle.Links.Remove(link);
// if one or none left, remove the LinkBundle from both nodes
if (bundle.Links.Count < 2) {
// if there's only one link left in the LinkBundle, assume it shouldn't have one at all
if (bundle.Links.Count == 1) {
Link otherlink = bundle.Links[0];
otherlink.Bundle = null;
otherlink.BundleIndex = 0;
otherlink.InvalidateRelationships("curviness");
}
bundle.Node1.RemoveBundle(bundle);
bundle.Node2.RemoveBundle(bundle);
} else { // two or more links left in bundle
// oldindex value no longer used: shift down BundleIndex values > oldindex, ignoring sign,
// if they are on the same side as oldindex (i.e., if even, all even BundleIndexes that are larger than oldindex)
oldindex = Math.Abs(oldindex);
bool even = oldindex%2 == 0;
foreach (Link l in bundle.Links) {
int idx = Math.Abs(l.BundleIndex);
bool e = idx%2 == 0;
if (idx > oldindex && even == e) {
if (l.BundleIndex > 0) {
l.BundleIndex -= 2;
} else {
l.BundleIndex += 2;
}
l.InvalidateRelationships("curviness");
}
}
}
}
}