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


C# Media.PointCollection类代码示例

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


PointCollection类属于System.Windows.Media命名空间,在下文中一共展示了PointCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: GetArrowOrientation

        static ArrowOrientation GetArrowOrientation(PointCollection points)
        {
            Debug.Assert(points.Count > 1, "Invalid connector");
            ArrowOrientation orientation;
            Point srcPoint = points[points.Count - 2];
            Point destPoint = points[points.Count - 1];

            if (srcPoint.X == destPoint.X)
            {
                orientation = ArrowOrientation.Top;
                if (destPoint.Y > srcPoint.Y)
                {
                    orientation = ArrowOrientation.Bottom;
                }
            }
            else
            {
                orientation = ArrowOrientation.Left;
                if (destPoint.X > srcPoint.X)
                {
                    orientation = ArrowOrientation.Right;
                }
            }
            return orientation;
        }
开发者ID:xiluo,项目名称:document-management,代码行数:25,代码来源:ConnectorPointsToArrowTransformConverter.cs

示例3: Triangulate

        protected override void Triangulate(
                                    DependencyPropertyChangedEventArgs args, 
                                    Point3DCollection vertices, 
                                    Vector3DCollection normals, 
                                    Int32Collection indices, 
                                    PointCollection textures)
        {
            // Clear all four collections.
            vertices.Clear();
            normals.Clear();
            indices.Clear();
            textures.Clear();

            // Convert TextGeometry to series of closed polylines.
            PathGeometry path =
                TextGeometry.GetFlattenedPathGeometry(0.001,
                                                ToleranceType.Relative);

            foreach (PathFigure fig in path.Figures)
            {
                list.Clear();
                list.Add(fig.StartPoint);

                foreach (PathSegment seg in fig.Segments)
                {
                    if (seg is LineSegment)
                    {
                        LineSegment lineseg = seg as LineSegment;
                        list.Add(lineseg.Point);
                    }

                    else if (seg is PolyLineSegment)
                    {
                        PolyLineSegment polyline = seg as PolyLineSegment;

                        for (int i = 0; i < polyline.Points.Count; i++)
                            list.Add(polyline.Points[i]);
                    }
                }

                // Figure is complete. Post-processing follows.
                if (list.Count > 0)
                {
                    // Remove last point if it's the same as the first.
                    if (list[0] == list[list.Count - 1])
                        list.RemoveAt(list.Count - 1);

                    // Convert points to Y increasing up.
                    for (int i = 0; i < list.Count; i++)
                    {
                        Point pt = list[i];
                        pt.Y = 2 * Origin.Y - pt.Y;
                        list[i] = pt;
                    }

                    // For each figure, process the points.
                    ProcessFigure(list, vertices, normals, indices, textures);
                }
            }
        }
开发者ID:tianweidut,项目名称:3DMap,代码行数:60,代码来源:GeometryTextBase.cs

