当前位置: 首页>>代码示例>>C#>>正文


C# Link.InvalidateRelationships方法代码示例

本文整理汇总了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");
         }
       }
     }
   }
 }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:41,代码来源:PartManager.cs


注:本文中的Link.InvalidateRelationships方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。