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


C# Int32Collection.RemoveAt方法代码示例

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


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

示例1: TriangleSubdivide

        /// <summary>
        /// 
        /// </summary>
        /// <param name="vertices"></param>
        /// <param name="normals"></param>
        /// <param name="indices"></param>
        /// <param name="textures"></param>
        protected void TriangleSubdivide(Point3DCollection vertices,
                                         Vector3DCollection normals,
                                         Int32Collection indices,
                                         PointCollection textures)
        {
            for (int i = 0; i < 3; i++)
            {
                verticesBase[2 - i] = vertices[vertices.Count - 1];
                normalsBase[2 - i] = normals[vertices.Count - 1];
                texturesBase[2 - i] = textures[vertices.Count - 1];

                vertices.RemoveAt(vertices.Count - 1);
                normals.RemoveAt(normals.Count - 1);
                indices.RemoveAt(indices.Count - 1);
                textures.RemoveAt(textures.Count - 1);
            }

            int indexStart = vertices.Count;

            for (int slice = 0; slice <= Slices; slice++)
            {
                double weight = (double)slice / Slices;

                Point3D vertex1 = Point3DWeight(verticesBase[0], verticesBase[1], weight);
                Point3D vertex2 = Point3DWeight(verticesBase[0], verticesBase[2], weight);

                Vector3D normal1 = Vector3DWeight(normalsBase[0], normalsBase[1], weight);
                Vector3D normal2 = Vector3DWeight(normalsBase[0], normalsBase[2], weight);

                Point texture1 = PointWeight(texturesBase[0], texturesBase[1], weight);
                Point texture2 = PointWeight(texturesBase[0], texturesBase[2], weight);

                for (int i = 0; i <= slice; i++)
                {
                    weight = (double)i / slice;

                    if (Double.IsNaN(weight))
                        weight = 0;

                    vertices.Add(Point3DWeight(vertex1, vertex2, weight));
                    normals.Add(Vector3DWeight(normal1, normal2, weight));
                    textures.Add(PointWeight(texture1, texture2, weight));
                }
            }

            for (int slice = 0; slice < Slices; slice++)
            {
                int base1 = (slice + 1) * slice / 2;
                int base2 = base1 + slice + 1;

                for (int i = 0; i <= 2 * slice; i++)
                {
                    int half = i / 2;

                    if ((i & 1) == 0)         // even
                    {
                        indices.Add(indexStart + base1 + half);
                        indices.Add(indexStart + base2 + half);
                        indices.Add(indexStart + base2 + half + 1);
                    }
                    else                    // odd
                    {
                        indices.Add(indexStart + base1 + half);
                        indices.Add(indexStart + base2 + half + 1);
                        indices.Add(indexStart + base1 + half + 1);
                    }
                }
            }
        }
开发者ID:samlcharreyron,项目名称:PedestrianTracker,代码行数:76,代码来源:FlatSurfaceMeshBase.cs

示例2: showMove

        private void showMove(object target, ExecutedRoutedEventArgs e)
        {
            CopyDialog dlg = new CopyDialog();
            dlg.Owner = this;
            if (dlg.ShowDialog() == true)
            {
                string backupDB = dlg.txtDB.Text;

                if (txtDatabase.Text == backupDB)
                {
                    System.Windows.MessageBox.Show(this, "Refusing to copy to the same database.", "Error",
                                                    System.Windows.MessageBoxButton.OK,
                                                    System.Windows.MessageBoxImage.Error);
                    return;
                }

                Int32Collection jobIDs = new Int32Collection();
                IEnumerator den = dataGrid.SelectedItems.GetEnumerator();
                while (den.MoveNext())
                {
                    DataRowView x = (DataRowView)den.Current;
                    jobIDs.Add((int)x["ID"]);
                }

                Submission sdlg = null;

                do
                {
                    Int32Collection subset = null;
                    if (jobIDs.Count > 20)
                    {
                        subset = new Int32Collection();
                        for (int i = 0; i < 20; i++)
                        {
                            subset.Add(jobIDs[0]);
                            jobIDs.RemoveAt(0);
                        }
                    }
                    else
                    {
                        subset = new Int32Collection(jobIDs);
                        jobIDs.Clear();
                    }

                    sdlg = new Submission(txtDatabase.Text, backupDB, subset, true /* move */);
                    sdlg.Owner = this;
                    sdlg.ShowDialog();
                }
                while (jobIDs.Count > 0 && sdlg.lastError == null);

                if (sdlg.lastError != null)
                    System.Windows.MessageBox.Show(this, sdlg.lastError.Message, "Error",
                    System.Windows.MessageBoxButton.OK,
                    System.Windows.MessageBoxImage.Error);
            }
        }
开发者ID:ExiaHan,项目名称:z3test,代码行数:56,代码来源:MainWindow.xaml.cs


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