示例4: Snip

        static bool Snip(PointCollection contour, int u, int v, int w, int n, int[] V)
        {
            int p;
            double Ax, Ay, Bx, By, Cx, Cy, Px, Py;

            Ax = contour[V[u]].X;
            Ay = contour[V[u]].Y;

            Bx = contour[V[v]].X;
            By = contour[V[v]].Y;

            Cx = contour[V[w]].X;
            Cy = contour[V[w]].Y;

            if (Epsilon > (((Bx - Ax) * (Cy - Ay)) - ((By - Ay) * (Cx - Ax)))) return false;

            for (p = 0; p < n; p++)
            {
                if ((p == u) || (p == v) || (p == w)) continue;
                Px = contour[V[p]].X;
                Py = contour[V[p]].Y;
                if (InsideTriangle(Ax, Ay, Bx, By, Cx, Cy, Px, Py)) return false;
            }

            return true;
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:26,代码来源:Polygon.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: SetAnimDash

        public void SetAnimDash(PointCollection pc, ShapeLayer layer)
        {
            MapPolyline animDashLine = new MapPolyline()
            {
                MapStrokeThickness = 20,
                Points = pc,
                ScaleFactor = 0.2
            };

            animDashLine.Stroke = new SolidColorBrush(System.Windows.Media.Color.FromArgb(128, 255, 255, 255));
            animDashLine.StrokeLineJoin = PenLineJoin.Round;
            animDashLine.StrokeStartLineCap = PenLineCap.Flat;
            animDashLine.StrokeEndLineCap = PenLineCap.Triangle;
            animDashLine.StrokeDashCap = PenLineCap.Triangle;
            var dc = new DoubleCollection { 2, 2 };
            animDashLine.IsHitTestVisible = false;
            animDashLine.StrokeDashArray = dc;

            DoubleAnimation animation = new DoubleAnimation
            {
                From = 4,
                To = 0,
                FillBehavior = System.Windows.Media.Animation.FillBehavior.HoldEnd,
                RepeatBehavior = RepeatBehavior.Forever
            };

            var strokeStoryboard = new Storyboard();
            strokeStoryboard.Children.Add(animation);
            Storyboard.SetTargetProperty(animation, new PropertyPath("(Line.StrokeDashOffset)"));
            Storyboard.SetTarget(animation, animDashLine);
            strokeStoryboard.Begin();
            layer.Shapes.Add(animDashLine);
        }
开发者ID:MuffPotter,项目名称:xservernet-bin,代码行数:33,代码来源:Window1.xaml.cs

示例7: 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

示例8: Convert

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var rc = value as IEnumerable<RegisterTransaction>;
            if (rc == null || rc.Count() == 0)
                return null;

            // Cheat a little here and get the min/max ranges for scaling
            double minValue = rc.Min(rt => rt.TotalBalance);
            double maxValue = rc.Max(rt => rt.TotalBalance);
            double increment = 100.0 / rc.Count();

            maxValue = Math.Max(Math.Abs(minValue), Math.Abs(maxValue));
            minValue = -maxValue;

            var pc = new PointCollection();
            double x = 0;
            foreach (var reg in rc)
            {
                double yPos = ((-minValue + reg.TotalBalance)/(maxValue - minValue)) * 100; 
                pc.Add(new Point(x, yPos));
                x += increment;
            }

            return pc;
        }
开发者ID:ssickles,项目名称:archive,代码行数:25,代码来源:RegisterEntriesToPointCollection.cs

示例9: Classify

        public static string Classify(bool useRubine, float duration, bool righthandedness, List<float> SpeakerAngles, PointCollection pointHist, StylusPointCollection S, List<List<int>> hist, List<List<int>> ihist)
        {
            // Convert all parameters to format used in GestureTests
            List<Vector2> InterpretedPoints = new List<Vector2>();
            List<Vector2> StylusPoints = new List<Vector2>();
            List<Vector2> VelocityHistory = new List<Vector2>();
            List<Vector2> InverseVelocityHistory = new List<Vector2>();
            foreach(Point P in pointHist)
                InterpretedPoints.Add(new Vector2((float)P.X,(float)P.Y));
            foreach(StylusPoint P in S)
                StylusPoints.Add(new Vector2((float)P.X,(float)P.Y));
            for (int i = 0; i < hist[0].Count; i++)
            {
                VelocityHistory.Add(new Vector2(hist[0][i], hist[1][i]));
                InverseVelocityHistory.Add(new Vector2(ihist[0][i], ihist[1][i]));
            }

            // Create a new Sample, compute the features, and classify
            GS = new GestureSample(GestureTests.Types.GestureType.unknown, righthandedness,duration,SpeakerAngles,InterpretedPoints,StylusPoints,VelocityHistory,InverseVelocityHistory);
            GS.ComputeFeatures(GestureFeatures.PointsStroke);

            if (useRubine)
                return EC.Recognizer.Classify(GS).ToString();
            WriteARFF();

            Instances test = new Instances(new java.io.FileReader("outfile.arff"));
            test.setClassIndex(0);

            double clsLabel = cls.classifyInstance(test.instance(0));
            test.instance(0).setClassValue(clsLabel);

            // Return the appropriate label
            return ((GestureType2D)((int)clsLabel+1)).ToString();
        }
开发者ID:ISUE,项目名称:Multiwave,代码行数:34,代码来源:WekaHelper.cs

