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


C# Canguro.RestoreSelection方法代码示例

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


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

示例1: Run

        public override void Run(Canguro.Controller.CommandServices services)
        {
            services.StoreSelection();
            LineElement line = services.GetLine();
            List<LinkedList<LineElement>> graph = GetLineGraph(services.Model);
            ItemList<Joint> joints = services.Model.JointList;
            int numJoints = joints.Count;
            bool[] colors = new bool[numJoints];

            Stack<LineElement> stack = new Stack<LineElement>();
            stack.Push(line);
            while (stack.Count > 0)
            {
                line = stack.Pop();
                line.IsSelected = true;
                if (!colors[line.I.Id])
                {
                    line.I.IsSelected = true;
                    visit(graph, (int)line.I.Id, stack, line);
                    colors[line.I.Id] = true;
                }
                if (!colors[line.J.Id])
                {
                    line.J.IsSelected = true;
                    visit(graph, (int)line.J.Id, stack, line);
                    colors[line.J.Id] = true;
                }
            }

            services.RestoreSelection();

            services.Model.ChangeSelection(null);
        }
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:33,代码来源:SelectLineCmd.cs

示例2: Run

        /// <summary>
        /// Executes the command. 
        /// Adds a new Layer with the given Name and sets it as Active.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            services.StoreSelection();
            string name = services.GetString(Culture.Get("setLayerName"));
            string aux = name;
            bool valid = false;
            int i = 1;
            while (!valid)
            {
                valid = true;
                foreach (Layer l in services.Model.Layers)
                    if (l != null && l.Name.Equals(aux))
                        valid = false;
                if (!valid)
                    aux = name + "(" + i++ + ")";
            }
            Layer layer = new Layer(aux);
            services.Model.Layers.Add(layer);
            services.Model.ActiveLayer = layer;

            services.RestoreSelection();
        }
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:27,代码来源:AddLayerCmd.cs


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