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


C# Set.InsertRange方法代码示例

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


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

示例1: Relayout

        /// <summary>
        /// Recursively lay out the given clusters using the specified settings for each cluster, or if none is given for a particular
        /// cluster then inherit from the cluster's ancestor - or from the specifed defaultSettings.
        /// Clusters (other than the root) will be translated (together with their descendants) such that their 
        /// bottom-left point of their new boundaries are the same as the bottom-left of their old boundaries 
        /// (i.e. clusters are laid-out in place).
        /// </summary>
        /// <param name="graph">The graph being operated on.</param>
        /// <param name="modifiedNodes">The nodes whose bounds are modified.</param>
        /// <param name="addedNodes">Nodes added to the graph - a new initial position will be found for these nodes close to their neighbors</param>
        /// <param name="clusterSettings">Settings to use for each cluster.</param>
        public Relayout(GeometryGraph graph, IEnumerable<Node> modifiedNodes, IEnumerable<Node> addedNodes,
            Func<Cluster, LayoutAlgorithmSettings> clusterSettings) {
            ValidateArg.IsNotNull(graph, "graph");
            ValidateArg.IsNotNull(clusterSettings, "clusterSettings");
#if TEST_MSAGL
            graph.SetDebugIds();
#endif
            this.graph = graph;
            this.modifiedNodes = modifiedNodes;
            this.clusterSettings = clusterSettings;
            ancestorsOfModifiedNodes =
                new Set<Cluster>(modifiedNodes.SelectMany(v => v.AllClusterAncestors));
            if (addedNodes == null) return;
        
            foreach (var v in addedNodes)
                CreateOrGetAddedChildrenOfParent(v.ClusterParents.First()).Add(v);
            ancestorsOfModifiedNodes.InsertRange(addedNodes.SelectMany(v => v.AllClusterAncestors));
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:29,代码来源:Relayout.cs

示例2: HasCycles

        internal bool HasCycles(Point rootPoint) {
            var visited = new Set<Point>();
            var parent = new Dictionary<Point, Point>();

            var rp = AddVisGraphVertex(rootPoint);
            visited.Insert(rp);
            parent[rp] = rp;

            var queue = new List<Point> {rp};

            while (queue.Any()) {
                var p = queue.First();
                queue.Remove(p);

                var v = _visGraph.FindVertex(p);
                var neighb = new Set<Point>();
                neighb.InsertRange(v.OutEdges.Select(e => e.TargetPoint));
                neighb.InsertRange(v.InEdges.Select(e => e.SourcePoint));
                neighb.Remove(parent[p]);

                foreach (var q in neighb) {
                    parent[q] = p;
                    if (visited.Contains(q)) return true;
                    visited.Insert(q);
                    queue.Add(q);
                }
            }

            return false;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:30,代码来源:LgPathRouter.cs

示例3: GetRailsThatShouldBeHighlighted

 Set<Rail> GetRailsThatShouldBeHighlighted(LgLevel level, Set<Edge> edgesToPutOff) {
     var ret = new Set<Rail>();
     foreach (var edge in SelectedEdges) {
         if (edgesToPutOff.Contains(edge)) continue;
         Set<Rail> railsOfEdge;
         if (level._railsOfEdges.TryGetValue(edge, out railsOfEdge)) {
             ret.InsertRange(railsOfEdge);
         }
     }
     return ret;
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:11,代码来源:LgData.cs

示例4: GetRailsOfEdgeOnLevel

        public Set<Rail> GetRailsOfEdgeOnLevel(int i, Edge edge)
        {
            var level = _levels[i];
            var railsToHighlight = new Set<Rail>();

            Set<Rail> railsOfEdge;
            if (level._railsOfEdges.TryGetValue(edge, out railsOfEdge))
            {
                railsToHighlight.InsertRange(railsOfEdge);
            }
            //else
            //{
            //    var edgeInfo = GeometryEdgesToLgEdgeInfos[edge];
            //    int edgeLevelIndex = (int)Math.Min(Math.Log(edgeInfo.ZoomLevel, 2), levels.Count - 1);
            //    railsOfEdge = levels[edgeLevelIndex]._railsOfEdges[edge];
            //    TransferHighlightedRails(level, edge, railsOfEdge); // roman: todo: necessary?
            //}

            return railsToHighlight;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:20,代码来源:LgData.cs

示例5: GetRailsOfEdgesOnLevel

 /// <summary>
 /// gets all rails corresponding to edges on given level.
 /// </summary>
 /// <param name="i"></param>
 /// <param name="edges"></param>
 /// <returns></returns>
 public Set<Rail> GetRailsOfEdgesOnLevel(int i, List<Edge> edges)
 {
     var level = _levels[i];
     var railsToHighlight = new Set<Rail>();
     foreach (var edge in edges)
     {
         Set<Rail> railsOfEdge;
         if (!level._railsOfEdges.TryGetValue(edge, out railsOfEdge))
         {
             var edgeInfo = GeometryEdgesToLgEdgeInfos[edge];
             int edgeLevelIndex = (int)Math.Min(Math.Log(edgeInfo.ZoomLevel, 2), _levels.Count - 1);
             railsOfEdge = _levels[edgeLevelIndex]._railsOfEdges[edge];
             TransferHighlightedRails(level, edge, railsOfEdge); // roman: todo: necessary?
         }
         else
             railsToHighlight.InsertRange(railsOfEdge);
     }
     return railsToHighlight;
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:25,代码来源:LgData.cs

示例6: SelectEdgesOnLevel

        void SelectEdgesOnLevel(int i, List<Edge> edges) {
            var level = _levels[i];
            var railsToHighlight = new Set<Rail>();
            foreach (var edge in edges) {
                Set<Rail> railsOfEdge;
                if (!level._railsOfEdges.TryGetValue(edge, out railsOfEdge)) {
                    var edgeInfo = GeometryEdgesToLgEdgeInfos[edge];
                    int edgeLevelIndex = (int)Math.Min( Math.Log(edgeInfo.ZoomLevel, 2), _levels.Count - 1);
                    railsOfEdge = _levels[edgeLevelIndex]._railsOfEdges[edge];
                    TransferHighlightedRails(level, edge, railsOfEdge);
                }
                else
                    railsToHighlight.InsertRange(railsOfEdge);
            }
            //need to analyze and highlight the new highlighted rails
            foreach (var rail in railsToHighlight) {
                if (!level.HighlightedRails.Contains(rail)) {
                    rail.IsHighlighted = true;
                    level.HighlightedRails.Insert(rail);
                }
            }

        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:23,代码来源:LgData.cs

示例7: TestTriangles

 void TestTriangles() {
     var usedSites = new Set<CdtSite>();
     foreach(var t in Triangles)
         usedSites.InsertRange(t.Sites);
     foreach (var triangle in Triangles) {
         TestTriangle(triangle, usedSites);
     }
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:8,代码来源:CdtSweeper.cs

示例8: AddOrphanNodesToRootCluster

 static void AddOrphanNodesToRootCluster(GeometryGraph geometryGraph) {
     var clusterNodeSet = new Set<Node>();
     foreach(var cl in geometryGraph.RootCluster.AllClustersDepthFirst())
         clusterNodeSet.InsertRange(cl.Nodes);
     foreach (var node in geometryGraph.Nodes) {
         if (clusterNodeSet.Contains(node)) continue;
         geometryGraph.RootCluster.AddNode(node);
     }
 }
开发者ID:WenzCao,项目名称:automatic-graph-layout,代码行数:9,代码来源:LayoutHelpers.cs

示例9: EdgePassport

        /// <summary>
        ///  The set of shapes where the edgeGeometry source and target ports shapes are citizens.
        ///  In the simple case it is the union of the target port shape parents and the sourceport shape parents.
        ///  When one end shape contains another, the passport is the set consisting of the end shape and all other shape parents.
        /// </summary>
        /// <param name="edge"></param>
        /// <returns></returns>
        Set<Shape> EdgePassport(Edge edge) {
            EdgeGeometry edgeGeometry = edge.EdgeGeometry;
            var ret = new Set<Shape>();
            var sourceShape = portsToShapes[edgeGeometry.SourcePort];
            var targetShape = portsToShapes[edgeGeometry.TargetPort];

            if (IsAncestor(sourceShape, targetShape)) {
                ret.InsertRange(targetShape.Parents);
                ret.Insert(sourceShape);
                return ret;
            }
            if (IsAncestor(targetShape, sourceShape)) {
                ret.InsertRange(sourceShape.Parents);
                ret.Insert(targetShape);
                return ret;
            }

            if (sourceShape != looseRoot)
                ret.InsertRange(sourceShape.Parents);

            if (targetShape != looseRoot)
                ret.InsertRange(targetShape.Parents);

            return ret;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:32,代码来源:SplineRouter.cs

示例10: GetEdgeEnterablePolylines

        void GetEdgeEnterablePolylines(EdgeGeometry edgeGeometry, out Set<Polyline> looseEnterable, 
            out Set<Polyline> tightEnterable) {
            looseEnterable = new Set<Polyline>();
            tightEnterable = new Set<Polyline>();
            var sourceShape = portsToShapes[edgeGeometry.SourcePort];
            var targetShape = portsToShapes[edgeGeometry.TargetPort];

            if (sourceShape != root) {
                looseEnterable.InsertRange(ancestorSets[sourceShape].Select(LoosePolyOfOriginalShape).Where(p => p != null));
                tightEnterable.InsertRange(ancestorSets[sourceShape].Select(TightPolyOfOriginalShape).Where(p => p != null));
            }

            if (targetShape != root) {
                looseEnterable.InsertRange(ancestorSets[targetShape].Select(LoosePolyOfOriginalShape).Where(p => p != null));
                tightEnterable.InsertRange(ancestorSets[targetShape].Select(TightPolyOfOriginalShape).Where(p => p != null));
            }
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:17,代码来源:SplineRouter.cs

示例11: GetPointsOnSavedTrajectories

 internal Set<Point> GetPointsOnSavedTrajectories() {
     var points = new Set<Point>();
     foreach (var edgeTrajectory in _edgeTrajectories.Values) {
         points.InsertRange(edgeTrajectory);
     }
     return points;
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:7,代码来源:LgSkeletonLevel.cs


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