本文整理汇总了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;
}
示例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();
}