當前位置: 首頁>>代碼示例>>C#>>正文


C# Canguro.StoreSelection方法代碼示例

本文整理匯總了C#中Canguro.StoreSelection方法的典型用法代碼示例。如果您正苦於以下問題:C# Canguro.StoreSelection方法的具體用法?C# Canguro.StoreSelection怎麽用?C# Canguro.StoreSelection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Canguro的用法示例。


在下文中一共展示了Canguro.StoreSelection方法的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.StoreSelection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。