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


C# Set.SelectMany方法代码示例

本文整理汇总了C#中Set.SelectMany方法的典型用法代码示例。如果您正苦于以下问题:C# Set.SelectMany方法的具体用法?C# Set.SelectMany怎么用?C# Set.SelectMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Set的用法示例。


在下文中一共展示了Set.SelectMany方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetObstaclesFromPassport

        Set<Shape> GetObstaclesFromPassport(Set<Shape> passport) {
            if (passport.Count == 0)
                return new Set<Shape>(root.Children);
            var commonAncestors = GetCommonAncestorsAbovePassport(passport);
            var allAncestors = GetAllAncestors(passport);
            var ret = new Set<Shape>(passport.SelectMany(p => p.Children.Where(child => !allAncestors.Contains(child))));
            var enqueued = new Set<Shape>(passport.Concat(ret));
            var queue = new Queue<Shape>();
            foreach (var shape in passport.Where(shape => !commonAncestors.Contains(shape)))
                queue.Enqueue(shape);

            while (queue.Count > 0) {
                var a = queue.Dequeue();
                foreach (var parent in a.Parents) {
                    foreach (var sibling in parent.Children)
                        if (!allAncestors.Contains(sibling))
                            ret.Insert(sibling);

                    if (!commonAncestors.Contains(parent) && !enqueued.Contains(parent)) {
                        queue.Enqueue(parent);
                        enqueued.Insert(parent);
                    }
                }
            }
            return ret;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:26,代码来源:SplineRouter.cs

示例2: RouteMultiEdges

 void RouteMultiEdges(List<Edge[]> multiEdges, InteractiveEdgeRouter interactiveEdgeRouter, Set<Shape> parents) {
     var mer = new MultiEdgeRouter(multiEdges, interactiveEdgeRouter, parents.SelectMany(p => p.Children).Select(s => s.BoundaryCurve), 
          new BundlingSettings { InkImportance = 0.00001, EdgeSeparation = MultiEdgesSeparation}, MakeTransparentShapesOfEdgeGeometryAndGetTheShapes);
     //giving more importance to ink might produce weird routings with huge detours, maybe 0 is the best value here
     mer.Run();
    
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:7,代码来源:SplineRouter.cs


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