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


C# PointCollection.Add方法代碼示例

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


在下文中一共展示了PointCollection.Add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ProcessFigure

        protected override void ProcessFigure(CircularList<Point> list,
                                              Point3DCollection vertices,
                                              Vector3DCollection normals,
                                              Int32Collection indices, 
                                              PointCollection textures)
        {
            int offset = vertices.Count;

            for (int i = 0; i <= list.Count; i++)
            {
                Point pt = list[i];

                // Set vertices.
                vertices.Add(new Point3D(pt.X, pt.Y, 0));
                vertices.Add(new Point3D(pt.X, pt.Y, -Depth));

                // Set texture coordinates.
                textures.Add(new Point((double)i / list.Count, 0));
                textures.Add(new Point((double)i / list.Count, 1));

                // Set triangle indices.
                if (i < list.Count)
                {
                    indices.Add(offset + i * 2 + 0);
                    indices.Add(offset + i * 2 + 2);
                    indices.Add(offset + i * 2 + 1);

                    indices.Add(offset + i * 2 + 1);
                    indices.Add(offset + i * 2 + 2);
                    indices.Add(offset + i * 2 + 3);
                }
            }
        }
開發者ID:tianweidut,項目名稱:3DMap,代碼行數:33,代碼來源:RibbonText.cs

示例2: LayoutRoot_MouseLeftButtonUp

 private void LayoutRoot_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     PointCollection points = new PointCollection();
     foreach (Point p in poly.Points)
         points.Add(p);
     Point newPoint = e.GetPosition(poly);
     points.Add(newPoint);
     poly.Points = points;
     // placeholder
     Ellipse ph = new Ellipse
     {
         Fill = new SolidColorBrush(Colors.Black),
         Width = 4D,
         Height = 4D
     };
     TranslateTransform t = new TranslateTransform { X = newPoint.X - 2D, Y = newPoint.Y - 2D };
     ph.RenderTransform = t;
     cnv.Children.Add(ph);
     //
     TextBlock tb = new TextBlock
     {
         Foreground = new SolidColorBrush(Colors.Gray),
         FontSize = 8
     };
     tb.Text = newPoint.ToString();
     tb.RenderTransform = t;
     cnv.Children.Add(tb);
 }
開發者ID:dsummerfield,項目名稱:ctaggart-hg.examples100,代碼行數:28,代碼來源:Euclidean.xaml.cs

示例3: Terrain3D

 static Terrain3D()
 {
     {
     SX = new double[17];
     SZ = new double[17];
     int i = 0;
     for (double d = 0; d < 2; d += 0.125)
     {
       i++;
       SX[i] = Math.Cos(Math.PI * d);
       SZ[i] = Math.Sin(Math.PI * d);
     }
       }
       {
     TEXTURE_COORDINATES = new PointCollection(17);
     TEXTURE_COORDINATES.Add(new Point(0, 0));
     Point p = new Point(1, 0);
     int i = -1;
     while (++i < 16) TEXTURE_COORDINATES.Add(p);
     TEXTURE_COORDINATES.Freeze();
       }
       {
     TRIANGLE_INDICES = new Int32Collection(48);
     for (int i = 1; i < 16; i++)
     {
       TRIANGLE_INDICES.Add(0);
       TRIANGLE_INDICES.Add(i + 1);
       TRIANGLE_INDICES.Add(i);
     }
     TRIANGLE_INDICES.Add(0);
     TRIANGLE_INDICES.Add(1);
     TRIANGLE_INDICES.Add(16);
     TRIANGLE_INDICES.Freeze();
       }
 }
開發者ID:sunoru,項目名稱:PBO,代碼行數:35,代碼來源:Terrain.cs

示例4: Convert

        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            var polygonPoints = new PointCollection();
            if (values.Length == 3 && values[2] is Thickness)
            {
                var width = System.Convert.ToDouble(values[0]);
                var height = System.Convert.ToDouble(values[1]);
                var margin = (Thickness)values[2];

                if (System.Convert.ToInt32(parameter) == 0)
                {
                    polygonPoints.Add(new Point(0 + margin.Left, height - margin.Bottom));
                    polygonPoints.Add(new Point(0, height));
                    polygonPoints.Add(new Point(0, 0));
                    polygonPoints.Add(new Point(width, 0));
                    polygonPoints.Add(new Point(width - margin.Right, 0 + margin.Top));
                }
                else
                {
                    polygonPoints.Add(new Point(0 + margin.Left, height - margin.Bottom));
                    polygonPoints.Add(new Point(0, height));
                    polygonPoints.Add(new Point(width, height));
                    polygonPoints.Add(new Point(width, 0));
                    polygonPoints.Add(new Point(width - margin.Right, 0 + margin.Top));
                }
            }
            return polygonPoints;
        }