示例10: generatePentagon

        private void generatePentagon(double R, double x, double y)
        {
            try
            {
                PointCollection pointCollection = new PointCollection();
                int R2 = (int)(R / Math.Sqrt(2));

                Point[] pt = new Point[6];
                pt[0].X = x; pt[0].Y = y - R;
                pt[1].X = x + R2; pt[1].Y = y - R2;
                pt[2].X = x + R; pt[2].Y = y;
                pt[3].X = x + R2; pt[3].Y = y + R2;
                pt[4].X = x; pt[4].Y = y + R;
                pt[5].X = pt[0].X; pt[5].Y = pt[0].Y;

                //m_halfOctagon = new List<DataPoint>();
                for (int idx = 0; idx < pt.Length; idx++)
                {
                    m_halfOctagon.Add(new DataPoint(pt[idx], idx));
                }
            }
            catch (Exception)
            {

            }
        }
开发者ID:wi5nia,项目名称:Samples,代码行数:26,代码来源:Shapes.cs

示例11: square

        //считаем площадь полигона
        public double square(PointCollection pol)
        {
            double s = 0;
            double res = 0;
            double sq = 0;
            int n = pol.Count;//кол-во вершин
            for (int i = 0; i < n; i++)
            {
                if (i == 0)
                {
                    s = pol[i].X * (pol[n - 1].Y - pol[i + 1].Y); //если i == 0, то y[i-1] заменяем на y[n-1]
                    res += s;
                }
                else
                    if (i == n - 1)
                    {
                        s = pol[i].X * (pol[i - 1].Y - pol[0].Y); // если i == n-1, то y[i+1] заменяем на y[0]
                        res += s;
                    }
                    else
                    {
                        s = pol[i].X * (pol[i - 1].Y - pol[i + 1].Y);
                        res += s;
                    }
            }

            sq = Math.Abs(res / 2);

            return sq;
        }
开发者ID:Svet-LAN-a,项目名称:mollusksRecognition,代码行数:31,代码来源:params.cs

示例12: CalculateBackFacePoints

        /// <summary>
        /// Calculates the points for back face
        /// </summary>
        public void CalculateBackFacePoints()
        {
            _backFacePoints = new PointCollection();

            foreach(Point point in _frontFacePoints)
                _backFacePoints.Add(new Point(point.X + _depth3D, point.Y - _depth3D));
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:10,代码来源:Graphics.cs

示例13: Computing

        public Computing()
        {
            Result = new Moment(0);
            //Tmr = new Timer(3000);
            //Tmr.AutoReset = true;
            //Tmr.Elapsed += Tmr_Elapsed;

            InpFileName = @"D:\ballistics\ballisticwpf\config.txt";
            OutFileName = @"D:\ballistics\ballisticwpf\result.txt";

            //string InpFileName = @"C:\Users\Andrey\Documents\Visual Studio 2015\Projects\ballistics\ballisticwpf\config.txt";
            //string OutFileName = @"C:\Users\Andrey\Documents\Visual Studio 2015\Projects\ballistics\ballisticwpf\result.txt";
            Config = new Configuration(0);
            Config.ReadConfugurationFromFile(InpFileName);

            bool ExistFlag = File.Exists(OutFileName);
            if (ExistFlag)
            {
                File.Delete(OutFileName);
            }

            Positions = new PointCollection();
            Positions.Add(new Point(0, 0));

            Chart = new Polyline();
            Chart.Points = Positions;

            //BgrWork = ((BackgroundWorker)this.FindResource("bgrWork"));
            //ComplexArg = new ComplexForAsyns(Config);
        }
开发者ID:parshikov-a,项目名称:ballistics,代码行数:30,代码来源:Computing.xaml.cs

示例14: goButton_Click

        private void goButton_Click(object sender, RoutedEventArgs e)
        {
            Parser.Parser.Variable variableI;
            Parser.Parser parser = new Parser.Parser();

            parser = new Parser.Parser();
            parser.InputString = functionTextBox.Text;
            variableI = parser.GetVariable("x");

            PointCollection p = new PointCollection();

            Random r = new Random();

            for (float i = 0; i <= 10; i += 0.5f)
            {
                points.pointX.Add(i);
                variableI.value = i;
                clearSignal.Add(variableI.value);

                //variableI.value = (i % 3 == 0) ? i * (float)r.NextDouble() : i;
                //noiseSignal.Add(variableI.value);
                points.pointY.Add(parser.Calculate());
                p.Add(new Point(parser.Calculate(), i));
            }

            chart.DataContext = p;
        }
开发者ID:RednecksCoders,项目名称:NeuroNet,代码行数:27,代码来源:MainWindow.xaml.cs

示例15: 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


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