開發者ID:latish,項目名稱:WpfBevelBorder,代碼行數:28,代碼來源:PolygonPointsConverter.cs

示例5: CreateGeometry

        void CreateGeometry()
        {

            double r = Diameter / 2;
            double l = HeadLength * Diameter;

            // arrowhead
            var pc = new PointCollection();
            pc.Add(new Point(-l, r));
            pc.Add(new Point(-l, r * 2));
            pc.Add(new Point(0, 0));

            var headBuilder = new MeshBuilder();
            headBuilder.AddRevolvedGeometry(pc, new Point3D(0, 0, 0), new Vector3D(0, 0, 1), ThetaDiv);
            _head = headBuilder.ToMesh();
            _head.Freeze(); 
            

            // body
            pc = new PointCollection();
            pc.Add(new Point(0, 0));
            pc.Add(new Point(0, r));
            pc.Add(new Point(1, r));

            var bodyBuilder = new MeshBuilder();
            bodyBuilder.AddRevolvedGeometry(pc, new Point3D(0, 0, 0), new Vector3D(0, 0, 1), ThetaDiv);
            _body = bodyBuilder.ToMesh();
            _body.Freeze();
        }
開發者ID:XiBeichuan,項目名稱:hydronumerics,代碼行數:29,代碼來源:VectorFieldVisual3D.cs

示例6: AddCircleInZCross

        private static void AddCircleInZCross(MeshBuilder mb, Point3D centre, double radius, int div)
        {
            var points = MeshBuilder.GetCircle(div);

            var vectors = new Point3DCollection();
            var normals = new Vector3DCollection();
            var textures = new PointCollection();

            vectors.Add(new Point3D(centre.X, centre.Y, 0));
            normals.Add(new Vector3D(0, 0, 1));
            textures.Add(new Point(0.5, 0.5));

            for (int i = 0; i < points.Count - 1; i++)
            {
                vectors.Add(new Point3D(points[i].X * radius + centre.X, points[i].Y * radius + centre.Y, centre.Z));
                normals.Add(new Vector3D(0, 0, -1));
                textures.Add(new Point(points[i].X * 0.5 + 0.5, points[i].Y * 0.5 + 0.5));

                vectors.Add(new Point3D(points[i + 1].X * radius + centre.X, points[i + 1].Y * radius + centre.Y, centre.Z));
                normals.Add(new Vector3D(0, 0, 01));
                textures.Add(new Point(points[i + 1].X * 0.5 + 0.5, points[i + 1].Y * 0.5 + 0.5));
            }

            mb.AddTriangleFan(vectors, normals, textures);
        }
開發者ID:woodxiang,項目名稱:WpfApplication2,代碼行數:25,代碼來源:TestModelVisual3D.cs

示例7: CreateRectangle

        public static MeshGeometry3D CreateRectangle(double height, double width)
        {
            var vertices = new Point3DCollection();
            var normals = new Vector3DCollection();
            var facets = new Int32Collection();
            var textureCoords = new PointCollection();
            vertices.Add(new Point3D(-width / 2, 0, -height / 2));
            vertices.Add(new Point3D(-width / 2, 0, height / 2));
            vertices.Add(new Point3D(width / 2, 0, -height / 2));
            vertices.Add(new Point3D(width / 2, 0, height / 2));

            normals.Add(new Vector3D(0, -1, 0));
            normals.Add(new Vector3D(0, -1, 0));
            normals.Add(new Vector3D(0, -1, 0));
            normals.Add(new Vector3D(0, -1, 0));

            textureCoords.Add(new Point(1,1));
            textureCoords.Add(new Point(1, 0));
            textureCoords.Add(new Point(0,1));
            textureCoords.Add(new Point(0,0));

            facets.Add(0); facets.Add(1); facets.Add(2); facets.Add(3); facets.Add(2); facets.Add(1);
            var rectangle = new MeshGeometry3D();
            rectangle.Positions = vertices;
            rectangle.Normals = normals;
            rectangle.TriangleIndices = facets;
            rectangle.TextureCoordinates = textureCoords;
            return rectangle;
        }
開發者ID:MathiasBrannstrom,項目名稱:SoundToColor,代碼行數:29,代碼來源:SimpleGeometry3D.cs

示例8: LineToolBox

 public LineToolBox()
 {
     InitializeComponent();
     PointCollection points = new PointCollection();
     points.Add(new Point(5, 5));          
     points.Add(new Point(65, 5));
     this.plShadow.Points = points;
     this.ShowMe(points);
 }
開發者ID:JuRogn,項目名稱:OA,代碼行數:9,代碼來源:LineToolBox.xaml.cs

示例9: Normalize

		public static PointCollection Normalize(Rect rectangle, double thickness)
		{
			double shift = thickness / 2;
			var pointCollection = new PointCollection();
			pointCollection.Add(new Point(shift, shift));
			pointCollection.Add(new Point(rectangle.Width + shift, shift));
			pointCollection.Add(new Point(rectangle.Width + shift, rectangle.Height + shift));
			pointCollection.Add(new Point(shift, rectangle.Height + shift));
			return pointCollection;
		}
開發者ID:saeednazari,項目名稱:Rubezh,代碼行數:10,代碼來源:PainterHelper.cs

示例10: LineShape

 public LineShape()
 {
     InitializeComponent();
     PointCollection points = new PointCollection();
     points.Add(new Point(5, 5));
     points.Add(new Point(65, 5));
     plShadow.Points = points;
     ShowMe(points);
     SetFocus();
 }
開發者ID:JuRogn,項目名稱:OA,代碼行數:10,代碼來源:LineShape.xaml.cs

示例11: AsFace

        /// <summary>
        /// Return a point collection of the specified point in the List of Tuples
        /// and the next point, for a single face of the hexagon
        /// </summary>
        public static PointCollection AsFace(this List<Tuple<double, double>> verticies, int startingPoint)
        {
            var pointCollection = new PointCollection(2);

            var vertex1 = verticies[startingPoint];
            var vertex2 = startingPoint == 5 ? verticies[0] : verticies[startingPoint + 1];

            pointCollection.Add(vertex1.AsPoint());
            pointCollection.Add(vertex2.AsPoint());

            return pointCollection;
        }
開發者ID:JamesTStanley,項目名稱:Hex,代碼行數:16,代碼來源:ExtensionMethods.cs

示例12: DrawTile

        public static void DrawTile(int x, int y, int tileWidth, int tileHeight, Tile tile)
        {
            var mainWindowInstant = (MainWindow)App.Current.MainWindow;
            Polygon myPolygon = new Polygon();
            myPolygon.Stroke = System.Windows.Media.Brushes.Black;
            myPolygon.Fill = getColor(tile);
            myPolygon.StrokeThickness = 2;
            myPolygon.HorizontalAlignment = HorizontalAlignment.Left;
            myPolygon.VerticalAlignment = VerticalAlignment.Center;


            PointCollection points = new PointCollection();

            Point topCord = getPointTilePoint(x, y, tileWidth, tileHeight);
            points.Add(topCord);
            Point rightCord = getPointTilePoint(x + 1, y, tileWidth, tileHeight);
            points.Add(rightCord);
            Point botCord = getPointTilePoint(x + 1, y + 1, tileWidth, tileHeight);
            points.Add(botCord);
            Point leftCord = getPointTilePoint(x, y + 1, tileWidth, tileHeight);
            points.Add(leftCord);

            myPolygon.Points = points;

            //int screenX = (x - y) * tileWidth / 2 ;
            //int screenY = (x + y) * tileHeight / 2;

            //int pointX;
            //int pointY;

            //Point p = new Point(screenX, screenY);
            //points.Add(p);

            //pointX = screenX + Convert.ToInt32((tileWidth / 2));
            //pointY = Convert.ToInt32(screenY + (tileHeight / 2));

            //p = new Point(pointX, pointY);
            //points.Add(p);

            //pointX = screenX;
            //pointY = screenY + tileHeight;

            //p = new Point(pointX, pointY);
            //points.Add(p);

            //pointX = Convert.ToInt32(screenX - (tileWidth / 2));
            //pointY = Convert.ToInt32(screenY + (tileHeight / 2));

            //p = new Point(pointX, pointY);
            //points.Add(p);

            mainWindowInstant.drawingCanvas.Children.Add(myPolygon);
        }
開發者ID:Drabzes,項目名稱:TileTest,代碼行數:53,代碼來源:DrawingTile.cs

示例13: get3DWalls

        /// <summary>
        /// This method returns a 3D representation of this building walls
        /// </summary>
        /// <param name="nodesDict">List of all the nodes on the map</param>
        /// <param name="map">bounds of the map</param>
        /// <param name="brush">Color of these walls</param>
        /// <returns>ModelUIElement3D of these walls</returns>
        public ModelUIElement3D get3DWalls(Dictionary<long, OsmSharp.Osm.Node> nodesDict, Map map, ImageBrush brush)
        {
            // Surrounding tags of the mesh
            ModelUIElement3D model = new ModelUIElement3D();
            GeometryModel3D geometryModel = new GeometryModel3D();

            // Mesh and his his properties
            MeshGeometry3D mesh = new MeshGeometry3D();
            DiffuseMaterial material = new DiffuseMaterial((System.Windows.Media.Brush)brush);
            Point3DCollection positions = new Point3DCollection();
            PointCollection texturePoints = new PointCollection();
            Int32Collection indices = new Int32Collection();

            // Add Points of surface and with add points of surface with height 0
            positions = getScaledPositionsWall(nodesDict, map);

            // Add indices to the collection
            for (int i = 0; i < positions.Count - 2; i += 2) {
                indices.Add(i);
                indices.Add(i + 2);
                indices.Add(i + 1);
                indices.Add(i + 3);
                indices.Add(i + 1);
                indices.Add(i + 2);

                // Get the width and height of a wall
                float widthWall = (float)Math.Sqrt(Math.Pow(positions[i].X - positions[i + 2].X, 2) + Math.Pow(positions[i].Y - positions[i + 2].Y, 2));
                int imageWidth = (int)(brush.ImageSource.Width * widthWall);
                int imageHeight = (int)(brush.ImageSource.Height * height);

                // Add texture coordinates
                texturePoints.Add(new System.Windows.Point(0, imageHeight));
                texturePoints.Add(new System.Windows.Point(0, 0));
                texturePoints.Add(new System.Windows.Point(imageWidth, imageHeight));
                texturePoints.Add(new System.Windows.Point(imageWidth, 0));
            }

            // Add these collections to the mesh
            mesh.Positions = positions;
            mesh.TriangleIndices = indices;
            mesh.TextureCoordinates = texturePoints;

            // Set the color of front and back of the triangle
            geometryModel.Material = material;
            geometryModel.BackMaterial = material;

            // Add the mesh to the model
            geometryModel.Geometry = mesh;
            model.Model = geometryModel;

            return model;
        }
開發者ID:whztt07,項目名稱:Osm3DBuildingGenerator,代碼行數:59,代碼來源:Building.cs

示例14: Button3_Click

 private void Button3_Click(object sender, RoutedEventArgs e)
 {
     Window1 wind = new Window1();
      wind.Show();
      PointCollection c = new PointCollection();
      int i = GCDSearch.EuclideanAlgorithm(out time1, Convert.ToInt16(TextBox1_Copy.Text), Convert.ToInt16(TextBox2_Copy.Text));
      int j = GCDSearch.BinaryGCDAlgorithm(out time2, Convert.ToInt16(TextBox1_Copy.Text), Convert.ToInt16(TextBox2_Copy.Text));
      Point v = new Point(time1 * 1000, 1);
      Point z = new Point(time2 * 1000, 2);
      c.Add(v);
      c.Add(z);
      wind.Chart1.DataContext = c;
 }
開發者ID:dmitriymatus,項目名稱:Tasks,代碼行數:13,代碼來源:Epam_Task3_WpfApplication.xaml.cs

示例15: VideoSurface

        public VideoSurface(string mediaSource)
        {
            this.ModelVisual3D = new ModelVisual3D();

            var geometryModel = new GeometryModel3D();
            this.ModelVisual3D.Content = geometryModel;

            this.geometry = new MeshGeometry3D();
            geometryModel.Geometry = geometry;

            var positions = new Point3DCollection();
            positions.Add(new Point3D(0, 0, 0));
            positions.Add(new Point3D(640, 0, 0));
            positions.Add(new Point3D(640, 480, 0));
            positions.Add(new Point3D(0, 480, 0));
            this.geometry.Positions = positions;

            var textureCoordinates = new PointCollection();
            textureCoordinates.Add(new System.Windows.Point(0, 1));
            textureCoordinates.Add(new System.Windows.Point(1, 1));
            textureCoordinates.Add(new System.Windows.Point(1, 0));
            textureCoordinates.Add(new System.Windows.Point(0, 0));
            this.geometry.TextureCoordinates = textureCoordinates;

            var triangleIndices = new Int32Collection();
            triangleIndices.Add(0);
            triangleIndices.Add(1);
            triangleIndices.Add(2);
            triangleIndices.Add(2);
            triangleIndices.Add(3);
            triangleIndices.Add(0);
            this.geometry.TriangleIndices = triangleIndices;

            var material = new EmissiveMaterial();
            var brush = new VisualBrush();
            this.border = new Border();
            this.border.BorderBrush = Brushes.White;
            this.border.BorderThickness = new Thickness(10);
            this.border.Opacity = 0;

            this.mediaElement = new MediaElement();
            mediaElement.LoadedBehavior = MediaState.Manual;
            mediaElement.Source = new Uri(mediaSource);

            this.border.Child = mediaElement;
            brush.Visual = border;
            material.Brush = brush;
            geometryModel.Material = material;

            this.mediaElement.MediaEnded += new RoutedEventHandler(mediaElement_MediaEnded);
        }
開發者ID:an83,項目名稱:KinectTouch2,代碼行數:51,代碼來源:VideoSurface.cs


注:本文中的System.Windows.Media.PointCollection.Add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。